Lecture 11     

The Gradient

APMA E2000

Drew Youngren dcy2@columbia.edu

$\gdef\RR{\mathbb{R}}$ $\gdef\vec{\mathbf}$ $\gdef\bv#1{\begin{bmatrix} #1 \end{bmatrix}}$ $\gdef\proj{\operatorname{proj}}$ $\gdef\comp{\operatorname{comp}}$

Announcements

  • No quiz this week
  • Recitation 6 this week
  • HW6 due next Tuesday

1-minute review

The Chain Rule

If $f(x_1, \ldots, x_n)$ is a differntiable function and each $x_i$ depends smoothly on $t$, then \[ \frac{d(f\circ \vec x)}{dt} = \sum_{i=1}^n \frac{\partial f}{\partial x_i} \frac{d x_i}{dt} \]

Notation

We write \[\nabla f = \left\langle \frac{\partial f}{\partial x_1}, \ldots, \frac{\partial f}{\partial x_n} \right\rangle \]

Thus, the chain rule becomes \[ \frac{d}{dt} f ( \vec x(t)) = \nabla f(\vec x(t)) \cdot \vec x'(t) \]

Quick Example

Show that any function of the form $f(x,y) = g(x^2 + y^2)$ where $g$ is a differentiable function is symmetric in $\theta$ (the usual polar coordinate). That is, \[ \frac{\partial f}{\partial \theta} = 0.\]

Solution.

$x = r\cos \theta, y = r\sin \theta$. So, \[\frac{\partial f}{\partial \theta} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial \theta} + \frac{\partial f}{\partial y}\frac{\partial y}{\partial \theta} \] \[ = g'(x^2 + y^2)2x (-r\sin\theta) + g'(x^2 + y^2)2y (r\cos\theta)\] \[ = g'(r^2)2r^2 (-\sin\theta\cos\theta + \cos\theta\sin\theta) = 0\]

Directional Derivatives

Definition

Let $\vec u$ be a unit vector ($|\vec u | = 1$). The directional derivative of $f(\vec x)$ in the direction $\vec u$ is given by. \[D_{\vec u} f(\vec x) = \lim_{h \to 0} \frac{f(\vec x + h \vec u) - f(\vec x)}{h}\]

Interpretation

Graphically, this is just like taking a partial derivative but in any direction instead of just parallel to the axes.

Formula

Let $\vec r(t) = \vec x + t \vec u$, a line. Then,

\[ (f\circ\vec r)'(0) = D_{\vec u}f(\vec x)\]

\[ D_{\vec u}f(\vec x) = \nabla f(\vec x) \cdot \vec u \]

Example

Find the directional derivative of the function $f(x,y) = e^{x-y^2}$ at the point $(0, 1)$ in the direction of $\left\langle 2, -1 \right\rangle$.

Solution. $\vec u = \left\langle 2/\sqrt5, -1/\sqrt5 \right\rangle$, so we compute \[ \nabla f\cdot \vec u = \left\langle e^{x-y^2}, -2ye^{x-y^2} \right\rangle \cdot \left\langle 2/\sqrt5, -1/\sqrt5 \right\rangle \]

At $(0,1)$ gives $\frac{4}{e\sqrt5} $.

Properties

Some Questions

Must there always be some $\vec u$ such that \[D_{\vec u} f = 0 ? \]

Some Questions

What can we say about about \[D_{-\vec u} f ? \]

Some Questions

What of a function where $D_{\vec u} f = 1 $ in all directions?

$\nabla f$

The Gradient

Defining properties of $\nabla f$

  • Orthogonal to level sets.
  • Points in the direction of greatest rate of change.
  • Magnitude is greatest rate of change.

Orthogonal to level sets

Let $\vec r(t)$ be completely contained in the level set $f(\vec x) = k$.

Then $\displaystyle \frac{d}{dt} \left(f(\vec r(t))\right) = 0$ $ = \nabla f \cdot \vec r'(t)$

So $\nabla f$ is orthogonal to every tangent vector to the level set.

Example

Sketch some level surfaces and gradient vectors of the function \[ f(x,y,z) = x^2 + y^2 - z^2.\]

Exercise

Find an equation for the tangent plane to the surface \[ z + x e^y \cos(z) = x y - 1 + \frac{\pi}{2} \] at the point $(1, 1, \pi/2)$.

Maximum Rate of Change

We seek to evaluate \[ \max \limits_{|\vec u|=1} D_{\vec u} f(\vec x)\]

\[ = \max \limits_{|\vec u|=1} \nabla f( \vec x)\cdot \vec u \]

\[ = \max \limits_{|\vec u|=1} |\nabla f (\vec x)| |\vec u| \cos \theta \]

\[ = |\nabla f (\vec x)| \text{ at }\theta = 0.\]

Maximum Rate of Change

$\theta = 0$ means $\vec u = \frac{\nabla f}{|\nabla f|}$

\[ \max \limits_{|\vec u|=1} D_{\vec u} f(\vec x) = D_{\frac{\nabla f}{|\nabla f|}} f = \nabla f \cdot \frac{\nabla f}{|\nabla f|}\]

\[ = \frac{\nabla f \cdot \nabla f}{|\nabla f|} = \frac{|\nabla f|^2}{|\nabla f|} = |\nabla f| \]

Gradient A/Descent

Heat-seeking Dots

Consider a scattered array of objects in the domain of a scalar field with the simple instructions to "follow the gradient".

Example

Find a path in the plane starting from $(2,1)$ that follows the negative gradient of the function \[ f(x,y) = x^2 + \frac{y^2}{4}.\]

Solution. We set up the ODE $\vec r'(t) = -\nabla f$ with $\vec r(0) = \langle 2,1 \rangle$.

This is a separable system. \[ \begin{align*} x'(t) &= -2 x(t) \\ y'(t) &= -\frac{y(t)}{2} \\ \end{align*} \longrightarrow \begin{align*} x(t) &= 2e^{-2t} \\ y(t) &= e^{-t/2} \\ \end{align*} \]

We can see this trajectory by relating $x$ and $y$ by $x = 2y^4$.

Learning Outcomes

You should be able to...
  • Distinguish between the definition and the formula for directional derivatives.
  • Rattle off the 3 principal properties of the gradient.
  • Use the gradient to find tangent planes to level curves.
  • Given the gradient at a point, identify directions with particular growth rates.
  • Sketch a gradient field in 2 dimensions given a contour plot.