Module 7 · Lesson 7.2

The Gradient — Finding the Steepest Direction

Bundle the partial derivatives together into a single vector that points directly toward the steepest uphill direction.

Intuition

Knowing the slope along x and the slope along y separately is useful, but neither one alone tells you the single best direction to walk if you want to climb as fast as possible. Combine them into one vector, and that vector does exactly that: it points in the steepest uphill direction, and its length tells you just how steep that climb is.

Core concept

The gradient $\nabla f$ is simply the two partial derivatives packaged together as a vector, $\left(\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}\right)$. On a contour map, this vector always points perpendicular to the contour lines, straight toward higher elevation — which is exactly why hiking trails that hug a single elevation always run perpendicular to the gradient at every point.

∇h points toward the peak
Terrain height functionh(x,y) = 10 − 0.5x² − 0.3y²
Gradient ∇h(−x, −0.6y)
At point (2, 3)∇h = (−2, −1.8)
Magnitude |∇h|√(2² + 1.8²) ≈ 2.69
Answersteepest ascent points toward (2, 1.8), slope ≈ 2.69

Interactive Lab

The dashed ellipses are contour lines of the same terrain, each one a constant-elevation ring. Slide the point along $y = 2$ and watch the gradient arrow — it always points inward, perpendicular to the local contour, straight toward the peak.

point = (2.0, 2.0) ∇h = (−2.0, −1.2) |∇h| = 2.33

Key Idea

$$ \nabla f = \left(\frac{\partial f}{\partial x},\, \frac{\partial f}{\partial y}\right) $$

The gradient is nothing more than the two partial derivatives, bundled into a vector. Its direction is the steepest way uphill at that point; its magnitude is exactly how steep that climb is.

$\nabla f$The gradient vector, combining both partial derivatives
$\partial f/\partial x,\ \partial f/\partial y$The two components bundled together
direction of $\nabla f$Points toward the steepest increase
$|\nabla f|$Magnitude — how steep that steepest climb actually is

Think Further

  1. On a contour map, hiking trails that run exactly perpendicular to the gradient arrows stay at constant elevation. Why does moving perpendicular to the gradient never change your height?
  2. Predict: at a point where the gradient vector has magnitude 0, what does that say about the terrain there? (Connect this back to Lesson 7.1's peak example.)
  3. If you always walked in the exact direction the negative gradient points, rather than the gradient itself, where would you eventually end up on this lesson's terrain?
Show suggested answers
  1. The gradient points in the direction of maximum increase, so any direction perpendicular to it has zero component along that increase — moving along a contour line, by definition, keeps your height exactly unchanged.
  2. A magnitude of 0 means every partial derivative is 0 at that point too, so the terrain is flat in every direction — exactly matching Lesson 7.1's peak, where both partials vanished at the local maximum.
  3. Walking against the gradient always moves you downhill as steeply as possible, so you'd eventually settle at the lowest point in that region — moving away from the peak rather than toward it.