Partial derivatives tell you the rate of change of f when you move parallel to the x-axis or the y-axis. But on a real hillside you can walk in any direction. This lesson measures the rate of change in an arbitrary direction and packages all of that information into a single vector, the gradient, which points uphill and is perpendicular to the level curves.
Directional derivatives
A direction in the plane is described by a unit vectoru=⟨a,b⟩ with a2+b2=1.
Definition
Directional derivative
The directional derivative of f at (x0,y0) in the direction of the unit vector u=⟨a,b⟩ is
With u=i=⟨1,0⟩ this is exactly fx, and with u=j it is fy. To compute it in general, notice that g(h)=f(x0+ha,y0+hb) is f evaluated along a line, so the chain rule gives g′(0)=fxa+fyb. That is:
Duf(x0,y0)=fx(x0,y0)a+fy(x0,y0)b.
The gradient vector
The expression fxa+fyb is a dot product. The vector of partial derivatives is important enough to have its own name.
The gradient
The gradient of f(x,y) is the vector ∇f=⟨fx,fy⟩. For f(x,y,z) it is ∇f=⟨fx,fy,fz⟩. For any unit vector u,
Duf=∇f⋅u.
Worked example: A directional derivative
Let f(x,y)=x2y−3y. Find the directional derivative at (2,1) in the direction of v=⟨3,4⟩.
The gradient is ∇f=⟨2xy,x2−3⟩, so ∇f(2,1)=⟨4,1⟩.
The vector v is not a unit vector: ∣v∣=5. Normalize it: u=⟨53,54⟩. Then
Duf(2,1)=⟨4,1⟩⋅⟨53,54⟩=512+54=516.
Common mistake
Always convert the direction to a unit vector before taking the dot product. Using v=⟨3,4⟩ directly would give 16, five times too large. If a direction is given as an angle θ, the unit vector is ⟨cosθ,sinθ⟩.
Steepest ascent
Write the dot product with the angle θ between ∇f and u:
Duf=∣∇f∣∣u∣cosθ=∣∇f∣cosθ.
Since cosθ ranges from −1 to 1, this single line answers three questions at once.
What the gradient tells you
At a point where ∇f=0:
f increases fastest in the direction of ∇f (θ=0), and the maximum rate is ∣∇f∣.
f decreases fastest in the direction of −∇f (θ=π), at rate −∣∇f∣.
The rate of change is 0 in directions perpendicular to ∇f (θ=π/2).
Worked example: Heat-seeking
The temperature on a metal plate is T(x,y)=100−x2−2y2. A bug sits at (3,1). In which direction should it move to warm up as fast as possible, and how fast does the temperature rise in that direction?
∇T=⟨−2x,−4y⟩, so ∇T(3,1)=⟨−6,−4⟩. The bug should head in the direction of ⟨−6,−4⟩, or equivalently the unit vector ⟨−133,−132⟩. The maximum rate of increase is
∣∇T(3,1)∣=36+16=52=213≈7.21 degrees per unit distance.
The gradient is perpendicular to level curves
Moving along a level curve keeps f constant, so the rate of change in the direction tangent to the level curve is 0. By the last bullet above, that tangent direction is perpendicular to ∇f. So the gradient at a point is perpendicular to the level curve through that point, and it points toward higher values.
Level curves of f = x² + 2y². At (2, 1.5), the gradient ⟨4, 6⟩ (drawn scaled down) is perpendicular to the level curve x² + 2y² = 8.5 through that point.Open in grapher →
This is the same fact a hiker uses: the steepest path up a mountain crosses the contour lines at right angles.
Tangent planes to level surfaces
The same reasoning works in three dimensions. If F(x,y,z)=k is a level surface and P=(x0,y0,z0) lies on it, then ∇F(P) is perpendicular to every curve on the surface through P. So ∇F(P) is a normal vector to the surface, and the tangent plane is
Fx(P)(x−x0)+Fy(P)(y−y0)+Fz(P)(z−z0)=0.
This handles surfaces, like spheres and ellipsoids, that are not graphs of a single function z=f(x,y).
Worked example: Tangent plane to an ellipsoid
Find the tangent plane to x2+2y2+3z2=6 at (1,1,1).
With F=x2+2y2+3z2, ∇F=⟨2x,4y,6z⟩ and ∇F(1,1,1)=⟨2,4,6⟩. The tangent plane is
2(x−1)+4(y−1)+6(z−1)=0⟺x+2y+3z=6.
Tip
The tangent plane formula from the previous lessons is a special case. The graph z=f(x,y) is the level surface F(x,y,z)=f(x,y)−z=0, whose gradient is ⟨fx,fy,−1⟩. Plugging that into the formula above gives z−z0=fx(x−x0)+fy(y−y0).
Practice
Practice 1
Find ∇f(1,−1) for f(x,y)=x3y+2y2.
Enter a point like (2, -3)
Practice 2
Find ∇f(0,2π) for f(x,y)=exsiny.
Enter a point like (2, -3)
Practice 3
Find the directional derivative of f(x,y)=x2+xy at (1,2) in the direction of v=⟨4,−3⟩.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Practice 4
Find the directional derivative of f(x,y)=xy2 at (2,1) in the direction making an angle θ=3π with the positive x-axis.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Practice 5
Find the maximum rate of change of f(x,y)=x2+4y2 at the point (3,1).
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Practice 6
Find the unit vector in the direction in which f(x,y)=x2y decreases most rapidly at (1,2).
Enter a point like (2, -3)
Practice 7
The tangent plane to the sphere x2+y2+z2=14 at (1,2,3) can be written as x+2y+3z=d. Find d.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Practice 8
At a point P, ∇f(P)=⟨3,4⟩. In which unit direction is the directional derivative of f at P equal to 0?