Calculus III – functions of several variables and vector analysis

The quantities of physics rarely depend on a single variable. The temperature in a room, the pressure in a flow and the electric field around a charge are functions of three space coordinates and time. Calculus III was the course in which differential and integral calculus were extended to several dimensions and to vector fields – the language in which Maxwell’s equations and fluid mechanics are written. The page has an interactive contour map and a figure on divergence and curl.

University of Sussex, Calculus III (1975–78): One of the mathematics courses in the physics syllabus. The material is used throughout the physics courses, from electromagnetism and fluid mechanics to quantum mechanics. The page describes the subject as it is normally taught; it is not a reproduction of the original course.

Partial derivatives

For a function $f(x, y)$ of two variables the partial derivative $\partial f/\partial x$ is the slope in the $x$ direction with $y$ held fixed. If the partial derivatives are continuous, the order of differentiation does not matter: $\partial^2 f/\partial x\,\partial y = \partial^2 f/\partial y\,\partial x$ (Schwarz’s theorem). That is why the Maxwell relations of thermodynamics hold. The chain rule for several variables,

$$\frac{df}{dt} = \frac{\partial f}{\partial x}\frac{dx}{dt} + \frac{\partial f}{\partial y}\frac{dy}{dt},$$

describes how a quantity changes along a path – for example, the temperature felt by a particle drifting with a flow.

Gradient and contours

The gradient $\nabla f = (\partial f/\partial x, \partial f/\partial y)$ points in the direction in which $f$ increases fastest, and its length is the slope in that direction. The directional derivative along a unit vector $\hat u$ is $D_{\hat u}f = \nabla f\cdot\hat u$. The gradient is perpendicular to the contours $f = $ constant – on a map with height contours it points straight uphill, and water runs the opposite way. In physics force is minus the gradient of the potential, $\vec F = -\nabla V$, and heat flows against the temperature gradient.

Try it: The colours are the function value, and the white curves are contours. Click somewhere on the map: the gold arrow is the gradient, the blue one the chosen direction $\hat u$, and the directional derivative is the projection of the gradient onto it. Turn the direction: when is the directional derivative zero? On the saddle the gradient is zero at the centre, but the point is neither a maximum nor a minimum.

Extrema and Lagrange

At a local maximum or minimum the gradient is zero. What kind of stationary point it is is decided by the Hessian matrix of second derivatives: if both eigenvalues are positive it is a minimum, both negative a maximum, and of opposite sign a saddle point. If $f$ is to be optimised subject to a constraint $g(x, y) = c$, the solution lies where the contour of $f$ just touches the constraint curve, so that the two gradients are parallel:

$$\nabla f = \lambda\,\nabla g$$

The constant $\lambda$ is the Lagrange multiplier. The method is everywhere in physics: in statistical mechanics the Boltzmann distribution is derived by maximising entropy subject to constraints on number and energy, and the multiplier for energy turns out to be $1/k_BT$.

Multiple integrals

A double integral $\iint_D f\,dA$ sums $f$ over a region of the plane – a mass from a surface density, a charge from a charge density. When coordinates are changed, the area element must be scaled by the Jacobian determinant:

$$dA = r\,dr\,d\theta\ \text{(polar)},\qquad dV = r^2\sin\theta\,dr\,d\theta\,d\varphi\ \text{(spherical)}$$

A classic example is the Gaussian integral: $I = \int_{-\infty}^\infty e^{-x^2}dx$ is computed by squaring it, $I^2 = \iint e^{-(x^2+y^2)}dx\,dy$, and changing to polar coordinates, where the integral becomes elementary: $I^2 = \pi$, so $I = \sqrt\pi$.

Line integrals

The work done by a force along a path $C$ is the line integral $W = \int_C \vec F\cdot d\vec r$. For a conservative field $\vec F = -\nabla V$ it depends only on the end points, and the integral round a closed curve is zero – that is the definition of a conserved energy. If $\oint \vec F\cdot d\vec r \neq 0$, the field is not conservative; an example is the electric field around a transformer core in which the magnetic field is changing.

Divergence and curl

For a vector field $\vec F$ the divergence $\nabla\cdot\vec F$ measures how much the field flows out of a small region per unit area, and the curl $\nabla\times\vec F$ how much it swirls. A source field such as $\vec F = (x, y)$ has divergence 2 and no curl; a vortex field such as $\vec F = (-y, x)$ has curl 2 and no divergence. A field can have curl without swirling visibly: the flow in a shear field $\vec F = (y, 0)$ is in straight lines, but a small paddle wheel in it would still be turned.

Try it: Click to move the circle. The figure computes numerically the flux out through the circle, $\oint \vec F\cdot\hat n\,ds$, and the circulation along it, $\oint \vec F\cdot d\vec r$, and compares them with the integral of the divergence and curl over the interior – the theorems of Gauss and Stokes in the plane. For the point source and the line vortex the divergence and curl are zero everywhere except at the origin: put the circle round the origin, and the flux or circulation is $2\pi$, whatever the radius.

Gauss and Stokes

The divergence theorem (Gauss, Ostrogradsky) and Stokes’ theorem connect the behaviour of a field inside a region with its behaviour on the boundary:

$$\oint_S \vec F\cdot d\vec A = \int_V \nabla\cdot\vec F\,dV,\qquad \oint_C \vec F\cdot d\vec r = \int_S (\nabla\times\vec F)\cdot d\vec A$$

With them Maxwell’s equations can be written both in integral form – Gauss’s law, Faraday’s law, Ampère’s law – and in differential form (see applied field theory). The continuity equation $\partial\rho/\partial t + \nabla\cdot\vec J = 0$ says that charge and mass are conserved locally, and it holds in fluid mechanics, electromagnetism and quantum mechanics. George Green, a self-taught miller from Nottingham, published the theorem that bears his name in 1828 at his own expense; it only became known when William Thomson (Lord Kelvin) found it 17 years later.

Since 1978

Further reading