Reading and display settings

Appearance

System follows your operating system and keeps following it, even if you change it later. The header's sun, moon and monitor cycle the same three options.

Text size (%) 100%

Default. Scales every text size on the site, equations and tables included.

Reading width 70ch

How much text runs across one line of prose. Narrower is easier to track; wider fits more on screen.

Line spacing 1.6

The leading on body text. Taller leading helps a tired eye stay on the line.

Density

Padding and gaps around controls, cards, and tables — how much breathing room the layout leaves itself.

Motion

System follows your operating system. Reduced removes every transition on this site. Full keeps them on unless your system asks for less.

1

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:

$$ \operatorname{div} F(p) \;=\; \lim_{h\to 0}\frac{1}{(2h)^2}\oint_{\partial \square_h} F\cdot n\,ds. $$

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:

$$ \operatorname{div} F \;=\; \frac{\partial P}{\partial x} + \frac{\partial Q}{\partial y}. $$

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.

💡 Positive divergence means the point is a source (net outflow): fluid is created there, or the flow expands. Negative means a sink. For the linear presets above the box estimate is exact at every size, which is why the two numbers agree immediately.
2

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:

$$ \operatorname{curl} F(p) \;=\; \lim_{h\to 0}\frac{1}{\pi h^2}\oint_{\partial D_h} F\cdot t\,ds. $$

Sample the rim and add the tangential components and the same two-line formula falls out, now with the opposite pairing of partials:

$$ \operatorname{curl} F \;=\; \frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}. $$

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.

⚠️ A source spreads but does not spin (curl $=0$); a rotation spins but does not spread (div $=0$). The two derivatives are independent, and a field can have either, both, or neither — Step 5 makes that precise.
3

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.

$$ F=(P,Q) \;\xrightarrow{\;\nabla\cdot\;}\; \operatorname{div}F \;\in\; \mathbb{R}, \qquad F=(P,Q) \;\xrightarrow{\;\nabla\times\;}\; \operatorname{curl}F \;\in\; \mathbb{R}. $$

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.

positive near zero negative
4

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.

$$ \operatorname{div}F(p) - \frac{\text{flux}(\square_h)}{4h^2} \;=\; O(h^2), \qquad \operatorname{curl}F(p) - \frac{\text{circ}(D_h)}{\pi h^2} \;=\; O(h^2). $$

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.

5

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.

$$ \operatorname{curl}F = 0 \;\Longrightarrow\; F=\nabla\phi \;\text{(simply connected)}, \qquad \operatorname{div}F = 0 \;\Longrightarrow\; \text{incompressible}. $$

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.

6

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.

7

Notation to carry forward

NotationReads asWhere it comes up
div F, ∇·FNet outflow per unit area: the limit of flux over a shrinking boxThis part; divergence theorem (Part 4)
curl F, ∇×FNet circulation per unit area: the limit of circulation around a shrinking wheelThis part; Green and Stokes (Part 4)
∂P/∂x + ∂Q/∂yDivergence in coordinates, for F=(P, Q)Every computation below
∂Q/∂x − ∂P/∂yCurl in coordinates (the 2-D scalar curl)Part 4; conservative-field test
curl F = 0Irrotational; on a simply connected domain, F = ∇φ is conservativePart 2; gradient fields
div F = 0Incompressible — area is preserved by the flowFluids; Hamiltonian systems
∇²φ = 0Laplace's equation: potential flow, simultaneously irrotational and incompressiblePhysics; Part 6 coordinates
8

Further reading

9

Check your understanding

0/4 answered