Multivariable Calculus · Undergraduate

Directional Derivatives and the Gradient

Quick answer

The directional derivative gives the rate of change of f in any direction u. By the chain rule it equals ∇f · u, the dot product of the unit vector u with the gradient ∇f = (f_x, f_y). Because of that dot product, the gradient points in the direction of fastest increase, its length is that fastest rate, and it is perpendicular to the level curve through the point. In three variables the gradient is normal to level surfaces, which gives their tangent planes.

What you'll learn

  • Compute the gradient of a function
  • Find a directional derivative as a dot product
  • Find the direction and rate of fastest increase
  • Use the gradient as a normal to level curves and surfaces

Rates in every direction

The partial derivatives measure how ff changes moving east or north. A hiker can walk any compass direction, though. Given a unit vector u=(u1,u2)\mathbf{u} = (u_1, u_2), the directional derivative Duf(a,b)D_{\mathbf{u}}f(a, b) is the rate of change of ff at (a,b)(a, b) moving in the direction u\mathbf{u}.

Collect the partial derivatives into one vector, the gradient:

∇f=(fx,fy)\nabla f = \left(f_x, f_y\right)

Then every directional derivative is a dot product with it:

Duf=∇f⋅u=fxu1+fyu2D_{\mathbf{u}}f = \nabla f \cdot \mathbf{u} = f_x u_1 + f_y u_2

Why a dot product, and why the gradient points uphill

Walk from (a,b)(a, b) along the line x=a+tu1x = a + tu_1, y=b+tu2y = b + tu_2. The chain rule gives the rate at t=0t = 0:

ddtf(a+tu1, b+tu2)=fxu1+fyu2=∇f⋅u\frac{d}{dt}f(a + tu_1,\ b + tu_2) = f_x u_1 + f_y u_2 = \nabla f \cdot \mathbf{u}

A dot product with a unit vector is ∥∇f∥cos⁡θ\|\nabla f\|\cos\theta, where θ\theta is the angle between u\mathbf{u} and ∇f\nabla f. It is largest when θ=0\theta = 0, zero when θ=90°\theta = 90°, and most negative when θ=180°\theta = 180°. So the gradient points in the direction of fastest increase, its length is that fastest rate, and moving perpendicular to it leaves ff unchanged. Moving perpendicular to the gradient is walking along a level curve, so the gradient is perpendicular to the level curves.

The gradient of f(x, y) = x² + 4y² at (2, 1) Two level curves of f, the ellipses x² + 4y² = 8 and x² + 4y² = 16, with the point (2, 1) marked on the inner one. A short arrow from (2, 1) points along the gradient (4, 8), straight toward the outer ellipse. A dashed segment through (2, 1) runs along the tangent direction (2, −1), perpendicular to the arrow. -4-224-3-2-1123xy (2, 1) ∇f
  • f = 8
  • f = 16
The gradient of f(x, y) = x² + 4y² at (2, 1)

Worked examples

Common mistakes

Practice problems

  1. Find ∇f\nabla f for f(x,y)=x2yf(x, y) = x^2y at (1,2)(1, 2).

    Answer

    (4,1)(4, 1)

    Full solution

    fx=2xy=4f_x = 2xy = 4 and fy=x2=1f_y = x^2 = 1 at (1,2)(1, 2).

  2. For the same function and point, find the directional derivative in the direction of (1,1)(1, 1).

    Answer

    52≈3.54\tfrac{5}{\sqrt{2}} \approx 3.54

    Full solution

    The unit vector is 12(1,1)\tfrac{1}{\sqrt{2}}(1, 1), and (4,1)⋅(1,1)=5(4, 1) \cdot (1, 1) = 5.

  3. What are the directional derivatives of that function at (1,2)(1, 2) in the directions i\mathbf{i} and j\mathbf{j}?

    Answer

    44 and 11

    Full solution

    Along the axes, the directional derivatives are the partial derivatives themselves.

  4. Find the maximum rate of change of f(x,y)=exsin⁡yf(x, y) = e^x\sin y at (0,π2)\left(0, \tfrac{\pi}{2}\right), and its direction.

    Answer

    11, in the direction i\mathbf{i}

    Full solution

    ∇f=(exsin⁡y, excos⁡y)=(1,0)\nabla f = (e^x\sin y,\ e^x\cos y) = (1, 0) at that point.

  5. Find ∇f\nabla f for f(x,y)=x2+y2f(x, y) = \sqrt{x^2 + y^2} at (3,4)(3, 4). What is its length?

    Answer

    (0.6,0.8)(0.6, 0.8); length 11

    Full solution

    fx=xx2+y2f_x = \tfrac{x}{\sqrt{x^2 + y^2}} and fy=yx2+y2f_y = \tfrac{y}{\sqrt{x^2 + y^2}}. The distance from the origin grows at rate 11 moving straight away from the origin.

  6. Find a vector perpendicular to the level curve x2+y2=25x^2 + y^2 = 25 at (3,4)(3, 4).

    Answer

    (6,8)(6, 8), or any multiple

    Full solution

    The gradient of x2+y2x^2 + y^2 is (2x,2y)=(6,8)(2x, 2y) = (6, 8), pointing along the radius.

  7. In which direction does T(x,y)=100−x2−3y2T(x, y) = 100 - x^2 - 3y^2 fall fastest at (2,1)(2, 1)?

    Answer

    The direction of (4,6)(4, 6)

    Full solution

    The fastest decrease is opposite the gradient (−4,−6)(-4, -6), away from the center, at rate 52\sqrt{52}.

  8. Find the tangent plane to the surface z=x2+y2z = x^2 + y^2 at (1,1,2)(1, 1, 2) by treating it as a level surface.

    Answer

    2x+2y−z=22x + 2y - z = 2

    Full solution

    Write F=x2+y2−z=0F = x^2 + y^2 - z = 0. Then ∇F=(2,2,−1)\nabla F = (2, 2, -1) at the point, and 2(x−1)+2(y−1)−(z−2)=02(x - 1) + 2(y - 1) - (z - 2) = 0 simplifies to the answer.

  9. A function has ∇f(a,b)=(3,−4)\nabla f(a, b) = (3, -4). What are the largest and smallest directional derivatives at (a,b)(a, b)?

    Answer

    55 and −5-5

    Full solution

    The largest is ∥∇f∥=5\|\nabla f\| = 5, in the gradient’s direction; the smallest is −5-5, in the opposite direction.

  10. A student finds the rate of change of ff at a point in the direction (3,4)(3, 4) as ∇f⋅(3,4)\nabla f \cdot (3, 4). What went wrong?

    Hint

    What is the length of (3,4)(3, 4)?

    Answer

    The direction must be a unit vector: use (35,45)\left(\tfrac{3}{5}, \tfrac{4}{5}\right).

    Full solution

    (3,4)(3, 4) has length 55, so the student’s answer is five times the true rate. The directional derivative measures change per unit of distance, which requires ∥u∥=1\|\mathbf{u}\| = 1.

Frequently asked questions

What is the gradient?

The vector of partial derivatives, ∇f = (f_x, f_y), or (f_x, f_y, f_z) in three variables.

How do you compute a directional derivative?

Take the dot product of the gradient with a unit vector u in the chosen direction: D_u f = ∇f · u. If the direction is given by a vector that is not a unit vector, divide it by its length first.

Which direction gives the fastest increase?

The direction of the gradient itself, where the rate is |∇f|. The fastest decrease is in the opposite direction, at rate −|∇f|.

Why is the gradient perpendicular to level curves?

Along a level curve f does not change, so the directional derivative along the curve is 0. A zero dot product with the tangent direction means the gradient is perpendicular to it.

How does the gradient give a tangent plane to a surface F(x, y, z) = k?

∇F at the point is a normal vector to the level surface, so the tangent plane is ∇F · (x − x₀, y − y₀, z − z₀) = 0.

What to learn next