Partial derivatives measure rates of change along the coordinate axes. But a hiker on a mountain may walk in any direction — not just north–south or east–west. The directional derivative answers: how fast does f change if we move in an arbitrary direction u?
1. The question
Let f(x,y) be a function and let u=⟨a,b⟩ be a unit vector (a2+b2=1). Starting at a point (x,y), we move a small distance h in direction u to reach (x+ha,y+hb).
The average rate of change of f over that step is
hf(x+ha,y+hb)−f(x,y).
What happens as h→0?
2. Definition via the limit
The directional derivative of f at (x,y) in the direction of the unit vector u=⟨a,b⟩ is
Duf(x,y)=h→0limhf(x+ha,y+hb)−f(x,y),
provided the limit exists.
Special cases. When u=i=⟨1,0⟩ this is exactly fx; when u=j=⟨0,1⟩ it is fy. The partial derivatives are directional derivatives along the coordinate axes.
Note. The vector u must be a unit vector. If you are given a direction vector v that is not unit-length, normalize it first: u=v/∣v∣.
3. Geometric interpretation
Geometrically, Duf is the slope of the surface z=f(x,y) as seen by someone walking in direction u.
Use the interactive graph below to explore. The left panel shows a unit circle — click or drag to choose a direction u. The right panel shows the saddle surface z=x2−y2 with the tangent plane at the base point (1,0,1) and the red slice curve (the cross-section of the surface cut by a vertical plane through the base point in direction u). The green dashed line is tangent to that slice; its slope equals Duf.
Directional derivative on z = x² − y²
Choose direction u
u = (0.87, 0.50)
D_u f = 1.732
∇f = (2.0, 0.0) — gradient (dashed)
Click or drag on the circle to change direction. Red = slice curve, green dashed = tangent line, orange = tangent plane. Green dot on circle = gradient direction.
Notice how the slope of the tangent line changes as you rotate u: positive when climbing, negative when descending, zero when moving along a level direction.
4. Computing the directional derivative
Theorem. If f is differentiable at (x,y) and u=⟨a,b⟩ is a unit vector, then
Duf(x,y)=afx(x,y)+bfy(x,y).
Define the single-variable function
g(t)=f(x+ta,y+tb).
Then Duf(x,y)=g′(0) by definition. By the chain rule,
g′(t)=fx(x+ta,y+tb)⋅a+fy(x+ta,y+tb)⋅b.
Setting t=0 gives
Duf(x,y)=afx(x,y)+bfy(x,y).□
Example. Let f(x,y)=x2+3xy and u=⟨21,21⟩. At the point (2,1):
fx=2x+3y=7,fy=3x=6.
Therefore
Duf(2,1)=21⋅7+21⋅6=213≈9.19.
5. The gradient vector
The formula Duf=afx+bfy is a dot product. Define the gradient vector
∇f(x,y)=⟨fx(x,y),fy(x,y)⟩.
Then the directional derivative formula becomes simply
Duf=∇f⋅u.
For a function of three variables, ∇f(x,y,z)=⟨fx,fy,fz⟩, and Duf=∇f⋅u with u a unit vector in R3.
6. The gradient direction maximizes the rate of change
By the Cauchy–Schwarz inequality,
Duf=∇f⋅u≤∣∇f∣∣u∣=∣∇f∣,
with equality exactly when u points in the same direction as ∇f.
Direction u
Value of Duf
∣∇f∣∇f
∣∇f∣ — maximum rate of increase
−∣∇f∣∇f
−∣∇f∣ — maximum rate of decrease
Any u⊥∇f
0 — no change
The gradient points in the direction of steepest ascent, and ∣∇f∣ is the steepness.
7. Gradient direction — interactive illustration
The graph below uses z=x2+y2 at the base point (1,1,2), where ∇f=⟨2,2⟩. Drag the direction selector and watch Duf=2cosθ+2sinθ update live. Click "Jump to gradient direction" to confirm that θ=45° achieves the maximum 22≈2.83.
Gradient direction maximizes D_u f on z = x² + y²
Choose direction u
u = (0.87, 0.50)
D_u f = 2.732
∇f = (2.0, 2.0) — gradient (dashed)
Click or drag on the circle to change direction. Red = slice curve, green dashed = tangent line, orange = tangent plane. Green dot on circle = gradient direction.
8. Level sets and the gradient
A level surface of F(x,y,z) is the set of all points satisfying F(x,y,z)=k for some constant k. For a function f(x,y) the level surfaces are the familiar level curvesf(x,y)=c.
The key geometric fact is:
∇F is perpendicular to the level surface F=k.
The graph below shows the paraboloid z=x2+y2 together with a family of level curves. The gradient at any point on a level curve points outward — perpendicular to the curve.
Level curves of z = x² + y²
c = 3.00
The blue surface is z = x² + y². The colored circles are a family of five level curves, and the matching circles below are their projections onto the xy-plane.
Let r(t)=(x(t),y(t),z(t)) be any smooth curve that lies on the level surface F=k. Then
F(r(t))=kfor all t.
Differentiating both sides with respect to t using the chain rule:
∇F(r(t))⋅r′(t)=dtdk=0.
So ∇F is perpendicular to r′(t) — the tangent vector of every curve on the surface. The tangent vectors of all such curves span the tangent plane, so ∇F is a normal vector to the surface. □
Consequence. The tangent plane to F(x,y,z)=k at (x0,y0,z0) is