01 / 21

Gradient &
Directional Derivatives

Learn how the gradient vector captures the direction and rate of steepest ascent, and how directional derivatives measure rates of change in any direction.

Calculus 3

What Is the Gradient?

For a function \( f(x,y) \) with continuous partial derivatives, the gradient is the vector of all first partials:

The gradient is a vector field: at every point \((x,y)\), it assigns a vector that points in the direction of steepest increase of \(f\).

Gradient on a Contour Map

\(c=1\) \(c=2\) \(c=3\) \(c=4\) peak Contour map of \( f(x, y) \) \( \nabla f \) (gradient)

Why the Gradient Matters

Steepest Ascent
\( \nabla f \) points in the direction where \( f \) increases fastest.
Magnitude = Rate
\( \|\nabla f\| \) gives the maximum rate of change at that point.
Perpendicular to Contours
\( \nabla f \) is orthogonal to the level curve \( f(x,y) = c \) at every point.

The Directional Derivative

The directional derivative measures the rate of change of \( f \) at a point in the direction of a unit vector \( \mathbf{u} \).

Partial derivatives are special cases: \( f_x = D_{\mathbf{i}}\,f \) and \( f_y = D_{\mathbf{j}}\,f \), using the standard basis vectors.

Core Theorem: The Dot Product Formula

x y P \( \nabla f \) \( \mathbf{u} \) \( \theta \) \( D_{\mathbf{u}} f = \|\nabla f\| \cos\theta \)

Geometric Interpretation

Since \( D_{\mathbf{u}} f = \|\nabla f\| \cos\theta \), the directional derivative depends on the angle between \( \nabla f \) and \( \mathbf{u} \):

1
Maximum when \( \theta = 0^\circ \): moving in the direction of \( \nabla f \) gives \( D_{\mathbf{u}} f = \|\nabla f\| \).
2
Zero when \( \theta = 90^\circ \): moving along a level curve gives \( D_{\mathbf{u}} f = 0 \).
3
Minimum when \( \theta = 180^\circ \): moving opposite to \( \nabla f \) gives \( D_{\mathbf{u}} f = -\|\nabla f\| \).

Gradient vs. Directional Derivative

Gradient \( \nabla f \) Dir. Derivative \( D_{\mathbf{u}} f \)
Type Vector Scalar
Inputs A point \((x,y)\) A point and a unit vector \(\mathbf{u}\)
Meaning Direction of steepest ascent Rate of change along \(\mathbf{u}\)
Depends on direction? No: intrinsic to \(f\) Yes: changes with \(\mathbf{u}\)
Relationship \( D_{\mathbf{u}} f = \nabla f \cdot \mathbf{u} \)

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

1
Find the partials: compute \( f_x \) and \( f_y \).
2
Build the gradient: \( \nabla f = \langle f_x,\, f_y \rangle \).
3
Evaluate at the point: plug in \((x_0, y_0)\) to get a specific vector.
4
Make \(\mathbf{u}\) a unit vector: if given \(\mathbf{v}\), compute \( \mathbf{u} = \dfrac{\mathbf{v}}{\|\mathbf{v}\|} \).
5
Dot product: \( D_{\mathbf{u}} f = \nabla f \cdot \mathbf{u} \).

Example 1: Basic Gradient

Find \( \nabla f \) for \( f(x,y) = x^2 y + 3xy^2 \) at \((1, 2)\).

1
\( f_x = 2xy + 3y^2 \). At \((1,2)\): \( f_x = 2(1)(2) + 3(4) = \) 16
2
\( f_y = x^2 + 6xy \). At \((1,2)\): \( f_y = 1 + 6(1)(2) = \) 13
3
\( \nabla f(1,2) = \langle 16, 13 \rangle \)

Example 2: Directional Derivative

Find \( D_{\mathbf{u}} f \) for \( f(x,y) = e^x \sin y \) at \((0, \frac{\pi}{3})\) in the direction of \( \mathbf{v} = \langle 1, -1 \rangle \).

1
\( f_x = e^x \sin y \). At \((0, \frac{\pi}{3})\): \( f_x = \sin(\frac{\pi}{3}) = \) \(\frac{\sqrt{3}}{2}\)
2
\( f_y = e^x \cos y \). At \((0, \frac{\pi}{3})\): \( f_y = \cos(\frac{\pi}{3}) = \) \(\frac{1}{2}\)
3
Unit vector: \( \mathbf{u} = \dfrac{\langle 1,-1 \rangle}{\sqrt{2}} = \left\langle \frac{1}{\sqrt{2}}, \frac{-1}{\sqrt{2}} \right\rangle \)
4
\( D_{\mathbf{u}} f = \frac{\sqrt{3}}{2}\cdot\frac{1}{\sqrt{2}} + \frac{1}{2}\cdot\frac{-1}{\sqrt{2}} = \frac{\sqrt{3}-1}{2\sqrt{2}} \)

Example 3: Three Variables

The gradient extends naturally. For \( f(x,y,z) = x^2 + yz - z^3 \):

At \((1, 2, -1)\):

1
\( f_x = 2(1) = \) 2, \;\; \( f_y = -1 \), \;\; \( f_z = 2 - 3(1) = -1 \)
2
\( \nabla f(1,2,-1) = \langle 2,\; -1,\; -1 \rangle \)
3
Max rate of change: \( \|\nabla f\| = \sqrt{4+1+1} = \sqrt{6} \)

Using an Angle for Direction

If the direction is given as an angle \(\theta\) from the positive \(x\)-axis, the unit vector is:

x y \( \mathbf{u} \) \( \theta \) \( \cos\theta \) \( \sin\theta \)

Gradient and Surfaces

For a surface defined implicitly by \( F(x,y,z) = 0 \), the gradient \( \nabla F \) gives the normal vector to the surface at any point.

Normal Vector
\( \nabla F \) is perpendicular to the tangent plane at each point on the surface.
Tangent Plane
At \((x_0,y_0,z_0)\): \( F_x(x-x_0) + F_y(y-y_0) + F_z(z-z_0) = 0 \)

Common Mistakes

✕ Forgetting to Normalize
The direction vector \(\mathbf{v}\) must be converted to a unit vector \(\mathbf{u}\) before computing the dot product.
✕ Swapping Partials
When forming \( \nabla f = \langle f_x, f_y \rangle \), ensure each component matches the correct variable.
✕ Confusing Vector vs. Scalar
The gradient is a vector. The directional derivative is a scalar. Do not equate them.

Summary of Key Formulas

Concept Formula Output
Gradient (2D) \( \nabla f = \langle f_x, f_y \rangle \) Vector
Gradient (3D) \( \nabla f = \langle f_x, f_y, f_z \rangle \) Vector
Directional derivative \( D_{\mathbf{u}} f = \nabla f \cdot \mathbf{u} \) Scalar
Max rate of change \( \|\nabla f\| \) Scalar
Direction of max change \( \dfrac{\nabla f}{\|\nabla f\|} \) Unit vector

Question 1 of 5

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

Question 2 of 5

The gradient \( \nabla f \) at a point is always perpendicular to which of the following?

Question 3 of 5

Given \( \nabla f(2,1) = \langle 4, 3 \rangle \) and \( \mathbf{u} = \left\langle \frac{3}{5}, \frac{4}{5} \right\rangle \), what is \( D_{\mathbf{u}} f(2,1) \)?

Question 4 of 5

What is the maximum rate of change of \( f(x,y) = x^2 - xy + y^2 \) at the point \((1,1)\)?

Question 5 of 5

If the directional derivative \( D_{\mathbf{u}} f = 0 \) at a point, what can you conclude about \( \mathbf{u} \)?