Divergence and curl
A scalar function had one derivative. A vector field gets two, and they answer the only two local questions you can ask of a flow: is it spreading, and is it spinning? Both are numbers at a point, both are limits of an integral around a shrinking loop, and both collapse to a two-line formula in coordinates. Drop a box probe and a paddlewheel into a field and read them off.
The box probe: divergence
Net outflow per unit area
Our running example is a velocity field. It might be the flow of a fluid, or the joint-velocity field of the two-link arm: at each configuration, the arrows tell you how the hand is moving. Differentiating a scalar function gave one new function. Differentiating a field gives two scalar fields. The first measures how much the flow spreads apart at a point.
Take a tiny square $\square_h$ of half-width $h$ centred on a probe $p$. The flux of $F$ through its boundary is the total amount of field crossing outward, and the divergence is that flux per unit area in the limit of a vanishing box:
On each of the four sides the outward normal $n$ is constant, so the integral is just $F\cdot n$ times the side length. With $F=(P,Q)$ that gives the coordinate formula — the sum of the two partial derivatives that measure how each component grows along its own direction:
Pick a preset and drag the probe. The readout computes the flux over the four sides, divides by the box area $4h^2$, and prints it next to the analytic value. The arrows at the boundary are the outward-normal components: they point out where the field leaves, in where it enters.
A square probe of half-width h at the draggable probe (grey). Bold arrows are the outward normal components F·n on each side; the faint background is the field itself.
The paddlewheel: curl
Net circulation per unit area
The second derivative asks a different question: if a tiny pinwheel sat at $p$, would the flow turn it? Take a small disc $D_h$ of radius $h$, and add up the component of the field along the tangent to its rim. That is the circulation, and the curl is circulation per unit area as the disc shrinks:
Sample the rim and add the tangential components and the same two-line formula falls out, now with the opposite pairing of partials:
Drag the probe and watch the tangential arrows on the rim. On rotation $F=(-y,x)$ every arrow pushes the wheel the same way and the curl is a steady $+2$. On shear $F=(y,0)$ the top and bottom of the wheel are pushed in opposite directions, so the net circulation is negative. The readout compares the sampled circulation over the rim with the analytic value.
A disc probe of radius h at the draggable probe. Bold arrows are the tangential components F·t at sample points around the rim.
Two scalar fields over the whole plane
Divergence and curl as heatmaps
Because both are scalars, we can shade the plane by their value. The top map is $\operatorname{div} F$, the bottom is $\operatorname{curl} F$ — magenta for positive, teal for negative, near-white near zero. Switching presets and dragging the probe shows that the field and its two derivative fields are different pictures of the same object.
A source is positive divergence everywhere and zero curl; a rotation is the mirror image, zero divergence and positive curl; a saddle and the uniform drift are zero in both. The readout tracks both numbers at the probe as it moves across the shaded plane.
Top: divergence heatmap. Bottom: curl heatmap. Drag the probe on either map; the marker and the readout follow on both.
Shrink the probe
The limit is what makes them derivatives
Divergence and curl were defined as limits, and the whole point of the limit is that the box and the wheel forget their own size. Slide $h$ down and the numeric estimate walks onto the analytic value: the probe stops measuring the field around the point and starts measuring the field at the point.
The readout shows both the signed error and the error divided by $h^2$. For the smooth nonlinear field below that ratio settles onto a constant, which is exactly what an $h^2$ error looks like; a cruder one-sided difference would instead have error $O(h)$, with the error divided by $h$ settling. Either way the estimate converges, and that is the content of “these are derivatives.”
Both probes at half-width h: the dashed square estimates divergence, the dashed circle estimates curl, and both shrink with the slider.
Divergence-free vs curl-free
Incompressible and irrotational, and what each buys you
The two numbers name two special kinds of field. If $\operatorname{div}F=0$ everywhere the flow is incompressible: no point creates or destroys fluid, so a small blob keeps its area as it is carried along. If $\operatorname{curl}F=0$ everywhere the field is irrotational, and on a simply connected domain that is exactly the condition for it to be conservative — there is a potential $\phi$ with $F=\nabla\phi$. That is the test Part 2 built up by dragging paths, now reduced to one cheap partial-derivative check.
Toggle between a purely rotational field (divergence-free), a purely radial one (curl-free), and one with both nonzero. The readout says which of the two numbers vanishes, and a field that is both is potential flow: $F=\nabla\phi$ with $\nabla^2\phi=0$.
The field and a draggable probe. The two derivative numbers are printed at the probe; one of them is zero for the first two toggles.
Where this shows up
The densities the integral theorems integrate
Divergence and curl are not ends in themselves — they are the densities that the big integral theorems integrate. Green's, Stokes' and the divergence theorem all say the same thing: the behaviour on a boundary equals the accumulated behaviour inside, and the thing being accumulated is exactly one of these two scalars. That is Part 4: Green, Stokes, Divergence: one theorem, and this page is its integrand. The swirl you measured with the paddlewheel is what Stokes integrates over a surface; the outflow you measured with the box is what the divergence theorem integrates over a volume.
Two more places the picture returns. A dynamical system $\dot p=F(p)$ is a velocity field, and Part 12: Differential equations uses the divergence to decide whether a flow stretches or squeezes phase-space volume. And the gradient fields that fill Nonlinear Optimization are curl-free by construction, $\nabla\times\nabla f=0$: a loss surface has no rotational swirl, which is why descent paths cannot loop back on themselves in the way a general flow can.
Notation to carry forward
| Notation | Reads as | Where it comes up |
|---|---|---|
div F, ∇·F | Net outflow per unit area: the limit of flux over a shrinking box | This part; divergence theorem (Part 4) |
curl F, ∇×F | Net circulation per unit area: the limit of circulation around a shrinking wheel | This part; Green and Stokes (Part 4) |
∂P/∂x + ∂Q/∂y | Divergence in coordinates, for F=(P, Q) | Every computation below |
∂Q/∂x − ∂P/∂y | Curl in coordinates (the 2-D scalar curl) | Part 4; conservative-field test |
curl F = 0 | Irrotational; on a simply connected domain, F = ∇φ is conservative | Part 2; gradient fields |
div F = 0 | Incompressible — area is preserved by the flow | Fluids; Hamiltonian systems |
∇²φ = 0 | Laplace's equation: potential flow, simultaneously irrotational and incompressible | Physics; Part 6 coordinates |
Further reading
- 3Blue1Brown, Divergence and curl — the same box and paddlewheel, animated.
- MIT 18.02SC, Multivariable Calculus — the course that runs alongside this volume, fields and all.
- Khan Academy, Multivariable calculus — extra practice on divergence, curl and the theorems that follow.