Wichita State University Logo

Math 344: Calculus III

14.6 Directional Derivatives and Gradients


14.6.1 Directional Derivatives

Previously, we discussed partial derivatives and their utility in examining the change in a surface along the $x$- and $y$- directions as well as determining the equation of the tangent plane to a surface. The definition we had for these partial derivatives was

$$ \def\ihat{\mathbf{\hat{\mmlToken{mi}[mathvariant="bold"]{ı}}}} \def\jhat{\mathbf{\hat{\mmlToken{mi}[mathvariant="bold"]{ȷ}}}} \def\khat{\mathbf{\hat{k}}} \newcommand{\pzi}[2][]{\dfrac{\partial #1}{\partial #2}} \begin{align*} f_x(x_0,y_0) &= \lim_{h\rightarrow 0} \dfrac{f(x_0 + h,y_0) - f(x_0,y_0)}{h} \\ \\ f_y(x_0,y_0) &= \lim_{h\rightarrow 0} \dfrac{f(x_0,y_0 + h) - f(x_0,y_0)}{h} \end{align*} $$
and the values gave the rate of change of $z$ along the $\ihat$ and $\jhat$ directions.

The natural questions to ask is how do we determine the rate of change of $z$ with respect a different direction $\mathbf{u}$, one that does not happen to be aligned with one of our canonical unit vectors. To do this, we select a unit vector $\mathbf{u} = \langle\,u_1,u_2\,\rangle$ and use a variation on the definitions above:

Definition

The directional derivative of $f$ at $(x_0,y_0)$ in the direction $\mathbf{u} = \langle\,u_1,u_2\,\rangle$ is

$$ D_\mathbf{u} f(x_0,y_0) = \lim_{h\rightarrow 0} \dfrac{f(x_0 + hu_1,y_0 + hu_2) - f(x_0,y_0)}{h} $$
if the limit exists.

Here $h$ serves as a scalar multiple of $\mathbf{u}$ and determines how much we move along the surface in the $\mathbf{u}$ direction.

The formulas for $f_x$ and $f_y$ can be found by taking $\mathbf{u} = \ihat = \langle\,1,0\,\rangle$ and $\mathbf{u}=\jhat=\langle\,0,1\,\rangle$, respectively. This means that the partial derivatives are just special cases of a directional derivative.

14.6.2 Computing Directional Derivatives

Theorem

For a differentiable function $f(x,y)$, its direction derivative with respect to $\mathbf{u} = \langle\,u_1,u_2\,\rangle$ is given by

$$ D_\mathbf{u}f(x,y) = f_x(x,y)u_1 + f_y(x,y)u_2 $$

This means that we may easily compute the directional derivative with respect to $\mathbf{u}$ by utilizing first partials.

Example 14.6.1

Find the directional derivative of

$$ f(x,y) = y\cos(xy) $$
at the point $(0,1)$ in the direction where the unit vector $\mathbf{u}$ makes an angle of $\theta = \frac{\pi}{4}$ with the positive $x$-axis.

Solution

For an angle of $\frac{\pi}{4}$, the unit vector $\mathbf{u} = \langle\,\cos\frac{\pi}{4},\sin\frac{\pi}{4}\,\rangle = \left\langle\,\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}}\,\right\rangle$. We find that the first partials of $f$ are

$$ \begin{align*} f_x(x,y) &= -y\sin(xy)\cdot(y) = -y^2\sin(xy) \\ \\ f_y(x,y) &= \cos(xy) - y\sin(xy)\cdot(x) = \cos(xy) - xy\sin(xy) \end{align*} $$
We evaluate the first partials at $(1,0)$ to find

$$ \begin{align*} f_x(0,1) &= -1^2\sin(0\cdot 1) = 0 \\ \\ f_y(0,1) &= \cos(0\cdot 1) - (0\cdot 1)\sin(0\cdot 1) = 1 \end{align*} $$
Using our directional derivative formula, we have

$$ \begin{align*} D_\mathbf{u}f(0,1) &= f_x(0,1)\cos\frac{\pi}{4} + f_y(0,1)\sin\frac{\pi}{4} \\ \\ &= 0\cdot\frac{1}{\sqrt{2}} + 1\cdot\frac{1}{\sqrt{2}} \\ \\ &= \frac{1}{\sqrt{2}} \end{align*} $$

14.6.3 The Gradient Vector

In the previous example, we took advantage of the formula for the directional derivative with respect to $\mathbf{u}$. It is possible to rewrite this expression in a form that presents us with a very useful tool:

$$ \begin{align*} D_\mathbf{u}f(x,y) &= f_x(x,y)u_1 + f_y(x,y)u_2 \\ \\ &= \left\langle\,f_x(x,y),f_y(x,y)\,\right\rangle\cdot\langle\,u_1,u_2\,\rangle \\ \\ &= \left\langle\,f_x(x,y),f_y(x,y)\,\right\rangle\cdot\mathbf{u} \end{align*} $$
This is a dot product between a vector composed of the first partials of $f$ and $\mathbf{u}$. We will call this vector of first partials the gradient of $f$. The gradient of $f$ is the first of three special derivative operators we use in vector calculus (the other two being divergence and curl ). These all have special notations associated with them using the $\nabla$ symbol, sometimes called the "del" operator. The gradient of $f$ is defined in the following way.

Definition

For a differentiable function $f(x,y)$, we say that the gradient of $f$ is given by

$$ \mathbf{grad} f(x,y) = \nabla f(x,y) = \left\langle\,f_x(x,y),f_y(x,y)\,\right\rangle = \pzi[f]{x}\ihat + \pzi[f]{y}\jhat $$

Both notations $\mathbf{grad} f$ and $\nabla f$ see common usage (as well as the related notation to the divergence and curl when those come up), so you should get used to working with both.

The gradient vector is especially useful for discussing direction derivatives, since we can condense our expression for that to just

$$ D_\mathbf{u}f(x,y) = \nabla f(x,y)\cdot\mathbf{u} $$
Furthermore, this formula applies for gradients and direction derivatives of functions of higher dimension. If we have a function of three variables, this extends naturally to

$$ D_\mathbf{u}f(x,y,z) = \nabla f(x,y,z)\cdot\mathbf{u} $$
where now

$$ \nabla f(x,y,z) = \left\langle\,f_x,f_y,f_z\,\right\rangle = \pzi[f]{x}\ihat + \pzi[f]{y}\jhat + \pzi[f]{z}\khat $$
with the unit vector $\mathbf{u} = \langle\,u_1,u_2,u_3\,\rangle$.

Example 14.6.2

Find the direction derivative of

$$ f(x,y,z) = x^2 y + y^2 z $$
at point $(1,2,3)$ in the direction $\mathbf{v} = \langle\,2,-1,2\,\rangle$.

Solution

The gradient of $f$ is given by

$$ \nabla f = \left\langle\,2xy,x^2+2yz,y^2\,\right\rangle $$
and so

$$ \nabla f(1,2,3) = \left\langle\,2(1)(2),(1)^2+2(2)(3),(2)^2\,\right\rangle = \langle\,4,13,4\,\rangle $$
We need to use a unit vector $\mathbf{u}$ in the same direction of $\mathbf{v}$ to compute the directional derivative, so after dividing $\mathbf{v}$ by its length we see that

$$ \mathbf{u} = \left\langle\,\frac{2}{3},-\frac{1}{3},\frac{2}{3}\,\right\rangle $$
and the directional derivative is given by

$$ D_\mathbf{u}f(1,2,3) = \langle\,4,13,4\,\rangle\cdot\left\langle\,\frac{2}{3},-\frac{1}{3},\frac{2}{3}\,\right\rangle = \frac{8-13+8}{3} = 1 $$

14.6.4 Maximal Directional Derivatives

Directional derivatives allow us to find the change in a function $f$ along any direction. It is natural to ask if we can determine along which direction the change in the function is the greatest. This involves maximizing the value of the directional derivative. Since we have the formula

$$ D_\mathbf{u} = \nabla f\cdot\mathbf{u} $$
we recall the dot product identity $\mathbf{a}\cdot\mathbf{b} = |\mathbf{a}||\mathbf{b}|\cos\theta$ which we can apply to the directional derivative formula

$$ D_\mathbf{u} = \nabla f\cdot\mathbf{u} = |\nabla f||\mathbf{u}|\cos\theta = |\nabla f|\cos\theta $$
where the last equality follows because $\mathbf{u}$ is a unit vector $(|\mathbf{u}|=1)$. Since $\theta$ is the angle between $\nabla f$ and $\mathbf{u}$ and the maximum value of $\cos\theta$ is one when $\theta=0$, we see that it must be the case that $D_\mathbf{u}$ has a maximum value of $|\nabla f|$ and that this occurs when the unit vector is in the same direction as the gradient .

Theorem

The gradient is the direction of steepest ascent.
Suppose $f$ is a differentiable function of more than one variable. The maximum value of the directional derivative $D_\mathbf{u}f(\mathbf{x})$ is $|\nabla f|$ and this value occurs when $\mathbf{u}$ is in the same direction as the gradient $\nabla f(\mathbf{x})$.

Example 14.6.3

The temperature $T$ in a metal ball is inversely proportional to the distance from the center of the ball, which we take to be the origin. The temperature at the point $(1,2,2)$ is $120^\circ$.

  1. Find the rate of change of $T$ at $(1,2,2)$ in the direction towards the point $(2,1,3)$.
  2. Show that at any point in the ball the direction of greatest increase in temperature is given by a vector that points toward the origin.

Solution

The temperature function is given by

$$ T(x,y,z) = \frac{k}{\sqrt{x^2 + y^2 + z^2}} $$
since inversely proportional means that the function looks like $f(r) = \frac{k}{r}$ where $r$ is the distance from the origin. To find $k$, we apply the fact that $T(1,2,2) = 120^\circ$, so

$$ T(1,2,2) = \frac{k}{1^2 + 2^2 + 2^2} = 120 \qquad\Rightarrow\qquad k = 360 $$

  1. To find the rate of change in $T$ at $(1,2,2)$ in the direction of $(2,1,3)$, we need to find a unit vector between these points. The vector $\mathbf{v} = \langle\,2-1,1-2,3-2\,\rangle = \langle\,1,-1,1\,\rangle$ is the direction of travel and the associated unit vector is


    $$ \mathbf{u} = \left\langle\,\frac{1}{\sqrt{3}},-\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}}\,\right\rangle $$
    To find $\nabla T$, we compute the first partials. Starting with $T_x$:


    $$ T_x = \frac{-720x}{2(x^2 + y^2 + z^2)^\frac{3}{2}} = \frac{-360x}{(x^2 + y^2 + z^2)^\frac{3}{2}} $$
    where $T_y$ and $T_z$ have similar forms. Collecting them all into a single expression,


    $$ \nabla T = \left\langle\,\frac{-360x}{(x^2 + y^2 + z^2)^\frac{3}{2}},\frac{-360y}{(x^2 + y^2 + z^2)^\frac{3}{2}},\frac{-360z}{(x^2 + y^2 + z^2)^\frac{3}{2}}\,\right\rangle = \frac{-360\langle\,x,y,z\,\rangle}{(x^2 + y^2 + z^2)^\frac{3}{2}} $$
    We can now find $\nabla T(1,2,2)$


    $$ \nabla T(1,2,2) = \frac{-360\langle\,1,2,2\,\rangle}{\left(1^2 + 2^2 + 2^2\right)^\frac{3}{2}} = \frac{-40\langle\,1,2,2\,\rangle}{3} $$
    Our directional derivative is thus


    $$ \begin{align*} D_\mathbf{u}T(1,2,2) &= \nabla T(1,2,2)\cdot\mathbf{u} \\ \\ &= -\frac{40}{3}\langle\,1,2,2\,\rangle\cdot\frac{1}{\sqrt{3}}\langle\,1,-1,1\,\rangle \\ \\ &= -\frac{40}{3\sqrt{3}} \end{align*} $$
  2. To determine the direction of greatest increase in temperature, we return to our expression for the gradient


    $$ \nabla T = \frac{-360\langle\,x,y,z\,\rangle}{(x^2 + y^2 + z^2)^\frac{3}{2}} $$
    and note that $-\langle\,x,y,z\,\rangle$ in the numerator is in opposite direction of $\langle\,x,y,z\,\rangle$. Since $\langle\,x,y,z\,\rangle$ is the displacement vector pointing away from the origin, $-\langle\,x,y,z\,\rangle$ points towards the origin and hence the $\nabla T$, the direction of steepest ascent, points towards the origin.

Creative Commons Logo - White


Your use of this self-initiated mediated course material is subject to our Creative Commons License .


Creative Commons Attribution-NonCommercial-ShareAlike 4.0

Creative Commons Logo - Black
Attribution
You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

Creative Commons Logo - Black
Noncommercial
You may not use the material for commercial purposes.

Creative Commons Logo - Black
Share Alike
You are free to share, copy and redistribute the material in any medium or format. If you adapt, remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.