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).
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
fclimbs fastest, the steepest way uphill on the graph off. - Length: its length is how fast
fclimbs 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
∇fis not zero). - Downhill:
−∇fpoints the opposite way, straight downhill, the idealized path water would take.
Worked example: the bowl x² + y²
Take f(x, y) = x² + y².
- Partials:
∂f/∂x = 2xand∂f/∂y = 2y, so∇f = (2x, 2y). - At (1, 2):
∇f = (2 · 1, 2 · 2) = (2, 4). Draw it from(1, 2): 2 across, 4 up. - Direction check:
(2, 4)is just2 · (1, 2), so the arrow points straight away from the origin, the bottom of the bowl. That is the steepest way up. - 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
- For
g(x, y) = x² + y², what is∇gat(3, 0)? - 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.
Sources
- OpenStax, "Calculus Volume 3, 4.6 Directional Derivatives and the Gradient": gradient vector; direction of fastest increase; perpendicular to level curves
- Wolfram MathWorld, "Gradient": definition and ∇ notation
- MIT OpenCourseWare, "18.02 Multivariable Calculus (Fall 2007)": lecture notes
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
- Multivariable calculus EP1Functions of two variables
- Multivariable calculus EP2Contour maps
- Multivariable calculus EP6Lagrange multipliers
- Multivariable calculus EP7Double integrals