On this page
Picture yourself on a foggy hillside with a contour map. Which way is straight up, how steep is it that way, and how steep is it the way you want to walk? The gradient answers all three at once.
What does the gradient of a function tell you?
For a function of two variables, the gradient is the vector of its partial derivatives: ∇f = f_x i + f_y j (OpenStax Calculus Volume 3, section 4.6). Theorem 4.13 in that section, "Properties of the Gradient", says what its direction and length mean:
Direction: ∇f points the way f increases fastest.
Length: ‖∇f‖ is that fastest rate of increase, the steepest slope available at that point.
Opposite direction: −∇f is the way f decreases fastest, at the rate −‖∇f‖.
Zero gradient: if ∇f = 0, the rate of change is zero in every direction.
How do you find a directional derivative?
A directional derivative is the rate of change of f as you move away from a point in the direction of a unit vector u. OpenStax shows that it equals a dot product: D_u f = ∇f · u (section 4.6).
Write that dot product as ‖∇f‖ ‖u‖ cos θ, where θ is the angle between ∇f and u. Since u has length 1, D_u f = ‖∇f‖ cos θ. So the climb is steepest along ∇f (cos θ = 1), the drop is steepest the opposite way (cos θ = −1), and the ground is level at right angles to ∇f (cos θ = 0).
A worked example: one hill, five directions
Take a hill whose height is h(x, y) = 50 − x² − 2y², with its summit at the origin. Stand at P(2, 1), where h = 50 − 4 − 2 = 44. The partial derivatives are h_x = −2x and h_y = −4y, so ∇h(2, 1) = (−4, −4). Now try five directions.
Steepest climb: along ∇h, south-west, at the rate ‖∇h‖ = √(16 + 16) = 4√2 ≈ 5.66.
Due east, u = (1, 0): D_u h = −4. You go downhill at rate 4.
Along the contour, u = (1, −1)/√2: D_u h = (−4 + 4)/√2 = 0. Level ground, as on any contour.
Straight at the summit, u = (−2, −1)/√5: D_u h = (8 + 4)/√5 ≈ 5.37.
Directly downhill, u = (1, 1)/√2: D_u h = −4√2 ≈ −5.66.
Direction 4 is the surprise: heading straight for the summit climbs at 5.37, not 5.66, because the hill is steeper in y than in x. The two directions differ by about 18° (cos θ = 3/√10). So the steepest path curves: following ∇h = (−2x, −4y) from P traces the curve y = x²/4, the pink dashed line in the diagram at the top.
Why is the gradient perpendicular to level curves?
A level curve is where f has one fixed value, like a contour line. Along it f does not change, so the directional derivative is zero. With D_u f = ‖∇f‖ cos θ, a zero rate and a non-zero gradient force cos θ = 0: the gradient meets the curve at a right angle. OpenStax states this as Theorem 4.14, "Gradient Is Normal to the Level Curve", wherever ∇f ≠ 0 (section 4.6). The same section notes that on a topographical map the steepest slope is where contour lines are closest together; our guide on how to read contour lines on a topographic map covers the map side.
The same picture explains constrained optimisation: at the best point on a constraint curve g = c, a level curve of f just touches it, so ∇f = λ∇g. Our post on using Lagrange multipliers, with two worked examples takes it from there.
Where will you meet the gradient in physics?
The electric field is the negative gradient of the electric potential, E = −∇V, and the minus sign means E points in the direction of decreasing potential (OpenStax University Physics Volume 2, section 7.4). Along a radial line this becomes the familiar E = −dV/dr. Think of V as height: the field points straight downhill and, by Theorem 4.14, crosses equipotentials at right angles.
How should you practise gradient questions?
Find every partial derivative, then put in the point to get ∇f as numbers.
Turn the given direction into a unit vector.
Take the dot product ∇f · u for the rate in that direction.
For "fastest" questions, give the direction of ∇f and the value ‖∇f‖.
Sanity check: along a level curve the rate must come out as zero.
If partial derivatives feel shaky, look them up in the Fermi Concept Library, which gives every concept in mathematics its own lesson and its place in the map. Then practise in the Fermi Problem Library, whose step-by-step solver explains the reasoning. Next, from slopes to volumes: how to evaluate a double integral.


