Stand on a hillside and turn around. The slope under your feet depends on which way you face, and one vector, the gradient, holds the slope in every direction at once. Scroll down: at each stop a short note explains the next idea, then the map is yours to explore before the next one arrives.
Everything on this page follows from the assumptions and definitions below. They are granted, not proved, so judge each one for yourself. A step that leans on one is tagged with its number.
This is a map of a sloping field, seen from above. North is up. The lines are contour lines, each joining points of equal height, and the shading gets darker as the ground gets higher.
You are standing at the blue dot, P. The arrow is the direction you face. It is exactly one meter long on the map.
The number at the top right is the slope of the ground in that direction: how many meters you would rise for each meter you walk forward. The arrow is green when you face uphill and orange when you face downhill.
Rests on
Try itDrag the tip of the arrow all the way around, or press Turn. Find the direction of the steepest climb. Then find a direction where the ground is level. How many of those are there?
The height of this field is f(x, y) = 2 + 0.3x + 0.4y, with x measured east and y north.
Two directions are easy. Walk due east and only x changes, so the slope is the partial derivative fx = 0.3. Walk due north and only y changes, so the slope is fy = 0.4.
A partial derivative is a slope in one of the two directions the axes point. The question for this tutorial is every other direction.
Rests on
Try itFace east (0°) and read the slope. Face north (90°). Then predict the slope facing west before you turn that way.
Face at an angle θ from east. One meter forward takes you cos θ meters east and sin θ meters north. The east part of the step gains fx cos θ and the north part gains fy sin θ:
slope = fx cos θ + fy sin θ
That sum is a dot product. Put the two partial derivatives in a vector, the gradient ∇f = ⟨fx, fy⟩, and call the unit vector you face u = ⟨cos θ, sin θ⟩. The slope in the direction of u is the directional derivative:
Duf = ∇f · u
Rests on
Try itYou are facing northeast, 45°. Follow the four lines on the right. Then pick another direction, work out the dot product yourself, and check it.
The gradient is now drawn on the map as a dark arrow from P. A dot product can also be written with a length and an angle. Since u has length 1,
Duf = |∇f| cos φ
where φ is the angle between the way you face and the gradient. The thick colored bar along your arrow is that number: the part of the gradient that lies along your direction.
A cosine is largest, 1, when the angle is zero. So the slope is greatest when you face straight along the gradient, and that greatest slope is the gradient's length. Here it is |⟨0.3, 0.4⟩| = 0.5.
A graph has appeared on the right: the slope for every direction through one full turn.
Try itTurn your arrow until it lies along the gradient. It snaps into place when you get close. Read the slope. Then face the opposite way.
A quarter turn from the gradient, the cosine is zero and so is the slope. You are facing along the dark line, which is the contour line through P. That makes sense: a contour joins points of equal height, so walking along it you neither climb nor drop.
Put the two facts together and you get one of the most useful pictures in the subject: the gradient is perpendicular to the contour line, and it points toward higher ground.
You can now drag P as well.
Rests on
Try itDrag P around the field. Does the gradient arrow change? Look at the contour lines and say why not.
A menu has appeared, and the landscape is now a hill, 6 m high at the center of the map:
f(x, y) = 6 − x²/8 − y²/4, ∇f = ⟨−x/4, −y/2⟩
The partial derivatives now depend on where you stand, so the gradient is a different vector at each point. Everything else works as before: it crosses the contour through P at a right angle and it points uphill.
The contour lines are 0.5 m apart in height. Where they crowd together the ground is steep.
Rests on
Try itDrag P around the hill. Where is the gradient longest? Where is it shortest? What happens to it at the very top?
Suppose you always turn to face along the gradient and take a small step, over and over. The green curve is the path you trace: the path of steepest ascent from P. It crosses every contour line at a right angle.
On this hill the path is curved. The gradient does not point at the summit. It points straight up the slope where you stand, and the hill is steeper to the north and south than to the east and west.
A button above the map shows and hides the path.
Try itDrag P and watch the path. Find the starting points from which the steepest way up is a straight line to the top.
The new landscape is f(x, y) = 4 + (x² − y²)/4. The ground rises to the east and west and falls away to the north and south, like a mountain pass.
P is at the center, where ∇f = ⟨x/2, −y/2⟩ = ⟨0, 0⟩. With a zero gradient the slope is zero in every direction. A point like that is a critical point.
The top of the hill was a critical point too. This one is not a top and not a bottom. Flat in every direction does not mean highest.
Try itTurn all the way around at the center: the slope stays at zero. Now move P one step east and show the path. Move it one step north instead. Where does each path go?
The last landscape has two rounded peaks, one about 5 m high to the west and one about 4 m high to the east, with a pass between them.
The gradient is zero at three places on this map: the two tops, and the pass, which is a saddle.
The path of steepest ascent is showing. It climbs to a top, but which top depends on where you start. Following the gradient finds a high point. It does not promise the highest one.
Try itDrag P and watch which peak the path climbs. Find the line that divides the starts that reach the higher peak from those that reach the lower one. Then find the pass.
The directional derivative is rise over run. To turn it into the tilt of the ground, take the inverse tangent:
tilt = arctan(Duf)
A slope of 1 is a 45° incline. A slope of 0.5 is about 26.6°, not half of 45°. The panel on the right now reports the tilt in the direction you face.
You are back on the hill, 2 m north of the top and facing south, straight at it. The slope is 1.
Try itFind a spot and a direction on this map where the climb is steeper than 60°. Then find how far from the top you can stand, to the east, and still have a climb gentler than 10°.
The map is smoother than any ground you have walked on. It gives each point one height, so it has no cliffs or overhangs, and it has a slope in every direction at every point, so it has no rocks, steps or ruts. The formulas above need both.
Everything is unlocked now. Play as long as you like, then scroll on to finish.
Rests on
Try itOn the plane the gradient was the same everywhere. Can you find two different points on the hill with exactly the same gradient? What about on the saddle?
| Claim | Status | Rests on | Detail |
|---|---|---|---|
| Dᵤf = (∂f/∂x) cos θ + (∂f/∂y) sin θ = ∇f · u for all four landscapes (stop 3). | ✓ Proved | A2, A3, D1, D2 | For each of the four landscapes, the derivative of the height along the line through P in direction u = (cos t, sin t) equals f_x cos t + f_y sin t = grad f . u. |
| The plane: ∇f = ⟨0.3, 0.4⟩ with length 0.5. Slopes facing east, north, west and northeast are 0.3, 0.4, −0.3 and about 0.49 (stops 2 to 4). | ✓ Proved | A3, D1, D2 | Plane: grad f = (0.3, 0.4), length 0.5. Facing east 0.3, north 0.4, west -0.3, northeast 0.495. Steepest facing 53.1 degrees (slope 0.5); level a quarter turn either side. |
| The slope is greatest, |∇f|, facing along the gradient, and zero a quarter turn from it, which is the direction of the contour line. So the gradient is perpendicular to the contour (stops 4 and 5). | ✓ Proved | D1, D2, D3 | For any gradient (a, b): a cos t + b sin t = |(a, b)| cos(t - t0), so the slope is greatest, |grad f|, facing along the gradient, and zero a quarter turn from it, along (-f_y, f_x), the direction of the contour line. |
| The hill: ∇f = ⟨−x/4, −y/2⟩, zero only at the 6 m top, and pointing straight at the top only from the two axes. At (0, 2) facing south the slope is 1 (stops 6, 7 and 10). | ✓ Proved | A3, D2 | Hill: grad f = (-x/4, -y/2), zero only at the top (6 m), and the height is 0 at the corners of the map. The gradient points straight at the top only on the two axes. At (0, 2) facing south the slope is 1. The steepest spot on the map tilts 65.9 degrees; due east of the top the climb stays under 10 degrees out to 0.71 m. |
| The saddle: ∇f is zero only at the center, where the ground rises east and west and falls north and south (stop 8). | ✓ Proved | A3, D2 | Saddle: grad f = (x/2, -y/2) is zero only at the center, where the ground rises to the east and west (x^2/4) and falls to the north and south (-y^2/4). |
| Two peaks: the gradient is zero at three places, two tops near 5 m and 4 m and a saddle between them (stop 9). | ≈ Checked numerically | A3, D2 | Two peaks: the gradient is zero at (-1.48, -0.49), height 5.03 m, a top; (1.47, 0.49), height 4.04 m, a top; (0.11, 0.04), height 2.55 m, a saddle. |
| A slope of 1 is 45° and a slope of 0.5 is about 26.6° (stop 10). | ✓ Proved | — | A slope of 1 is a 45 degree incline; a slope of 0.5 is 26.6 degrees, not 22.5. |
| The numbers the tool shows as you drag, and where the path of steepest ascent ends. | ✓ Checked independently | — | The page's own functions, run at 144 points and directions across the four landscapes, match SymPy's heights, gradients and slopes to 4.4e-16; the on-screen difference-quotient check is within 1.1e-10. The steepest-ascent path ends within 3 cm of the top on the hill, and at one of the two tops on the two-peak map (from (0, 1.5) it reaches the lower one). |
| The path of steepest ascent is drawn by taking short steps along the gradient. | ≈ Checked numerically | A4, D2 | Each step is 2 cm long, in the gradient’s direction at the middle of the step. The curve on screen is that approximation, not an exact solution. |
| Units: heights and distances in meters, so a slope is a pure number, meters of rise for each meter forward. | Reviewed | A1 | Meters divided by meters. |
| The sentences on the cards. | Reviewed | — | Each card was read against the formulas, looking for anything assumed but not listed. No objection stands. |
| A1, A2, A3, A4, D1, D2, D3 | Assumed | — | Granted, not proved. Whether they suit real ground is yours to judge. |
Proved: SymPy reduced the difference between the two sides to zero. Checked independently: the page’s own functions were run against SymPy’s exact answers. Checked numerically: evidence, not proof. Reviewed: a model or a person read it. Assumed: an assumption or a definition, granted and not proved. Checks run 2026-11-11 with SymPy 1.14.0; rerun them with interactives/checks/gradient.py. Cards read by Claude Fable 5.2, 2026-11-11. How it’s checked
Part of Calc Practice: free Calculus 3 practice. Try the gradient and directional derivatives problems or see more interactives.