Directional Derivatives and Gradients

Directional Derivative

In the previous section, we found that if a surface is described by z=f(x,y)z=f(x,y), the partial derivatives z/x∂z/∂x and z/y\partial z/\partial y describe the rate of change of zz when we travel parallel to the xx axis and parallel to the yy axis, respectively. The question now is, what if we travel in a different direction, say along an arbitrary vector vv⃗? The answer is that we need to use the directional derivative. This is nothing more than a weighted average of the partial derivatives, where the weights are the components of the direction vector (for which we'll need to use a unit vector; this is important).

Definition

If f(x,y)f(x,y) is a differentiable function, then the directional derivative of ff in the direction of a unit vector v^=v1,v2\hat{v}=⟨v_1,v_2⟩ is given by Dv f(x,y)=fx(x,y)v1+fy(x,y)v2.\ans{D_v\ f(x,y) = f_x(x,y) v_1 + f_y (x,y) v_2.}

At a point (a,b,f(a,b))(a,b,f(a,b)): Dv f(a,b)=fx(a,b)v1+fy(a,b)v2D_v\ f(a,b) = f_x(a,b) v_1 + f_y (a,b) v_2

Find the directional derivative of f(x,y)=x24+y29f(x,y)=\dfrac{x^2}{4}+\dfrac{y^2}{9} at (2,3,2)(2,3,2) in the direction of v=3,4\vec{v}=\langle 3,4 \rangle.

Solution

First, find the unit vector in the direction of vv⃗: v^=3,45=35,45\hat{v} = \dfrac{\langle 3,4 \rangle}{5} = \left\langle \dfrac{3}{5},\dfrac{4}{5} \right\rangle

Next, find the partial derivatives: fx=x2fx(2,3)=1fy=2y9fy(2,3)=23\begin{aligned} f_x &= \dfrac{x}{2} \longrightarrow f_x (2,3) = 1\ f_y &= \dfrac{2y}{9} \longrightarrow f_y (2,3) = \dfrac{2}{3} \end{aligned}

Finally, plug these into the directional derivative formula: Dv=1(35)+23(45)=1715D_v = 1\left(\dfrac{3}{5}\right) + \dfrac{2}{3}\left(\dfrac{4}{5}\right) = \ans{\dfrac{17}{15}}

The interpretation of this is that for every unit you travel in the direction of this vector, zz increases by 17/1517/15.

  1. Find the directional derivative of f(x,y)=14(x2+2y2)+2f(x,y) = \dfrac{1}{4}(x^2+2y^2)+2 at (3,2)(3,2) in the direction of u=1,1u⃗ =⟨1,1⟩ and v=1,3v⃗ =⟨1,−\sqrt{3}⟩.

  2. Du=7222.47Dv=3430.98\begin{aligned} D_u &= \dfrac{7}{2\sqrt{2}} \approx 2.47\ D_v &= \dfrac{3}{4}-\sqrt{3} \approx -0.98 \end{aligned}

  3. Find the directional derivative of f(x,y)=3x2+y3f(x,y) = 3x^2+y^3 at (3,2)(3,2) in the direction of u=5,12\vec{u}=\langle 5,12 \rangle.

  4. Du=18D_u = 18

Gradient

The gradient of f(x,y)f(x,y), denoted by the "del" operator , is a vector that points in the direction of steepest ascent on the surface z=f(x,y)z=f(x,y). The magnitude of this vector is the slope in that direction (i.e. the largest slope at that point).

Definition

The gradient of f(x,y)f(x,y) is f(x,y)=fx(x,y),fy(x,y)=fx(x,y)ı^+fy(x,y)ȷ^\begin{aligned} \nabla f(x,y) &= \langle f_x (x,y) , f_y (x,y) \rangle\ &= f_x (x,y) \hat{\imath} + f_y (x,y) \hat{\jmath} \end{aligned}

At a point (a,b,f(a,b))(a,b,f(a,b)): f(a,b)=fx(a,b)ı^+fy(a,b)ȷ^\nabla f(a,b) = f_x (a,b) \hat{\imath} + f_y (a,b) \hat{\jmath}

Note

Dv f(x,y)=f(x,y)v^D_v\ f(x,y) = \nabla f(x,y) \cdot \hat{v}

Find the gradient of f(x,y)=x24+y29f(x,y)=\dfrac{x^2}{4}+\dfrac{y^2}{9} at (2,3,2)(2,3,2).

Solution

f(x,y)=x2ı^+2y9ȷ^f(a,b)=ı^+23ȷ^\ans{\begin{aligned} \nabla f(x,y) &= \dfrac{x}{2} \hat{\imath} + \dfrac{2y}{9} \hat{\jmath}\ \nabla f(a,b) &= \hat{\imath} + \dfrac{2}{3} \hat{\jmath} \end{aligned}}

A hill has a shape given by f(x,y)=10000.01x20.02y2f(x,y)=1000-0.01x^2-0.02y^2.

Hill surface graph

  1. In which direction should you travel from (60,100,764)(60,100,764) to reach the top the fastest?
  2. What is the slope in that direction?

Solution

  1. Find the gradient: f(x,y)=0.02xı^0.04yȷ^f(60,100)=1.2ı^4ȷ^\begin{aligned} \nabla f(x,y) &= -0.02x \hat{\imath} -0.04y \hat{\jmath}\ \nabla f(60,100) &= -1.2 \hat{\imath} - 4 \hat{\jmath} \end{aligned} Thus, to reach the top the fastest, you should travel in the direction of 1.2,4\ans{\langle -1.2,-4 \rangle}.

  2. The slope in that direction is the magnitude of the gradient: f(60,100)=1.22+42=4.18\begin{aligned} |\nabla f(60,100)| = \sqrt{1.2^2+4^2} = \ans{4.18} \end{aligned} Note that if you traveled in the opposite direction (1.2,4⟨1.2,4⟩), the slope would be 4.18−4.18.

Note

f(x,y)∇f(x,y) points to the steepest ascent, f(x,y)−∇f(x,y) points to the steepest descent, and the directional derivative is zero in any direction orthogonal to f(x,y)∇f(x,y).

For instance, using the hill from the previous example, if you travel in the direction of 4,1.2⟨−4,−1.2⟩ from (60,100,764)(60,100,764), you'll keep the same elevation.

Consider the function f(x,y)=3x22y2f(x,y)=3x^2-2y^2.

  1. Compute f(x,y)∇f(x,y) and f(2,3)∇f(2,3).
  2. Consider the unit vector u^=cosθ,sinθ\hat{u}=⟨\cos θ,\sin θ⟩. At (2,3)(2,3), for what values of θθ between 00 and 2π does the directional derivative have its maximum and minimum values?

Solution

  1. Find the gradient: f(x,y)=6xı^4yȷ^f(2,3)=12ı^12ȷ^\ans{\begin{aligned} \nabla f(x,y) &= 6x \hat{\imath} - 4y \hat{\jmath}\ \nabla f(2,3) &= 12 \hat{\imath} - 12 \hat{\jmath} \end{aligned}}

  2. Find the directional derivative in the direction of u^\hat{u}: Du f(x,y)=f(x,y)u^Du f(2,3)=12cosθ12sinθD_u\ f(x,y) = \nabla f(x,y) \cdot \hat{u} \longrightarrow D_u\ f(2,3) = 12\cos \theta - 12\sin \theta To find the maximum and minimum values for this, take its derivative with respect to θθ and set the derivative to 00 to find critical points: Du f(2,3)=12sinθ12cosθ=0sinθ=cosθθ=3π4,7π4D'_u\ f(2,3) = -12\sin\theta - 12\cos\theta = 0 \longrightarrow \sin\theta = -\cos\theta \longrightarrow \ans{\theta = \dfrac{3\pi}{4}, \dfrac{7\pi}{4}} Note that the slope is zero if θ=π4,5π4\theta = \dfrac{\pi}{4}, \dfrac{5\pi}{4}.

The gradient of a function of three variables is similar, with a third component: fz(x,y,z)k^f_z(x,y,z)\hat{k}.

Consider the function f(x,y,z)=x2+2y2+4z21f(x,y,z)=x^2+2y^2+4z^2-1.

  1. Find the gradient of ff at (2,0,0)(2,0,0).
  2. Find the directional derivative of ff at (2,0,0)(2,0,0) in the direction of u^=13,13,13\hat{u} = \left\langle \dfrac{1}{\sqrt{3}},\dfrac{1}{\sqrt{3}},\dfrac{1}{\sqrt{3}} \right\rangle.

Solution

  1. Find the gradient: f(x,y,z)=fx(x,y,z)ı^+fy(x,y,z)ȷ^+fz(x,y,z)k^=2xı^+4yȷ^+8zk^f(2,0,0)=4ı^=4,0,0\begin{aligned} \nabla f(x,y,z) &= f_x (x,y,z) \hat{\imath} + f_y (x,y,z) \hat{\jmath} + f_z (x,y,z) \hat{k}\ &= 2x \hat{\imath} + 4y \hat{\jmath} + 8z \hat{k}\ \nabla f(2,0,0) &= 4 \hat{\imath} = \ans{\langle 4,0,0 \rangle} \end{aligned}

  2. Find the directional derivative in the direction of u^\hat{u}: Du f(2,0,0)=f(2,0,0)13,13,13=433D_u\ f(2,0,0) = \nabla f(2,0,0) \cdot \left\langle \dfrac{1}{\sqrt{3}},\dfrac{1}{\sqrt{3}},\dfrac{1}{\sqrt{3}} \right\rangle = \ans{\dfrac{4\sqrt{3}}{3}}

  1. Find the gradient of f(x,y)=4x22xy+y2f(x,y)=4x^2-2xy+y^2.

  2. f(x,y)=8x2y,2x+2y\nabla f(x,y) = \langle 8x-2y , -2x+2y \rangle

  3. Find the gradient of f(x,y)=124x2y2f(x,y)=\sqrt{12-4x^2-y^2}.

  4. f(x,y)=12124x2y28x,2y\nabla f(x,y) = \dfrac{1}{2\sqrt{12-4x^2-y^2}} \left\langle -8x , -2y \right\rangle

  5. Find the gradient of f(x,y)=xe2xyf(x,y)=xe^{2xy}.

  6. f(x,y)=e2xy+2xye2xy,2x2e2xy\nabla f(x,y) = \left\langle e^{2xy}+2xye^{2xy} , 2x^2e^{2xy} \right\rangle

  7. Find the unit vector that gives the direction of steepest ascent for the surface z=x2+4xyy2z=x^2+4xy-y^2 at (2,1)(2,1).

  8. u=f(2,1)=8,6u^=45,35\vec{u} = \nabla f(2,1) = \langle 8,6 \rangle \longrightarrow \hat{u} = \left\langle \dfrac{4}{5},\dfrac{3}{5} \right\rangle