# Multivariable Calculus

## Partial derivatives #

Graph of a function with two variables: $$(x,y,z) \in \mathbb{R}^3 \land z = f(x,y) \land (x, y) \in D$$ The set D is the domain of $f$

Partial derivative of $f$ w.r.t. $x$ at $(a, b)$:

$$f_a(a,b) = g'(a) \text{ where } g(x)=f(x,b)=\lim_{h \to 0}\frac{f(a+h,b)-f(a,b)}{h}$$

Also works with implicit differentiation

Second partial derivatives:

$$(f_x)_x = f_{xx} = f_{11} = \frac{\delta}{\delta x}(\frac{\delta f}{\delta x}) = \frac{\delta^2 f}{\delta x^2}$$

$$(f_x)_y = f_{xy} = f_{12} = \frac{\delta}{\delta y}(\frac{\delta f}{\delta x}) = \frac{\delta^2 f}{\delta y\ \delta x}$$

$$(f_y)_x = f_{yx} = f_{21} = \frac{\delta}{\delta x}(\frac{\delta f}{\delta y}) = \frac{\delta^2 f}{\delta x\ \delta y}$$

$$(f_y)_y = f_{yy} = f_{22} = \frac{\delta}{\delta y}(\frac{\delta f}{\delta y}) = \frac{\delta^2 f}{\delta y^2}$$

Note that the order is reversed.

Clairaut's Theorem: Suppose $f$ is defined on a disk $D$ that contains the point $(a,b)$. In the functions $f_{xy}$ and $f_{yx}$ are both continuous on $D$, then

$$f_{xy}(a,b) = f_{yx}(a,b)$$

## Linear Approximations / Tangent plane #

Equation of the tangent plane to surface $z = f(x,y)$ at the point $P(x_0, y_0, z_0)$:

$$z - z_0 = f_x(x_0,y_0)(x-x_0) + f_y(x_0,y_0)(y-y_0)$$

Linear approximation / tangent plane approximation: $$f(x,y) \approx f(a,b) + f_x(a,b)(x - a) + f_y(a,b)(y-b)$$

Tangent plane:

$$\nabla f(x_0,y_0,z_0) \cdot \vec{r'}(t) = 0$$

Plane equation: $$f_x(x_0,y_0,z_0)(x - x_0) + f_y(x_0,y_0,z_0)(y - y_0) + f_z(x_0,y_0,z_0)(z - z_0) = 0$$

## Differentials #

Differential $dz$ / Total differential: $$dz = f_x(x,y)dx + f_y(x,y)dy = \frac{\delta z}{\delta x}dx + \frac{\delta z}{\delta y}dy$$

## The Chain Rule #

$z = f(x,y)$ where $x$ and $y$ are functions of $t$:

$$\frac{dz}{dt} = \frac{\delta f}{\delta x}\frac{dx}{dt} + \frac{\delta f}{\delta y}\frac{dy}{dt}$$

$z = f(x,y)$ where $x = (s,y)$ and $y=h(s,y)$:

$$\frac{\delta z}{\delta s} = \frac{\delta z}{\delta x}\frac{\delta x}{\delta s} + \frac{\delta z}{\delta y}\frac{\delta y}{\delta s}$$

$$\frac{\delta z}{\delta t} = \frac{\delta z}{\delta x}\frac{\delta x}{\delta t} + \frac{\delta z}{\delta y}\frac{\delta y}{\delta t}$$

Can be extended to functions of any amount of variables.

Implicit derivative (Implicit Function Theorem):

$$\frac{dy}{dx} = -\frac{\frac{\delta F}{\delta x}}{\frac{\delta F}{\delta y}} = -\frac{F_x}{f_y}$$

## Directional derivative #

Theorem: If the partial derivatives $f_x$ and $f_y$ exist near $(a,b)$ and are continuous at $(a,b)$, then $f$ is differentiable at $(a,b)$

The directional derivative of $f$ at $(x_0, y_0)$ in the direction of the unit vector $\vec{u} = \langle a, b \rangle$:

$$D_{\vec{u}} f(x_0,y_0) = \lim_{h \to 0}\frac{f(x_0+ha, y_0+hb) - f(x_0,y_0)}{h}$$

If $f$ is a differentiable function of $x$ and $y$, then $f$ has a directional derivative in the direction of any unit vector $\vec{u} = \langle a, b \rangle$: $$D_{\vec{u}} f(x,y) = f_x(x,y)a + f_y(x,y)b$$

If the unit vector has an angle $\theta$ on the positive $x$-axis then $\vec{u} = \langle \cos\theta, \sin\theta \rangle$:

$$D_{\vec{u}} f(x,y) = f_x(x,y)\cos\theta + f_y(x,y)\sin\theta$$

$$\nabla f(x,y) = \langle f_x(x,y), f_y(x,y) \rangle = \frac{\delta f}{\delta x}\vec{i} + \frac{\delta f}{\delta y}\vec{j}$$

The directional derivative can be written as the dot product of two vectors (the gradient and unit vector):

\begin{align*} D_{\vec{u}} f(x,y) &= f_x(x,y)a + f_y(x,y)b \\ &= \langle f_x(x,y), f_y(x,y) \rangle \cdot \langle a, b \rangle \\ &= \langle f_x(x,y), f_y(x,y) \rangle \cdot \vec{u} \\ &= \nabla f \cdot \vec{u} \end{align*}

## Minimum and Maximum values #

Critical/stationary point $(a,b)$ if $f_x(a,b)=0$ and $f_y(a,b)=0$. Can be found by solving the system.

### Local min/max #

• Local maximum at $(a,b)$ if $f(x,y) \leq f(a,b)$ when $f(x,y)$ is near $(a,b)$
• Local minimum at $(a,b)$ if $f(x,y) \geq f(a,b)$ when $f(x,y)$ is near $(a,b)$

The value $f(a,b)$ is called the local maximum/minimum value

### Second derivatives test #

$$D = D(a,b) = f_{xx}(a,b)f_{yy}(a,b) - [f_{xy}(a,b)]^2$$

• Local minimum $f(a,b)$ if $D > 0$ and $f_{xx}(a,b) > 0$
• Local maximum $f(a,b)$ if $D > 0$ and $f_{xx}(a,b) < 0$
• Saddle point $(a,b)$ if $D < 0$

To remember $D$ you can write it as a determinant: $$D = \begin{vmatrix} f_{xx} & f_{xy} \\ f_{yx} & f_{yy} \end{vmatrix} = f_{xx}f_{yy} - (f_{xy})^2$$

## Double Integrals #

Over rectangles:

If $f$ is continuous the rectangle $$R = \{ (x,y) \mid a \leq x \leq b, c \leq x \leq d \}$$ then $$\iint\limits_{R} f(x,y)~dA = \int_a^b\int_c^d f(x,y)~dy~dx = \int_c^d\int_a^b f(x,y)~dx~dy$$

Over general regions: the constant bounds must be on the outside

Where $f$ is continuous of region $D$

Type I (Function of $x$): $$D = \{ (x,y) \mid a \leq x \leq b, g_1(x) \leq y \leq g_2(x) \}$$ $$\iint\limits_{D} f(x,y)~dA = \int_a^b\int_{g_1(x)}^{g_2(x)} f(x,y)~dy~dx$$

Type II (Function of $y$): $$D = \{ (x,y) \mid c \leq y \leq d, h_1(y) \leq x \leq h_2(y) \}$$ $$\iint\limits_{D} f(x,y)~dA = \int_a^b\int_{h_1(y)}^{h_2(y)} f(x,y)~dx~dy$$

Multiple integrals (more dimensions): each integral eliminates a set of variables