# Lecture 011

## Partial Derivative

There can be many derivative on a surface. (because we have a tangent plane)

Partial Derivatives: the partial derivatives of $z = f(x, y)$ is

1. $\frac{\partial z}{\partial x} = \lim_{h \rightarrow 0} \frac{f(x+h, y) - f(x, y)}{h}$ (with respect to $x$, treating all other variables constant) and
2. $\frac{\partial z}{\partial y} = \lim_{h \rightarrow 0} \frac{f(x, y+h) - f(x, y)}{h}$ (with respect to $y$, treating all other variables constant) provided limit exists. (with respect to $x$, sometimes denoted $\frac{\delta z}{\delta x}, \frac{\delta f}{\delta x}, f_x, z_x$)

Example: we set everything other than $x$ direction constant

• $\frac{\partial z}{\partial x}|_{(x=a, y=b)} = z_x(x, y) |_{(x=a, y=b)}$

• so the tangent vector is $\langle{1, 0, z_x(a, b)}\rangle$

• notice we replace everything other constant component with 0 (since we assume they don't change)

• notice we replace the component we are taking derivative against with 1 (since we want our base fraction to be 1)

• notice we relace the $z$ component (output component) to be the derivative (since base is 1)

• tangent line: $\langle{x, y, z(x, y)}\rangle + t \langle{0, 1, z_x(a, b)}\rangle$

• tangent plane: plane formed by two tangent lines $\overrightarrow{N}(\langle{x, y, z}\rangle - \overrightarrow{P}) = 0$

## Higher Order Partial Derivatives

$f_{xx} = \frac{\partial^2 z}{(\partial x)^2}$ $f_{xy} = \frac{\partial^2 z}{(\partial x)(\partial y)} = \frac{\partial^2 z}{(\partial y)(\partial x)} = f_{yx}$ $f_{yy} = \frac{\partial^2 z}{(\partial y)^2}$

Clairaut's Theorem: if $f(x, y)$ is defined on an open disk and $f_{xy}$ and $f_{yx}$ are continuous, then $f_{xy} = f_{yx}$

Tangent Plane: $z(x, y) = f(x_0, y_0) + (f_x(x_0, y_0))(x - x_0) + (f_y(x_0, y_0))(y-y_0)$ is the equation of the tangent plane to $S$ at $P_0 = (x_0, y_0)$

• tangent line is $y = f(x_0) + (f'(x_0))(x - x_0)$

// TODO: what does it mean? Differentiability: all tangent lines at $(x_0, y_0)$ are at the same tangent plane. If $f(x, y) = f(x_0, y_0) + f_x(x_0, y_0)(x - x_0) + f_y(x_0, y_0)(y - y_0) + E(x, y)$ where $\lim_{(x, y) \rightarrow (x_0, y_0)}\frac{E(x, y)}{\sqrt{(x-x_0)^2 + (y-y_0)^2}} = 0$

• Continuous but not differentiable: the derivative from two direction is not the same (a cusp).

• Not Differentiable: if it is not differentiable in one direction, then it is not differentiable.

• Differentiable: if $f(x, y), f_x(x, y), f_y(x, y)$ all exists and continuous near $(x_0, y_0)$, then $z = f(x, y)$ is differentiable at $(x_0, y_0)$

• existence of both partial derivative is not enough to guarantee differentiability.

2D Linear Approximation: $y(x) \simeq f(x_0) + f'(x_0) (x-x_0)$ for $x$ close to $a$ 3D Linear Approximation: $z(x, y) \simeq z(x_0, y_0) + z_x(x_0, y_0)(x - x_0) + z_y(x_0, y_0)(y - y_0)$

(Total) Differentials: $dz = \frac{\partial z}{\partial x} \cdot dx + \frac{\partial z}{\partial y} \cdot dy$ is the differential of $z = f(x, y)$ at $(x_0, y_0)$ (where $\Delta z = dz, \Delta x = dx, \Delta y = dy$)

## Higher Order Chain Rule

• a derivative line is total if the parent only depends on one variable

• a derivative line is partial if the parent depends more than one variables

Chain Rule: $f(g(t), h(t))$ where $f, g, h$ differentiable then $\frac{d(f(g(t), h(t)))}{dt} = \frac{\partial f(g(t), h(t))}{\partial (g(t))} \cdot \frac{d(g(t))}{dt} + \frac{\partial f(g(t), h(t))}{\partial (h(t))} \cdot \frac{d(h(t))}{dt}$

Example: $A = \pi \cdot a \cdot b$, find the percent change in area when $a$ increase by $2\%$ and $b$ increase by $1.5\%$

\begin{align*} dA &= \frac{\partial A}{\partial a} \cdot da + \frac{\partial A}{\partial b} \cdot db\\ &= \pi b \cdot 0.02a + \pi a \cdot 0.015b\\ &= 0.035 \pi ab\\ &= 0.035 A\\ \frac{dA}{A} &= 3.5\%\\ \end{align*}

## Implicit Differentiation

2D Implicit Differentiation: when equation is not a function, apply $\frac{d}{dx}$ on both side to separate $\frac{dy}{dx} = f(x, y)$ given point $(x, y)$ on line. 3D Implicit Differentiation: to get $\frac{\partial ?}{\partial z}$ differentiate both side with $\frac{\partial}{\partial x}$, $\frac{\partial }{\partial y}$ and treat $y, x$ as constant while write out $\frac{\partial ?}{\partial z}$ instead of assuming it is $1$.

### Example 1:

Find tangent plane to $x^2 + \frac{y^2}{9} + 2z^2 = 1$ at point $(\frac{3}{\sqrt{29}}, \frac{3}{\sqrt{29}}, \frac{3}{\sqrt{29}})$.

Let $f = x^2 + \frac{y^2}{9} + 2z^2$, $g = 1$.

1. we find $\frac{\partial z}{\partial x}$ by assuming only $z$ depends on $x$ and treat other variables (other than $x$, constant).
2. we find $\frac{\partial f}{\partial x}$ and $\frac{\partial g}{\partial x}$ (usually $g' = 0$) in terms of $x, y, z, \frac{\partial z}{\partial x}$
\begin{align*} \frac{\partial}{\partial x} [x^2 + y^2/2 + 2z^2] &= \frac{\partial}{\partial x}[1]\\ 2x + 0 + 4z\frac{\partial z}{\partial x} &= 0\\ \frac{\partial z}{\partial x} &= -\frac{2x}{4z}\\ \frac{\partial z}{\partial x}|_{(\frac{3}{\sqrt{29}}, \frac{3}{\sqrt{29}}, \frac{3}{\sqrt{29}})} &= \frac{1}{2}\\ \end{align*}

Similarly: we find $\frac{\partial z}{\partial y} = -\frac{y}{18z}$ and get tangent plane by $z = z(x_0, y_0) + z_x(x, y)(x - x_0) + z_y(x, y)(y - y_0)$

### Example 2:

Find tangent plane to $x^2 + \frac{y^2}{9} + 2z^2 = 1$ at point $(\frac{3}{\sqrt{29}}, \frac{3}{\sqrt{29}}, \frac{3}{\sqrt{29}})$.

Let $f = x^2 + \frac{y^2}{9} + 2z^2$ by assuming $x, y, z$ independent. Find $\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z}$. Then let $f(x, y, z) = 1$, this will reduce a dimension, WLOG let $z$ depends on $x, y$, then

\begin{align*} \frac{\partial f(x, y, z(x, y))}{\partial x} &= \frac{\partial f}{\partial z} \frac{\partial z}{\partial x} + \frac{\partial f}{\partial x}\\ 0 &= \frac{\partial f(x, y, z)}{\partial z}\frac{\partial z}{\partial x} + \frac{\partial f(x, y, z)}{\partial x}\\ \frac{\partial z}{\partial x} &= -\frac{\partial f(x, y, z) / \partial x}{\partial f(x, y, z) / \partial z}\\ \end{align*}

(partial derivative is composed with 2 routes)

// QUESTION: why do we assume x, y independent? significance? // QUESTION: do we have interdependence in calculus? // QUESTION: find partial derivative of leaf over leaf requires rearranging tree?

### Example 3:

Find $\frac{\partial z}{\partial x}$ for $x^2 - 8xyz + y^2 +6z^2 = 0$.

1. Since we want $\frac{\partial z}{\partial x}$, we have to assume $z$ depends on $x$. So we have $z(x)$.
2. Let $f(x, y, z(x)) = x^2 - 8xyz + y^2 +6z^2$, notice that $f$ also depends on $x$.
3. By chain rule

Video

\begin{align*} x^2 - 8xyz + y^2 +6z^2 &= 0\\ \frac{\partial}{\partial x}(x^2 - 8xyz + y^2 +6z^2) &= 0\\ \frac{\partial f(x, y, z)}{\partial x} &= 0\\ \frac{\partial z(x)}{\partial x} &= 0\\ \frac{\partial z(x)}{\partial x} &= \frac{-\frac{\partial f(x, y, z(x))}{\partial x}}{\frac{\partial f(x, y, z(x))}{\partial z(x)}}\\ \frac{\partial z(x)}{\partial x} &= -\frac{f_x}{f_z}\\ \end{align*}

// TODO: 10.8 Notes

## Directional Derivative

Directional derivative:

D_{\overrightarrow{u}} f(a, b) = \lim_{h \rightarrow 0} \frac{f(a + h \cos \theta, b + h \sin \theta) - f(a, b)}{h}

provided the limit exist and $\overrightarrow{u} = \langle{\cos \theta, \sin \theta}\rangle$ (guaranteed to be unit vector because the property of $\cos, \sin$).

Partial Derivative:

\begin{cases} \frac{\partial f}{\partial x} = D_{\langle{1, 0}\rangle} f_{\theta = 0}\\ \frac{\partial f}{\partial x} = D_{\langle{1, 0}\rangle} f_{\theta = \frac{\pi}{2}}\\ \end{cases}

If $\frac{\partial z}{\partial x}, \frac{\partial z}{\partial y}$ both defined:

\begin{align*} D_{\langle{\cos \theta, \sin \theta}\rangle}f &= \frac{\partial z}{\partial x} \cos \theta + \frac{\partial z}{\partial y} \sin \theta\\ &= \triangledown f \cdot \langle{\cos \theta, \sin \theta}\rangle\\ &= \|\triangledown f\| \|\langle{\cos \theta, \sin \theta}\rangle\| \cos \varphi\\ &= \|\triangledown f\| \cos \varphi \tag{where $\varphi$ is angle between gradient and directional derivative}\\ \end{align*}

As the result, the maximum direction derivative is the magnitude of gradient. Gradient is a 2D vector pointing in the direction of maximum increase and whose magnitude is its directional derivative

$\triangledown f(x, y) = \langle{f_x(x, y), f_y(x, y)}\rangle$

• $\triangledown f = \overrightarrow{0} \implies (\forall \overrightarrow{a})(D_{\overrightarrow{a}}f = 0)$

• $\triangledown f \neq \overrightarrow{0} \implies (D_{\overrightarrow{u}}f(a, b) \text{ is maximized over } \overrightarrow{u} \text{ when } \overrightarrow{u} = \frac{\triangledown f}{\| \triangledown f \|})$

Theorem:

1. $\triangledown f(x_0, y_0) = \overrightarrow{0} \implies (\forall \overrightarrow{a})(D_{\overrightarrow{a}} f(x_0, y_0) = 0)$ and $(x_0, y_0)$ is a critical point
2. $\triangledown f \neq \overrightarrow{0} \implies D_{\overrightarrow{u}} f(a, b) \text{ is maximized when } \overrightarrow{u} = \frac{\triangledown f}{\|\triangledown f\|}$
3. $\triangledown f(x_0, y_0)$ is normal to the level curve $f(x, y) = c$ of $z = f(x, y)$ at point $(x_0, y_0)$. (by $\triangledown f(x_0, y_0) \cdot \langle{\frac{dx}{dt}, \frac{dy}{dt}}\rangle = 0$)

// TODO: how to find the acceleration unit vector of a ball on a surface

Gradient of 3 variable: $\triangledown f = \langle{f_x, f_y, f_z}\rangle$

• gradient of 3 dimension normal to 2 dimension slice

Directional: $D_{\overrightarrow{u}}(f) = \triangledown f \cdot \overrightarrow{u}$ for $\langle{\cos \alpha, \cos \beta, \cos \gamma}\rangle \text{ where } \cos^2 \alpha + \cos^2 \beta + \cos^2 \gamma = 1$

## Maximum, Minimum

Fermat's Theorem: If $y = f(x)$ has a local maximum or local minimum at $x_0$, then $x_0$ is a critical point.

• Critical Point: where $\triangledown f (x_0, y_0) = 0 \lor \triangledown f (x_0, y_0) \text{ is undefined.}$ (solve a system of two equations)

## Classifying Critical Points

// TODO: intuition of Hessian Matrix More on Hessian Matrix

Hessian of $f$: $H(f) = \begin{pmatrix} f_{xx} & f_{xy}\\ f_{yx} & f_{yy}\\ \end{pmatrix}$ when $f(x, y)$ differentiable, and second order partial derivatives continuous

• $\det \begin{pmatrix} f_{xx} & f_{xy}\\ f_{yx} & f_{yy}\\ \end{pmatrix} = f_{xx}f_{yy} - f_{xy}^2$

Second Derivative Test

• $D > 0 \land f_{xx} < 0 \implies (x_0, y_0) \text{ is local max}$

• $D > 0 \land f_{xx} > 0 \implies (x_0, y_0) \text{ is local min}$

• $D < 0 \implies (x_0, y_0) \text{ is a saddle point}$

• $D = 0 \implies \text{inconclusive}$

## Absolute Maxima and Minima (Extreme Value Theorem)

2D Extreme Value Thorem: Continuous function $y = f(x)$ on closed, bounded interval $[a, b]$ has an absolute maximum and an absolute minimum.

3D Extreme Value Thorem: Continuous function $z = f(x, y)$ on a closed, bounded domain $D$ has an absolute maximum and an absolute minimum on $D$.

• Bounded: not infinite

• Closed: boundary value included

Find Extrema:

• Find critical points on the interror of $D$

• Find critical points along the boundary of $D$ (both endpoint of the line and interror of the line)

## Lagrouge Multiplier with 2 Constraints

Substitution: will be complicated.

Example: Maximize $f(x, y) = \frac{1}{20}(28x + 96y - x^2 - 2xy - 9y^2)$ with constraint $g(x, y) = 20x+4y = 216$.

\begin{align*} \begin{cases} \triangledown f = \lambda \triangledown g\\ g(x, y)\\ \end{cases} \implies &\begin{cases} f_x(x, y) &= \lambda g_x(x, y)\\ f_y(x, y) &= \lambda g_y(x, y)\\ g(x, y) &= 216\\ \end{cases} \implies &\begin{cases} \frac{1}{20}(48 - 2x - 2y) &= \lambda 20\\ \frac{1}{20}(96 - 2x - 18y) &= \lambda 4\\ 20x + 4y &= 216\\ \end{cases} \end{align*}

Solution will give you critical candidate to be local maximum or minimum.

// QUESTION: is it possible instead of getting critical points, I get a critical line Yes. Possible.

## Lagrouge Multiplier with 3 Constraints

Visual Proof of Lagrouge Multiplier

Optimize $w = f(x, y, z)$ to satisfy $\begin{cases} g(x, y, z) = c_1\\ h(x, y, z) = c_2\\ \end{cases}$

Then we find critical point by:

\begin{cases} \triangledown f = \lambda_1 \triangledown g + \lambda_2 \triangledown h\\ g(x, y, z) = c_1\\ h(x, y, z) = c_2\\ \end{cases}

// WARNING: Lagrouge Multiplier does not guarantee there always be a maximum and minimum with 2 critical points. It was guaranteed by Extreme Value Thorem. There can be two local minimum. (For example, there exists no maximum distance between a point and a curve towards infinity)

Table of Content