01 / 20

Directional Derivatives
via the Gradient

Learn how the gradient vector unlocks the rate of change of a multivariable function in any direction you choose.

Calculus 3

What Is a Directional Derivative?

For a function \( f(x,y) \), the partial derivatives \( f_x \) and \( f_y \) measure rates of change along the \( x \)- and \( y \)-axes. But what if you want the rate of change along a diagonal path, or in any arbitrary direction?

Think of standing on a hillside: the partial derivatives tell you how steep it is going east or north, but a directional derivative tells you how steep it is in whatever direction you face.

The Gradient Vector \( \nabla f \)

Given \( f(x,y) \), the gradient is the vector of all first partial derivatives:

Direction
\( \nabla f \) points in the direction of steepest ascent of the surface.
Magnitude
\( \|\nabla f\| \) equals the maximum rate of change at that point.

Visualizing Gradient and Direction

P
\(\nabla f\)
\(\mathbf{u}\)
\(\theta\)
Level curves of f
Gradient \(\nabla f\)
Direction \(\mathbf{u}\)
Angle \(\theta\)

The Core Formula

If \( f \) is differentiable at \( (a,b) \) and \( \mathbf{u} = \langle u_1, u_2 \rangle \) is a unit vector, then:

Equivalently, using the angle \( \theta \) between \( \nabla f \) and \( \mathbf{u} \):

Why the Dot Product Works

The formal definition of the directional derivative is a limit:

Using the multivariable chain rule, we parametrize the path as \( \mathbf{r}(t) = (a + tu_1,\; b + tu_2) \) and differentiate:

The chain rule naturally produces the dot product of the gradient with the direction vector.

Partial vs. Directional Derivatives

Partial Derivative Directional Derivative
Direction Along a coordinate axis only Any unit vector \( \mathbf{u} \)
Notation \( f_x \) or \( \frac{\partial f}{\partial x} \) \( D_{\mathbf{u}} f \)
Formula Limit along one variable \( \nabla f \cdot \mathbf{u} \)
Special case \( D_{\mathbf{i}} f = f_x \), \( D_{\mathbf{j}} f = f_y \) Generalises partials

Max, Min, and Zero Rates

Maximum
When \( \mathbf{u} \) is parallel to \( \nabla f \): \( D_{\mathbf{u}} f = \|\nabla f\| \). Steepest ascent.
Minimum
When \( \mathbf{u} \) is anti-parallel to \( \nabla f \): \( D_{\mathbf{u}} f = -\|\nabla f\| \). Steepest descent.
Zero
When \( \mathbf{u} \perp \nabla f \): \( D_{\mathbf{u}} f = 0 \). Moving along a level curve.
\(\theta = 0^\circ\)
\(\nabla f\)
\(\theta = 180^\circ\)
\(\theta = 90^\circ\)

How to Compute \( D_{\mathbf{u}} f \)

1
Find the partial derivatives \( f_x \) and \( f_y \).
2
Evaluate at the point: plug in \( (a, b) \) to get \( \nabla f(a,b) = \langle f_x(a,b),\; f_y(a,b) \rangle \).
3
Find the unit vector \( \mathbf{u} \). If given a direction vector \( \mathbf{v} \), normalize: \( \mathbf{u} = \frac{\mathbf{v}}{\|\mathbf{v}\|} \). If given an angle \( \theta \), use \( \mathbf{u} = \langle \cos\theta,\; \sin\theta \rangle \).
4
Dot product: compute \( D_{\mathbf{u}} f = \nabla f(a,b) \cdot \mathbf{u} \).

Example 1: Basic Computation

Find \( D_{\mathbf{u}} f(1, 2) \) where \( f(x,y) = x^2 y + 3y \) and \( \mathbf{u} \) points in the direction of \( \mathbf{v} = \langle 3, 4 \rangle \).

1
Partials: \( f_x = 2xy \), \( f_y = x^2 + 3 \).
2
Evaluate: \( \nabla f(1,2) = \langle 2(1)(2),\; 1^2 + 3 \rangle = \langle 4, 4 \rangle \).
3
Unit vector: \( \|\mathbf{v}\| = \sqrt{9+16} = 5 \), so \( \mathbf{u} = \langle \tfrac{3}{5}, \tfrac{4}{5} \rangle \).
4
Dot product: \( D_{\mathbf{u}} f = 4 \cdot \tfrac{3}{5} + 4 \cdot \tfrac{4}{5} = \tfrac{12}{5} + \tfrac{16}{5} = \tfrac{28}{5} \).

Example 2: Direction Given by Angle

Find \( D_{\mathbf{u}} f(0, 1) \) where \( f(x,y) = e^x \sin y \) and \( \mathbf{u} \) makes an angle \( \theta = \frac{\pi}{4} \) with the positive \( x \)-axis.

1
Partials: \( f_x = e^x \sin y \), \( f_y = e^x \cos y \).
2
Evaluate: \( \nabla f(0,1) = \langle e^0 \sin 1,\; e^0 \cos 1 \rangle = \langle \sin 1,\; \cos 1 \rangle \approx \langle 0.841,\; 0.540 \rangle \).
3
Unit vector: \( \mathbf{u} = \langle \cos\tfrac{\pi}{4},\; \sin\tfrac{\pi}{4} \rangle = \langle \tfrac{\sqrt{2}}{2},\; \tfrac{\sqrt{2}}{2} \rangle \).
4
Dot product: \( D_{\mathbf{u}} f = \sin 1 \cdot \tfrac{\sqrt{2}}{2} + \cos 1 \cdot \tfrac{\sqrt{2}}{2} = \tfrac{\sqrt{2}}{2}(\sin 1 + \cos 1) \approx 0.976 \).

Example 3: Maximum Rate of Change

For \( f(x,y) = x^2 + xy - y^2 \) at the point \( (2, -1) \), find the maximum rate of change and the direction in which it occurs.

1
Partials: \( f_x = 2x + y \), \( f_y = x - 2y \).
2
Evaluate: \( \nabla f(2,-1) = \langle 2(2)+(-1),\; 2-2(-1) \rangle = \langle 3, 4 \rangle \).
3
Max rate: \( \|\nabla f(2,-1)\| = \sqrt{9+16} = 5 \).
4
Direction: \( \mathbf{u} = \tfrac{1}{5}\langle 3, 4 \rangle \): the direction of the gradient itself.

Extension to Three Variables

Everything generalises naturally. For \( f(x,y,z) \) with unit vector \( \mathbf{u} = \langle u_1, u_2, u_3 \rangle \):

Same idea
Gradient collects all partials; dot with a unit vector gives the rate of change.
Normalize!
In 3D, \( \|\mathbf{u}\| = \sqrt{u_1^2 + u_2^2 + u_3^2} = 1 \) is still required.

Common Mistakes to Avoid

✕ Forgetting to Normalize
Using a direction vector \( \mathbf{v} \) directly instead of the unit vector \( \mathbf{u} = \mathbf{v}/\|\mathbf{v}\| \). The formula requires \( \|\mathbf{u}\| = 1 \).
✕ Swapping Partials
Computing \( f_x \) when you need \( f_y \) or vice versa. Double-check which variable you differentiate with respect to.
✕ Not Evaluating at the Point
Leaving the gradient in terms of \( x \) and \( y \) instead of plugging in the specific coordinates before taking the dot product.

Summary at a Glance

Concept Formula / Result
Gradient \( \nabla f = \langle f_x, f_y \rangle \)
Directional derivative \( D_{\mathbf{u}} f = \nabla f \cdot \mathbf{u} \)
Maximum rate \( \|\nabla f\| \), in direction of \( \nabla f \)
Minimum rate \( -\|\nabla f\| \), opposite to \( \nabla f \)
Zero rate \( \mathbf{u} \perp \nabla f \) (along level curve)
Angle form \( D_{\mathbf{u}} f = \|\nabla f\|\cos\theta \)

Question 1 of 5

If \( f(x,y) = 3x^2 - y^2 \), what is \( \nabla f(1, 2) \)?

Question 2 of 5

Given \( \nabla f(a,b) = \langle 3, 4 \rangle \) and \( \mathbf{u} = \langle \tfrac{1}{\sqrt{2}}, \tfrac{1}{\sqrt{2}} \rangle \), what is \( D_{\mathbf{u}} f(a,b) \)?

Question 3 of 5

The maximum rate of change of \( f \) at a point occurs in which direction?

Question 4 of 5

If \( \nabla f(a,b) = \langle 5, -12 \rangle \), what is the maximum rate of change of \( f \) at \( (a,b) \)?

Question 5 of 5

If \( D_{\mathbf{u}} f = 0 \) for a unit vector \( \mathbf{u} \), what can you conclude about the relationship between \( \mathbf{u} \) and \( \nabla f \)?