Gauss's and Stokes's theorems

Link what happens inside a region to what happens on its edge.

Divergence and curl describe a field at a single point. Physics more often needs a whole region: how much flows out of this box, or how much the field pushes round this loop. Two theorems make the link, and they are really one idea used twice. Add up what happens at every point inside a region, and everything cancels except what happens on its edge.

A region cut into triangular cells, lying in a flow. Each cell is tinted by what it measures for its size: amber above zero, blue below. Drag the amber point to light up a cell, and the white corners to change the region's shape. The small picture shows the lit cell, outlined in amber, and one neighbour. With "Flow out of it" chosen, an arrow shows the flow crossing a wall. With "Flow round its edge", an arrow points the way that stretch of wall is walked, anticlockwise round its own cell or round the whole region. Either way an amber arrow counts as plus and a blue one as minus.
  • As it starts, each of the 24 cells measures its own net flow out, as the box did in the last lesson. The amber cells on the right send out more than they take in, and the blue ones on the left take in more. "All 24 cells added up" and "The outer edge alone" both read \(+2.577\).
  • Drag the amber point from cell to cell and watch the small picture. Whatever the lit cell counts through a shared wall, its neighbour counts the same amount with the opposite sign.
  • Slide Cells from 6 up to 384. Each cell holds less as it gets smaller, the tints turn into a smooth map of the divergence, and neither total moves. Then set it back to 24, where the cells are big enough to see.
  • With the amber point on a cell, switch to Flow round its edge. Now each cell measures what would turn a paddle wheel. The totals become \(+6.609\) and \(+6.609\), and the small picture shows why a shared wall cancels: the two cells walk along it in opposite directions.
  • Choose the Whirl, a flow that turns like a solid wheel, and switch back to "Flow out of it". Every cell reads zero, give or take a 1 in the last place from rounding, and so does the edge. Then choose the River with "Flow round its edge": the top half is amber, the bottom half blue, and they nearly cancel.
  • Go back to Mixed and "Flow out of it", where both totals are \(+2.577\) again. Tick Take away the inside walls. They were adding up to nothing all along, so nothing is lost. Only the outer edge is left.
  • Now drag the white corners. Pull the right-hand ones in and push the left-hand ones out, and the total drops. Every shape gives a new pair of numbers, and the two are always equal.
  • Untick the box, and the cells come back, cut to fit the new shape.

Why the inside walls cancel

Take two cells with a wall between them. Whatever leaves the first through that wall arrives in the second. So when you add the two cells' net outflows, the shared wall is counted once as "out" and once as "in", and drops out of the sum. What's left is the flow through the outline of the two cells together.

Add a third cell, and the same thing happens to the wall it shares. Keep going until the whole region is covered. Every inside wall has a cell on each side, so every inside wall cancels. The only walls with nothing to cancel them are the ones on the outside. However the region is cut up, and however fine the cells:

\[ \text{every cell's net outflow, added up} \qquad = \text{net outflow through the outer edge} \]

That is the whole proof. The rest is writing each side in the language of calculus.

You have seen this trick before. The fundamental theorem says that adding up a slope along an interval leaves only the values at its two ends: \(\int_a^b f'(x)\,dx = f(b) - f(a)\). Everything in between cancels there too. The theorems in this lesson are the same idea in two and three dimensions, where the "ends" of a region are its whole edge.

The divergence theorem

Physicists usually call this one Gauss's theorem. Don't mix it up with Gauss's law, which is a fact about electric fields, in the next chapter.

Start with one small cell of area \(\Delta A\). In the last lesson, divergence was defined as net outflow divided by area, for a small box. Turn that round.

\[ \text{net outflow of a small cell} = (\nabla\cdot\mathbf{F})\,\Delta A \]

Add up over every cell in the region, which we'll call \(R\). As the cells shrink, a sum of "value × small area" is a double integral.

\[ \text{sum over the cells} = \iint_R \nabla\cdot\mathbf{F}\;dA \]

The same sum, as the figure showed, is the flow out through the outer edge. Write \(\hat{\mathbf{n}}\) for an arrow of length 1 pointing straight out of the region, square to its edge. Then \(\mathbf{F}\cdot\hat{\mathbf{n}}\) is the part of the field that crosses the edge, and \(dl\) is a short piece of the edge.

\[ \text{flow out through the edge} = \oint \mathbf{F}\cdot\hat{\mathbf{n}}\;dl \]

The ring on the integral sign means "all the way round a closed path". Set the two equal.

\[ \iint_R \nabla\cdot\mathbf{F}\;dA = \oint \mathbf{F}\cdot\hat{\mathbf{n}}\;dl \]

In three dimensions nothing changes but the names. The cells are small boxes, their walls are faces, the region is a volume \(V\), and its edge is a closed surface. A small patch of that surface is the area vector \(d\mathbf{A}\) from line and surface integrals: an arrow square to the patch, whose length is the patch's area. On a closed surface it always points outwards.

\[ \iiint_V \nabla\cdot\mathbf{F}\;dV = \oint \mathbf{F}\cdot d\mathbf{A} \]

In words: the total amount being made inside a region is the total amount flowing out through its surface. The right-hand side is a flux, taken over a closed surface, which is what the ring on its integral sign says here.

Here's a check you can do in your head. Take \(\mathbf{F} = (x, y)\), whose divergence is 2 everywhere, and a disc of radius \(a\) about the origin. The left side is 2 times the disc's area, \(2\pi a^2\). On the rim, the field points straight out and has length \(a\), and the rim is \(2\pi a\) long, so the right side is \(a \times 2\pi a = 2\pi a^2\) as well.

Stokes's theorem

Now do the same with circulation, the flow along the edge of each cell, going round anticlockwise.

Two neighbouring cells both travel along their shared wall, but in opposite directions, because both are going anticlockwise round their own middles. Whatever the field adds to one cell's circulation along that wall, it takes from the other's. So the inside walls cancel again, and the sum of all the cells' circulations is the circulation round the outer edge.

For a small cell, curl was defined as circulation divided by area. Turn it round.

\[ \text{circulation of a small cell} = (\text{curl}\,\mathbf{F})\,\Delta A \]

Add up over the region. The left side becomes a double integral, and the right side is the circulation round the outer edge, where \(d\mathbf{l}\) is a short step along it.

\[ \iint_R \text{curl}\,\mathbf{F}\;dA = \oint \mathbf{F}\cdot d\mathbf{l} \]

In three dimensions the curl is an arrow, \(\nabla\times\mathbf{F}\), and the region can be any surface \(S\) with a rim, flat or not. Each small piece of the surface counts the part of the curl that pokes through it.

\[ \iint_S (\nabla\times\mathbf{F})\cdot d\mathbf{A} = \oint \mathbf{F}\cdot d\mathbf{l} \]

In words: the total twist over a surface is the flow round its rim. The flat version is often called Green's theorem, and the general one is Stokes's.

Check it with \(\mathbf{F} = (-y, x)\), a steady whirl with curl 2 everywhere, on the same disc. The left side is \(2 \times \pi a^2\). On the rim the field points along the path and has length \(a\), so the right side is \(a \times 2\pi a = 2\pi a^2\).

Two details matter in three dimensions. The direction you go round the rim and the side of the surface that \(d\mathbf{A}\) points out of are tied together by the right-hand rule from cross products: curl your fingers the way you travel round the rim, and your thumb points the way \(d\mathbf{A}\) does. And the right-hand side of the equation only knows about the rim. So every surface that shares a rim gives the same answer, whether it's a flat disc or a deep bag. A wire loop with a soap film across it is the picture to hold: blow on the film so that it bulges, and the total twist through it doesn't change.

\[ \iiint_V \nabla\cdot\mathbf{F}\;dV = \oint \mathbf{F}\cdot d\mathbf{A} \qquad\qquad \iint_S (\nabla\times\mathbf{F})\cdot d\mathbf{A} = \oint \mathbf{F}\cdot d\mathbf{l} \]

The first is the divergence theorem: sources inside a volume, against flow out through its closed surface. The second is Stokes's theorem: twist over a surface, against flow round its rim. Some books write \(d\mathbf{S}\) for the area vector, as the magnetic potential does later in this course.

Both need the flow to be smooth everywhere in the region, with no point where it blows up. The last problem shows what goes wrong otherwise.

What they buy you

Each theorem lets you swap a hard sum for an easy one. If the divergence is simple, you never need to work out the flow through a complicated surface. If the flow through a surface is simple, you can find out what's inside without looking.

Every law of electricity and magnetism can be said in two ways: what the field does at each point, or what it does over a whole region. These two theorems translate between them. Here \(\mathbf{E}\) is the electric field and \(\mathbf{B}\) the magnetic field.

  • "The divergence of \(\mathbf{E}\) at a point is the charge density there, divided by a constant" becomes "the flux of \(\mathbf{E}\) out of any closed surface is the charge inside it, divided by that constant". That is Gauss's law, and the second way of saying it finds the field round a ball of charge in one line.
  • "The divergence of \(\mathbf{B}\) is zero everywhere" becomes "as much magnetic field leaves any closed surface as enters it".
  • "A changing magnetic field gives \(\mathbf{E}\) a curl" becomes "the push round a loop of wire is set by how fast the magnetic flux through it changes". That is induction, the way every generator works.
  • In the magnetic potential, it is Stokes's theorem that turns a loop of \(\mathbf{A}\) into the magnetic flux inside it.

Problems

Three cells sit in a row: a left one, a middle one and a right one. Nothing crosses their top or bottom walls. Each second, 2 units flow into the left cell through its left wall, 5 flow from the left cell into the middle one, 3 flow from the middle cell into the right one, and 4 flow out of the right cell through its right wall. Find each cell's net outflow and add them. Then find the net outflow through the outer edge of the row.

Answer

The left cell sends out 5 and takes in 2: \(+3\). The middle one sends out 3 and takes in 5: \(-2\). The right one sends out 4 and takes in 3: \(+1\). The sum is \(3 - 2 + 1 = 2\).

The outer edge has only two walls that anything crosses: 4 out on the right and 2 in on the left, a net outflow of \(4 - 2 = 2\). The 5 and the 3 crossed inside walls, so each was counted once as out and once as in.

For \(\mathbf{F} = (3x,\, 2y)\), find the net flow out of the rectangle with corners \((0, 0)\) and \((2, 1)\) in two ways: from the divergence, and wall by wall.

Answer

From the divergence: \(\nabla\cdot\mathbf{F} = 3 + 2 = 5\) everywhere, and the area is \(2 \times 1 = 2\), so the net flow out is \(5 \times 2 = 10\).

Wall by wall: on the right wall, \(x = 2\), so \(F_x = 6\), and the wall is 1 long: \(6\) out. On the left wall \(F_x = 0\). On the top wall, \(y = 1\), so \(F_y = 2\), and the wall is 2 long: \(4\) out. On the bottom wall \(F_y = 0\). In all, \(6 + 4 = 10\).

\(\mathbf{F} = (-y,\, x)\) has curl 2 everywhere. Find its circulation round a square of side 3, and round a circle of radius 2. Does it matter where you put them?

Answer

By Stokes's theorem the circulation is the curl added up over the area inside. The curl is the same everywhere, so that is just curl × area.

Square: \(2 \times 3^2 = 18\). Circle: \(2 \times \pi \times 2^2 = 8\pi \approx 25.1\).

It doesn't matter where they are, or which way the square is turned. Only the area counts.

Check the divergence theorem for \(\mathbf{F} = (x, y)\) and the disc of radius 3 about the origin, by working out both sides.

Answer

Inside: the divergence is \(1 + 1 = 2\), and the disc's area is \(\pi \times 3^2 = 9\pi\), so the left side is \(18\pi\).

On the edge: at a point on the circle, \((x, y)\) is an arrow from the origin to that point, so it points straight out and has length 3. That's \(\mathbf{F}\cdot\hat{\mathbf{n}} = 3\) all the way round. The circle is \(2\pi \times 3 = 6\pi\) long, so the right side is \(3 \times 6\pi = 18\pi\).

Both are \(18\pi \approx 56.5\).

Now in three dimensions. For \(\mathbf{F} = (x, y, z)\), find the flux out through a sphere of radius 2 about the origin, both ways. A sphere of radius \(r\) has volume \(\frac{4}{3}\pi r^3\) and surface area \(4\pi r^2\).

Answer

Inside: the divergence has three terms now, \(1 + 1 + 1 = 3\). The volume is \(\frac{4}{3}\pi \times 2^3 = \frac{32}{3}\pi\), so the left side is \(3 \times \frac{32}{3}\pi = 32\pi\).

On the surface: \((x, y, z)\) points straight out from the origin, and on the sphere its length is 2. The surface area is \(4\pi \times 2^2 = 16\pi\), so the flux is \(2 \times 16\pi = 32\pi\).

Both are \(32\pi \approx 100.5\).

In the last lesson, the field \(\mathbf{F} = \frac{(x,\; y)}{x^2 + y^2}\) had zero divergence everywhere except the origin, yet \(2\pi\) flowed out through every circle about the origin. Use the divergence theorem on the ring between the circles of radius 1 and radius 3 to show that those two facts agree.

Answer

The ring doesn't contain the origin, so the divergence is zero all over it, and the theorem says the net flow out of the ring must be zero.

The ring's edge has two parts. Through the outer circle, \(2\pi\) flows out. At the inner circle the field also points away from the origin, but that direction is into the ring, so it counts as \(-2\pi\). The total is \(2\pi - 2\pi = 0\), as the theorem demands.

Read the other way, this says the flow through the inner circle and the outer one must be equal. With no sources between them, what crosses one closed curve crosses the next. The size and shape of the curve can't matter, only what it encloses. That is the key to Gauss's law.

Learn more

An unhandled error has occurred. Reload 🗙