Chapter 19

19. Multivariable & Vector Calculus

College

Real quantities often depend on more than one variable — temperature across a room, or profit over both price and quantity. This chapter extends calculus to several variables using vectors, partial derivatives and the gradient.

At a glance
Core ideaCalculus extends to several variables using vectors and partial derivatives.
Key termGradient ∇f: the vector pointing in the direction of steepest increase.
You can…Take partial and directional derivatives and locate critical points.
Watch out∇f = 0 may be a saddle point, not a maximum or minimum.
01 · Theory

Vectors, partial derivatives and the gradient

A vector in n is an ordered list of numbers with both magnitude and direction. The dot product of vectors a and b is a·b = ∑ aibi = |a||b|cosθ — it measures how aligned two vectors are, and is zero exactly when they are perpendicular. In ℝ³, the cross product a × b produces a new vector perpendicular to both.

For f(x, y), the partial derivative ∂f/∂x differentiates with respect to x while treating every other variable as a constant. Collecting all partials gives the gradient:

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

The gradient points in the direction of steepest increase of f, with magnitude equal to that steepest rate. The directional derivative along a unit vector u is Duf = ∇f · u. Multiple integrals extend the same accumulation idea to two or three dimensions, e.g. a double integral over a region gives the volume under a surface.

02 · Explanation

Uphill in every direction at once

Imagine standing on a hillside described by f(x, y) = elevation. A partial derivative asks: "if I only ever step east-west (holding north-south fixed), how steep is it?" That is one slice of the full picture. The gradient stitches every direction's slope together into a single vector that always points straight uphill, as steeply as possible — walk in that direction and you gain elevation fastest of all.

The dot product's role in the directional derivative is elegant: ∇f · u measures how much of the gradient's "push" lines up with the direction u you actually chose to walk. Walk along the gradient itself and you get the maximum possible rate; walk perpendicular to it and the rate is zero — you're moving along a contour line, at constant height. This machinery — the gradient — is exactly what powers gradient descent, the algorithm that trains most modern machine learning models by repeatedly stepping downhill on an error surface.

03 · Practical

Worked example: gradient and directional derivative

Problem

Let f(x, y) = x²y + 3y². Find ∇f at (2, 1), and the directional derivative there in the direction u = (3/5, 4/5) (a unit vector).

  1. ∂f/∂x = 2xy. At (2,1): 2(2)(1) = 4.
  2. ∂f/∂y = x² + 6y. At (2,1): 4 + 6(1) = 10.
  3. So ∇f(2,1) = (4, 10).
  4. Directional derivative: Duf = ∇f · u = 4(3/5) + 10(4/5) = 12/5 + 40/5 = 52/5 = 10.4.

Answer: ∇f(2,1) = (4, 10); the function increases at rate 10.4 in the direction u.

04 · Q&A

Test your understanding

What does it mean geometrically if ∇f = 0 at a point?

It's a critical point — the surface is momentarily flat in every direction, exactly like f′(x) = 0 in single-variable calculus. It could be a local maximum, a local minimum, or a saddle point (up in one direction, down in another), which has no single-variable analogue.

Why is the dot product of two perpendicular vectors zero?

Because a·b = |a||b|cosθ, and perpendicular vectors have θ = 90°, where cos 90° = 0. Geometrically, neither vector has any component "along" the other's direction, so there's nothing to multiply together.

What's the difference between a partial derivative and a directional derivative?

A partial derivative measures the rate of change along one coordinate axis only (holding the others fixed). A directional derivative generalises this to any chosen direction u, computed as ∇f · u. In fact, the partial derivatives are just the special cases where u is a coordinate axis unit vector.

Give a real-world example where the gradient is useful.

Machine learning: training a model means minimising an error function of many parameters, and gradient descent repeatedly steps in the direction opposite the gradient (steepest decrease) until the error is minimised. Meteorologists similarly use the gradient of a pressure or temperature field to find the direction of fastest change.

Concept mind map

How the ideas connect

Every key idea in this chapter, branching from the core concept — use it to see the whole picture at a glance.

VectorsPartialderivativesGradientDirectionalderivativeDot productSteepest ascentMultivariable Calculus
Infographic

The key facts, visualised

grad f
Vector of partial derivatives
df/dx
Partial derivative, hold other vars fixed
a . b
Dot product measures alignment
grad direction
Points toward steepest increase
Solved examples

Worked problems, step by step

Follow each solution line by line, then try to reproduce it on paper before moving on.

Example 1Find the gradient of f(x, y) = x^2 + y^2.

  1. Partial in x: df/dx = 2x
  2. Partial in y: df/dy = 2y
  3. Gradient = (2x, 2y)

Example 2Find the directional derivative of f = x^2 + y^2 at (1, 1) in direction (1, 0).

  1. Gradient at (1,1) is (2, 2)
  2. Unit direction is (1, 0)
  3. Dot product: 2(1) + 2(0) = 2
Practice problem set

Now you try

Work each one out first, then tap to reveal the worked answer.

1Find df/dx for f = 3x^2 y.
Treat y as constant: 6xy.
2Find df/dy for f = 3x^2 y.
Treat x as constant: 3x^2.
3Compute the dot product of (1, 2) and (3, 4).
1(3) + 2(4) = 11.
4Give the gradient of f = xy.
grad f = (y, x).
5In which direction does f increase fastest at a point?
In the direction of the gradient vector.
6Find the magnitude of the vector (3, 4).
sqrt(9 + 16) = 5.