Multivariable Calculus · Lesson 3 of 3 · ~6 min

The gradient

Predict

Every level curve is a path of constant height. At any point of the map, the gradient $\nabla f = (f_x, f_y)$ points which way?

Hold that thought. Drag the probe and compare its ink arrow with the ink level curve drawn through it.
Try
Try itOn the bowl, drag the probe to $(1, 1)$ and read |∇f|. Set start angle to $40$ and press Walk uphill. Then press saddle x²−y², set the angle to $90$, and walk again.
Notice

On the bowl every field arrow fires straight out from the center, crossing each circle at a right angle; at $(1, 1)$ the stats read $f_x = 2.000$, $f_y = 2.000$, $|\nabla f| = 2.828$. Arrows lengthen toward the rim, exactly where the circles crowd. The walker cuts every contour perpendicularly on its way to the edge — and on the saddle from angle $90$ it glides to the center and stalls: $\nabla f = (0, 0)$ there.

Explain

The gradient packs both partials into one vector, $\nabla f = (f_x, f_y)$. It points in the direction of steepest ascent, and its length $|\nabla f| = \sqrt{f_x^2 + f_y^2}$ is that steepest slope — on the bowl at $(1, 1)$, $\sqrt{4 + 4} = 2.83$. Why perpendicular to the level curves: along a level curve the height does not change, so a step's along-curve component gains nothing. The fastest way up keeps no along-curve part — what remains points straight across.

The bowl's $\nabla f = (2x, 2y)$ points radially outward, so the walk uphill is a straight radial line. The saddle's field $\nabla f = (2x, -2y)$ pushes east–west and squeezes north–south; a walker started on the $y$-axis is squeezed into the one point with no uphill direction. An honest note on scope: gradients sit beyond the AP Calculus AB/BC syllabus — this chapter is a preview, built entirely from the single-variable derivative.

About this model

What it represents: gradient ascent — the walker takes many small steps proportional to $\nabla f$, an Euler approximation of the steepest-ascent flow $\dot{p} = \nabla f(p)$, the mirror image of the gradient descent that trains machine-learning models.

What it leaves out: everything that makes real gradient methods hard — choosing a step size, overshooting and zigzagging in narrow valleys, and dimension: practical descent runs on functions of millions of variables, not two. The clean stall at the saddle is also fragile: only walkers starting exactly on the $y$-axis reach it, and any sideways nudge escapes.

Source: S. Boyd and L. Vandenberghe, Convex Optimization, Ch. 9 (Cambridge University Press, free online) — the full treatment of gradient methods, step-size rules included.

Apply
Checkpoint — prove it to yourself

Why does the gradient arrow always cross the level curve through its base at a right angle?

On the bowl, what is $|\nabla f|$ at the point $(0.5,\ 0)$?

Transfer: a hiker on a real contour map wants the fastest way down. Relative to the level curves, which way is that?

Key idea

The gradient is the two partials assembled into one arrow: it points straight across the level curves toward higher ground, its length is the steepest slope, and it vanishes exactly at the flat points — including saddles, neither peaks nor pits.

← All lessons