Chapter 4: Differentiation of Functions of Several Variables
4.6 Directional Derivatives and the Gradient
Study guide for Calculus Volume 3 (Gilbert Strang, 2016 edition)
Independent study guide. Not affiliated with OpenStax or Rice University.
Big idea
Partial derivatives answered two questions: how fast does the output change if you step east, and how fast if you step north. Standing on a hillside, those are not the questions you care about. You want to know how steep the ground is in the direction you are actually facing, and which way is steepest.
Both answers come out of a single object. Collect the two partials into a vector, the gradient $\nabla f = \langle f_x, f_y \rangle$, and the rate of change in any direction is the dot product of that vector with a unit vector pointing that way. The reason is the tangent plane. Near the point the surface is flat, so moving a small distance in a direction with components $u_1$ and $u_2$ raises the output by $f_x u_1 + f_y u_2$, which is exactly the dot product. Everything else in the section follows from that one formula plus the geometric meaning of a dot product.
Write the dot product as $|\nabla f|\,|\mathbf{u}|\cos\theta$ with $|\mathbf{u}| = 1$ and the whole picture opens up. The rate in direction $\mathbf{u}$ is $|\nabla f|\cos\theta$, where $\theta$ is the angle between $\mathbf{u}$ and the gradient. Cosine is largest at $\theta = 0$, so the steepest climb is straight along the gradient and its steepness is the gradient’s length. Cosine is most negative at $\theta = \pi$, so the steepest descent is straight opposite. And cosine vanishes at right angles, so moving perpendicular to the gradient changes nothing to first order, which is to say you are walking along a level curve.
That last consequence is worth stating on its own, because it gets used constantly later: the gradient at a point is perpendicular to the level curve through that point. In three variables the same computation makes the gradient perpendicular to the level surface, which is how tangent planes to implicitly defined surfaces get written down.
Decoder
For a differentiable function, the rate of change in the direction of a unit vector is the dot product of the gradient with that vector, so the largest possible rate at a point is the length of the gradient and it occurs in the gradient’s own direction.
Two conditions carry the content. The vector must be a unit vector, because a longer vector would report a larger number without the ground being any steeper; if you are given a direction as $\langle 3, 4\rangle$ you must divide by $5$ first, and skipping that step is the most common error in the section. And the function must be differentiable, since the derivation runs through the tangent plane.
The gradient is a vector in the input plane, not on the surface. Drawing it as an arrow climbing the hill is a picture-level mistake that leads to confusion later. It lives in the same plane as the level curves, points across them toward higher values, and its length says how tightly packed those level curves are.
The maximum-rate statement is quantitative, not just qualitative. If $|\nabla f| = 10$ at a point, then no direction gives a rate above $10$ or below $-10$, and every value in between is achieved by some direction. Partial derivatives are just two samples from that range, the ones taken along the axes.
Definitions and results
Directional derivative. For a unit vector $\mathbf{u} = \langle u_1, u_2 \rangle$, the directional derivative of $f$ at $(a,b)$ in the direction $\mathbf{u}$ is
$$ D_{\mathbf{u}} f(a,b) = \lim_{h \to 0} \frac{f(a + h u_1,\, b + h u_2) - f(a,b)}{h} $$
Taking $\mathbf{u} = \langle 1,0\rangle$ recovers $f_x$ and $\mathbf{u} = \langle 0,1\rangle$ recovers $f_y$.
Gradient. $\nabla f(x,y) = \langle f_x(x,y),\, f_y(x,y)\rangle$, and in three variables $\nabla f = \langle f_x, f_y, f_z\rangle$. It is a vector-valued function of position: a different vector at every point.
Dot product formula. If $f$ is differentiable at $(a,b)$ and $\mathbf{u}$ is a unit vector, then
$$ D_{\mathbf{u}} f(a,b) = \nabla f(a,b) \cdot \mathbf{u} $$
Normalizing a direction. Given any nonzero vector $\mathbf{v}$, the unit vector in its direction is $\mathbf{u} = \mathbf{v}/|\mathbf{v}|$. A direction described by an angle $\theta$ from the positive $x$-axis is $\mathbf{u} = \langle \cos\theta, \sin\theta\rangle$, already of length $1$.
Steepest ascent. Since $D_{\mathbf{u}} f = |\nabla f|\cos\theta$ where $\theta$ is the angle between $\mathbf{u}$ and $\nabla f$, the directional derivative is largest when $\theta = 0$. The maximum value is $|\nabla f|$, attained in the direction $\nabla f / |\nabla f|$. The minimum is $-|\nabla f|$, attained in the opposite direction.
Level sets. Moving perpendicular to $\nabla f$ gives $\cos\theta = 0$ and rate zero. Consequently $\nabla f(a,b)$ is perpendicular to the level curve of $f$ through $(a,b)$, and in three variables $\nabla f$ is perpendicular (“normal”) to the level surface through the point.
Tangent plane to a level surface. If $S$ is the surface $F(x,y,z) = c$ and $P_0 = (x_0,y_0,z_0)$ lies on it with $\nabla F(P_0) \ne \mathbf{0}$, the tangent plane at $P_0$ is
$$ F_x(P_0)(x - x_0) + F_y(P_0)(y-y_0) + F_z(P_0)(z - z_0) = 0 $$
Zero gradient. If $\nabla f(a,b) = \mathbf{0}$, every directional derivative there is zero, which is the flatness condition behind the critical points of the next section.
Worked examples
A directional derivative from a given vector
For $f(x,y) = x^2 + xy$, find the rate of change at $(1,2)$ in the direction of $\mathbf{v} = \langle 3,4\rangle$.
The partials are $f_x = 2x + y$ and $f_y = x$, so $\nabla f(1,2) = \langle 4, 1\rangle$. The given vector has length $\sqrt{9 + 16} = 5$, so the unit vector is $\mathbf{u} = \langle 3/5, 4/5\rangle$. Then
$$ D_{\mathbf{u}} f(1,2) = \langle 4,1\rangle \cdot \left\langle \tfrac{3}{5}, \tfrac{4}{5}\right\rangle = \frac{12}{5} + \frac{4}{5} = \frac{16}{5} $$
Sanity check the size: $|\nabla f(1,2)| = \sqrt{17} \approx 4.12$, and $16/5 = 3.2$ is smaller, as every directional derivative must be. Had you forgotten to normalize, you would have reported $16$, which is impossible.
Steepest ascent on a temperature plate
The temperature at a point of a metal plate is $T(x,y) = 100 - x^2 - 2y^2$ degrees. Find the direction of fastest heating at $(2,1)$ and the rate in that direction.
The gradient is $\nabla T = \langle -2x, -4y\rangle$, so at $(2,1)$ it is $\langle -4, -4\rangle$. Fastest increase is in that direction, which normalized is
$$ \mathbf{u} = \frac{\langle -4,-4\rangle}{4\sqrt{2}} = \left\langle -\frac{1}{\sqrt2}, -\frac{1}{\sqrt2}\right\rangle $$
pointing back toward the origin along the diagonal, and the maximum rate is $|\nabla T| = 4\sqrt{2} \approx 5.66$ degrees per unit length. Fastest cooling is the opposite direction with rate $-4\sqrt2$.
This agrees with common sense: the plate is hottest at the origin, where $T = 100$, so from $(2,1)$ the way to warm up is to head back in. Along the direction $\langle 1,-1\rangle/\sqrt2$, perpendicular to the gradient, the rate is zero and you are walking around an isotherm.
The gradient against a level curve
Let $f(x,y) = x^2 + 4y^2$ and take the point $(2,1)$, which lies on the level curve $f = 8$. Find a line tangent to that level curve at the point.
The gradient is $\nabla f = \langle 2x, 8y\rangle$, so $\nabla f(2,1) = \langle 4, 8\rangle$. Since the gradient is normal to the level curve, the tangent line is the line through $(2,1)$ perpendicular to $\langle 4,8\rangle$:
$$ 4(x - 2) + 8(y-1) = 0 \quad \Longrightarrow \quad x + 2y = 4 $$
Check by implicit differentiation instead. From $x^2 + 4y^2 = 8$, differentiating gives $2x + 8y\,y' = 0$, so $y' = -x/(4y)$, which at $(2,1)$ is $-1/2$. The line through $(2,1)$ with slope $-1/2$ is $y - 1 = -\tfrac12(x-2)$, that is $x + 2y = 4$. The two methods agree.
A normal direction in three variables
The ellipsoid $x^2 + 2y^2 + 3z^2 = 6$ passes through $(1,1,1)$, since $1 + 2 + 3 = 6$. Find a vector normal to it there and the tangent plane.
With $F(x,y,z) = x^2 + 2y^2 + 3z^2$, the gradient is $\nabla F = \langle 2x, 4y, 6z\rangle$, which at $(1,1,1)$ is $\langle 2,4,6\rangle$. That vector is normal to the level surface, so the tangent plane is
$$ 2(x-1) + 4(y-1) + 6(z-1) = 0 \quad \Longrightarrow \quad x + 2y + 3z = 6 $$
after dividing by $2$. Check that the point satisfies it: $1 + 2 + 3 = 6$. Note the pleasant coincidence of coefficients here: for a quadratic surface centered at the origin the tangent plane at a point always ends up looking like the original equation with one copy of each variable replaced by its value at the point.
Practice
Start with the gradient itself: compute it, evaluate it at a point, and read off the direction of steepest ascent and the maximum rate.
Practice
Generated problems for this section, graded instantly.
Then the directional derivative. Normalize the given direction first, then dot it with the gradient, and check that the answer never exceeds the gradient’s length.
Practice
Generated problems for this section, graded instantly.
Quiz
Five items on gradients, directional derivatives, steepest ascent, and normals to level curves and surfaces.
Quiz
5 problems with a score at the end.