Skip to content

How to compute a directional derivative

5 min read

Short answer

The directional derivative of ff at a point in the direction of a unit vector u\mathbf u is Duf=∇f⋅uD_{\mathbf u}f=\nabla f\cdot\mathbf u. It is the rate of change of ff as you move through the point in direction u\mathbf u, and it is largest (=∣∇f∣=|\nabla f|) when u\mathbf u points along the gradient.

Contours of x squared plus y squared with the gradient perpendicular to the contour∇f = (2, 2)u: rate 0f = x² + y², point (1, 1)
On the contours of f = x² + y², the gradient points straight uphill, perpendicular to the contour. Moving along the contour gives rate 0.

Why the dot product

The gradient collects the rates of change along the axes. A direction is a mix of axis directions, so the rate in direction u\mathbf u is the same mix of the partial derivatives: u1fx+u2fyu_1f_x+u_2f_y, which is exactly ∇f⋅u\nabla f\cdot\mathbf u. By the dot-product formula, this equals ∣∇f∣cos⁡θ|\nabla f|\cos\theta, so it is biggest when θ=0\theta=0.

Steps

  1. Compute ∇f\nabla f and evaluate it at the point.
  2. Turn the direction into a unit vector by dividing by its length.
  3. Take the dot product.

Special directions: along ∇f\nabla f the rate is ∣∇f∣|\nabla f| (steepest increase); opposite to it, −∣∇f∣-|\nabla f|; perpendicular to it, 0 (you are walking along a level curve).

Worked example

Let f(x,y)=x2yf(x,y)=x^2y. Find the rate of change at (1,2)(1,2) in the direction of (3,4)(3,4), and the maximum possible rate there.

∇f=(2xy, x2)\nabla f=(2xy,\ x^2), so ∇f(1,2)=(4,1)\nabla f(1,2)=(4,1).

The direction (3,4)(3,4) has length 5, so u=(0.6, 0.8)\mathbf u=(0.6,\ 0.8). Duf=4(0.6)+1(0.8)=3.2.D_{\mathbf u}f=4(0.6)+1(0.8)=3.2. The maximum rate is ∣∇f∣=16+1=17≈4.12|\nabla f|=\sqrt{16+1}=\sqrt{17}\approx4.12, in the direction (4,1)(4,1).

Try it yourself

For f(x,y)=x2+y2f(x,y)=x^2+y^2 at (1,1)(1,1), find the directional derivative in the direction (1,−1)(1,-1). Explain the result.

Show the answer

∇f=(2,2)\nabla f=(2,2) and u=12(1,−1)\mathbf u=\tfrac1{\sqrt2}(1,-1), so Duf=12(2−2)=0D_{\mathbf u}f=\tfrac1{\sqrt2}(2-2)=0. The direction (1,−1)(1,-1) is tangent to the circle x2+y2=2x^2+y^2=2, a level curve, so ff does not change.

Keep going with practice

Directional derivatives and the gradient are part of Vidi's Multivariable & Vector Calculus course, with interactive contour plots.