1. Why more than one variable?
Real quantities depend on many things at once: temperature on position and time, the cost of a design on a dozen parameters, the loss of a neural network on millions of weights. Single-variable calculus asks how f changes when x changes. With several variables the right question is which direction? — and the answer has three parts.
- How does f change? Partial derivatives and the gradient.
- Where is f largest or smallest? Critical points, and Lagrange multipliers when there are constraints.
- How much f accumulates over a region? Double and triple integrals, and the Jacobian for changing coordinates.
The last section connects line integrals to area integrals through Green’s theorem, which is the doorway to the Vector Calculus chapter (div, curl, Stokes) and to the contour integrals of Complex Analysis.
2. Surfaces, level curves & partial derivatives
A function of two variables is a surface z = f(x, y). Its level curves f(x, y) = c are the contour lines of a topographic map. A partial derivative is the ordinary derivative along one axis while the other variable is frozen — the slope of the surface if you walk in the x- or y-direction:
Near a point (a, b) a smooth surface looks like its tangent plane, which is the two-variable version of the tangent line:
If you move along a path (x(t), y(t)), the chain rule adds the contributions of both coordinates: . Notice that this is a dot product — and that dot product is the next idea.
Worked example: tangent plane of f = x²y³ at (1, 2)
f(1, 2) = 8. The partials are fx = 2xy³ = 16 and fy = 3x²y² = 12 at (1, 2). So the tangent plane is
Use it to estimate f(1.01, 1.98): 8 + 0.16 − 0.24 = 7.92. The true value is 1.0201 × 7.762392 ≈ 7.918, so the linear estimate is off by only about 0.002.
3. The gradient & directional derivatives
Pack the partial derivatives into a vector, the gradient ∇f = (fx, fy). The chain rule says that the rate of change of f along a unit direction u is the dot product ∇f · u. Since a dot product equals |∇f| cos φ, the whole geometry follows at once:
Worked example: how fast, and in which direction?
Let f = x²y at P = (2, 1). Then ∇f = (2xy, x²) = (4, 4). The slope in the direction u = (3, 4)/5 is
The steepest possible slope is |∇f| = 4√2 ≈ 5.657, attained along (1, 1)/√2. Our direction (3, 4)/5 is only about 8° away from that, which is why its slope is nearly maximal.
A hiker stands where ∇T = (2, −1) °C per metre. In which direction should she walk to stay at constant temperature? Which direction cools fastest?
4. Optimization: critical points & Lagrange multipliers
At a local maximum or minimum the surface is flat in every direction, so ∇f = 0 there. To classify a critical point, look at the curvature with the second-derivative test: with D = fxxfyy − fxy², the point is a minimum if D > 0 and fxx > 0, a maximum if D > 0 and fxx < 0, and a saddle if D < 0. (D is the determinant of the Hessian matrix of second derivatives — the same determinant as in the Linear Algebra chapter.)
Worked example: classify the critical points of f = x³ − 3x + y²
∇f = (3x² − 3, 2y) = 0 gives x = ±1, y = 0. The second derivatives are fxx = 6x, fyy = 2, fxy = 0, so D = 12x.
At (1, 0): D = 12 > 0 and fxx = 6 > 0, a local minimum. At (−1, 0): D = −12 < 0, a saddle point — a minimum in the y-direction but a maximum in the x-direction.
Real problems come with constraints: maximise f subject to g(x, y) = 0. Picture the level curves of f sweeping across the plane. The best feasible point is the last level curve that still touches the constraint — and there the two curves must be tangent, so their normals ∇f and ∇g are parallel:
Worked example: the box with the most volume
Maximise V = xyz for a box whose surface area is 2(xy + yz + zx) = 6. The Lagrange conditions are
Multiply the first by x, the second by y and the third by z: each left side becomes xyz, so x(y + z) = y(x + z) = z(x + y). The first equality gives xz = yz, hence x = y; the second gives y = z. The box is a cube, and 2 · 3x² = 6 gives x = 1: V = 1, with λ = 1/4.
5. Multiple integrals & the Jacobian
A double integral adds up f over a region: cut it into small pieces ΔA, multiply each by the value of f, and add. Geometrically it is the volume under the surface:
Fubini’s theorem lets you evaluate it as two ordinary integrals, in either order. Choosing the better order is often the whole trick:
Evaluate . (ey² has no elementary antiderivative in y.)
Changing coordinates: the Jacobian
Round regions want round coordinates. When you substitute x = x(u, v), y = y(u, v), a small rectangle du dv is stretched into a parallelogram whose area is |det J| du dv — the determinant of the Jacobian matrix, exactly the “determinant = area scaling factor” of the Linear Algebra chapter, applied locally:
Worked example: the Gaussian integral ∫e^(−x²) dx = √π
The antiderivative of e−x² is not elementary — but the square of the integral is easy in polar coordinates:
Hence ∫e−x²dx = √π. The factor r from the Jacobian is exactly what makes r e−r² integrable. This is also why the normal distribution carries the constant 1/√(2π) in the Probability & Statistics chapter.
6. Line integrals & Green’s theorem
A line integral of a vector field F = (P, Q) along a curve C adds up the component of F along the path — physically, the work done by a force. Parametrize C by r(t) and substitute:
For a closed counter-clockwise loop C bounding a region R, Green’s theorem turns this into an area integral of the local “spin”, Qx − Py (the curl):
Worked example: area from the boundary (the planimeter)
Choose P = −y/2 and Q = x/2, so Qx − Py = 1 and the right side of Green’s theorem is just the area. For the ellipse x = a cos t, y = b sin t:
A mechanical planimeter does exactly this: trace the outline of a shape and read off the enclosed area. (The same identity gives ∮ z̄ dz = 2i · Area in the Complex Analysis chapter.)
7. Practice & where it shows up
Find the area of a disc of radius a using polar coordinates, then the volume of a ball of radius a using spherical coordinates.
Minimise the distance from the origin to the line x + 2y = 5. Which condition does the minimiser satisfy?
Machine learning
Training a network is minimising a loss of millions of variables. Backpropagation computes the gradient with the chain rule; gradient descent walks against it.
Thermodynamics & design
Partial derivatives such as (∂P/∂T)ᵥ hold the other variables fixed. Constrained optimisation (minimise weight subject to strength) is Lagrange multipliers in practice.
Mass, centre of mass, inertia
Mass is ∬ρ dA, the centroid is a ratio of such integrals, and the moment of inertia is ∬ r²ρ dA. Polar and cylindrical coordinates make round parts easy.
Planimeters & circulation
A planimeter measures area by tracing the boundary — Green’s theorem as a mechanical device. In fluids and electromagnetism it relates circulation to curl.
8. Resources
This chapter follows MIT 18.02 (partial derivatives, Lagrange multipliers, multiple integrals, Green’s theorem) and Stanford’s CME 100. It is the prerequisite for the Vector Calculus chapter and for the line integrals used throughout Complex Analysis.