Watch on Instagram

Math Bytes · Multivariable calculus · Episode 4 · Derivatives of multivariable functions

The gradient

The gradient ∇f = (∂f/∂x, ∂f/∂y) puts both partial derivatives into one arrow. It points in the direction where f climbs fastest, its length is how steep that climb is, and it crosses the contour lines at right angles. For x² + y², ∇f = (2x, 2y), so at (1, 2) the gradient is (2, 4).

Posted · About a 1 minute watch, 3 minute read · Take the quiz

Two partials, one arrow

Last lesson, a function f(x, y) got two partial derivatives: ∂f/∂x (the slope walking in x) and ∂f/∂y (the slope walking in y). The gradient puts them together as one vector:

∇f = (∂f/∂x, ∂f/∂y)

The upside-down triangle ∇ is called "nabla" or "del". Read ∇f as "the gradient of f".

What the arrow tells you

Draw the gradient as an arrow on the flat x y plane (the contour map), starting at your point:

  • Direction: it points the way f climbs fastest, the steepest way uphill on the graph of f.
  • Length: its length is how fast f climbs in that steepest direction. Long arrow, steep ground; short arrow, gentle ground.
  • Contour lines: it crosses the contour line through that point at a right angle (wherever ∇f is not zero).
  • Downhill: −∇f points the opposite way, straight downhill, the idealized path water would take.

Worked example: the bowl x² + y²

Take f(x, y) = x² + y².

  1. Partials: ∂f/∂x = 2x and ∂f/∂y = 2y, so ∇f = (2x, 2y).
  2. At (1, 2): ∇f = (2 · 1, 2 · 2) = (2, 4). Draw it from (1, 2): 2 across, 4 up.
  3. Direction check: (2, 4) is just 2 · (1, 2), so the arrow points straight away from the origin, the bottom of the bowl. That is the steepest way up.
  4. Right angle: f(1, 2) = 5, so the contour line through (1, 2) is the circle of radius √5. The arrow points straight out from the center, so it crosses that circle at a right angle.

Try it yourself

  1. For g(x, y) = x² + y², what is ∇g at (3, 0)?
  2. For h(x, y) = xy, what is ∇h?

(Answers: 1. (6, 0), pointing straight out along the x axis. 2. (y, x), since ∂h/∂x = y and ∂h/∂y = x.)

Good to know

  • The gradient lives in the input plane (on the contour map), even though "uphill" refers to the surface z = f(x, y).
  • Functions with three inputs have a three-part gradient, (∂f/∂x, ∂f/∂y, ∂f/∂z).
  • Where ∇f = (0, 0), there is no uphill direction at all: that is where peaks, valleys and flat spots can be (next lesson).
  • In the video, the small spoke arrows around the bowl show direction only; they are shortened to fit. On the hill sketch, arrow lengths are drawn to scale with the steepness.

Answer to the comment question

f(x, y) = 3x + y². What's the gradient at (4, 1)? (3, 2). ∂f/∂x = 3 (the y² has no x), and ∂f/∂y = 2y, which is 2 at y = 1. So ∇f(4, 1) = (3, 2); the x = 4 doesn't change anything here.

Test your knowledge

Quick quiz: The gradient

4 multiple-choice questions. Pick one answer for each, then check how you did.

1What is the gradient of f(x, y)?
2Which way does the gradient point?
3For f(x, y) = x² + y², what is ∇f at (1, 2)?
4How does the gradient meet the contour line through a point?

Sources

Video transcript

On a hillside, which way is straight uphill?

Put both partial derivatives into one arrow. That's the gradient, written with an upside-down triangle.

The gradient points in the direction where the function climbs fastest. Its length tells you how steep that climb is.

For the bowl x squared plus y squared, the partials are two x and two y. At one, two, the gradient is two, four.

That arrow points straight away from the bottom of the bowl, the steepest way up.

It also crosses the contour lines at right angles. Water flows the opposite way, straight downhill.

Your turn. f equals three x plus y squared. What's the gradient at four, one? Comment your answer below!

That's your byte.

More from Multivariable calculus

All Multivariable calculus lessons