Divergence and curl

Read what a vector field is doing at a point.

A vector field puts an arrow at every point: the wind over a country, the current in a river, the pull of gravity round a planet. That's far too many arrows to take in. So at any one point, physicists ask two questions. Is something being made here, or used up? And is there a twist here? The answers are two numbers called the divergence and the curl, and all four of Maxwell's equations are statements about them.

A flow seen from above, in units of its own. Drag the amber point to move the probe: a square box that measures what crosses its walls (amber arrows out, blue arrows in), with a paddle wheel inside. The small graph shows the two readings for every size of box. The faint dashed ring marks the patch where the source makes nearly all its fluid, and the whirlpool has nearly all of its curl inside the same ring. The river's two faint lines are its banks, with still water beyond them. The wheel turns faster than a real one would, so that it's easy to see.
  • With Source chosen, drag the box to the very middle. Amber arrows leave through all four walls, and the top bar reads about \(+1.06\).
  • Now drag the box out to the left or right edge of the picture, well outside the dashed ring. Fluid is still streaming through it, in at the blue arrows and out at the amber ones, and the readout shows as much coming in as going out. The bar has fallen to \(0.00\). Nothing is being made out there.
  • Bring the box back to the middle, slide its side up to 2.4, then press Shrink the box. The reading starts near \(+0.47\), climbs, and settles at about \(+1.19\). Then slide the side back to about 1, so that the wheel is easy to see.
  • Choose Steady stream. Everything is moving, and both bars read zero wherever you put the box.
  • Choose River. Nothing here goes round in a circle. Put the box above the middle of the river, then below it, then exactly on the middle line, and watch the wheel each time.
  • Choose Whirlpool. In the middle the wheel spins. Drag it out to the left or right edge of the picture, well outside the dashed ring: the fluid still circles the centre, and the wheel stops. (This is a different flow from the whirlpool of the last lesson. More on that below.)
  • For each flow, choose "Light up where there is" divergence, then curl, and see whether the map agrees with what your probe found.
  • Mix your own: set the source to \(+1.0\) and the whirl to \(+1.0\), with the box at the middle. Both bars are lit. Now tick the steady stream. Neither reading changes.

Divergence: what a small box collects

Draw a small closed box in the flow and keep accounts. Each second some fluid leaves through the walls and some arrives. The net flow out is the first minus the second. If the fluid can't be squashed, a box can only send out more than it takes in when fluid is being added inside it, like a tap under the surface. So net outflow is a detector for sources.

A big box collects more than a small one, so divide by the box's area to get a fair figure. Then shrink the box round the point you care about, so that the answer is about that point and not a whole patch. You watched that ratio settle in the figure. The value it settles on is the divergence there:

\[ \text{divergence} = \frac{\text{net flow out of a small box}}{\text{area of the box}} \]

It's the same move as the derivative: a ratio that settles as something shrinks to nothing. Positive divergence marks a source and negative marks a sink. Zero means that whatever comes in goes out again, however fast it's moving. That was the steady stream.

The source in the figure taught something subtler. Outside the dashed ring its arrows still spread apart, and it's tempting to call that divergence. It isn't. The flow slows down as it spreads, by exactly enough that each box passes on what it receives. Divergence is about fluid being made, not about arrows fanning out.

"Net flow out through the walls" is a flux: the field through a surface, added up over it, as in line and surface integrals. In a flat picture the surface is the box's edge.

Where the formula comes from

Write the field as \(\mathbf{F} = (F_x, F_y)\): its sideways part and its upward part at each point. Close enough to any point, a smooth field is a steady part plus a part that changes evenly as you move. Four numbers say how it changes: how fast each of \(F_x\) and \(F_y\) grows in each of the directions \(x\) and \(y\). Those are the four partial derivatives. The next figure lets you set them and read each wall of the box on its own.

The flow very near one point, with a box 2 across and 2 high. Each arrow is the total through one wall (or, for the wheel, along it), and the sliders are the four partial derivatives of the flow.
  • As it starts, only \(\frac{\partial F_x}{\partial x}\) is set, at \(+0.5\). The right wall lets out \(2.2\) and the left wall lets \(0.2\) in, a pair worth \(+2.0\). Untick the steady stream: the walls change to \(+1.0\) and \(+1.0\), and the pair's total hasn't moved.
  • Slide \(\frac{\partial F_y}{\partial x}\) and \(\frac{\partial F_x}{\partial y}\) about. The flow changes shape, and not one wall's total moves. Set both back to 0.
  • Set \(\frac{\partial F_x}{\partial x} = +0.5\) and \(\frac{\partial F_y}{\partial y} = -0.5\). Fluid comes in through the top and bottom and is squeezed out sideways. The divergence is zero.
  • Switch to the wheel. The two sliders that mattered to the box now change nothing. Slide \(\frac{\partial F_y}{\partial x}\) up to \(+0.6\): the wheel turns anticlockwise. Then slide \(\frac{\partial F_x}{\partial y}\) up to \(+0.6\) as well, and it stops.

Here is the same thing in symbols. Take a box centred on the point \((x, y)\), with width \(\Delta x\) and height \(\Delta y\), small enough that the field hardly varies along any one wall.

Only the part of the flow that crosses a wall square on carries anything through it. At the right wall that part is \(F_x\). The wall's length is \(\Delta y\), so the flow out through it is \(F_x\) there, times \(\Delta y\).

\[ \text{right wall:}\quad F_x\!\left(x + \tfrac{\Delta x}{2},\, y\right)\Delta y \]

At the left wall, "out" means to the left, so a positive \(F_x\) there is flow coming in. That gives a minus sign.

\[ \text{left wall:}\quad -F_x\!\left(x - \tfrac{\Delta x}{2},\, y\right)\Delta y \]

Add the pair. What's left is the change in \(F_x\) from one side of the box to the other. Any steady part cancels.

\[ \left[F_x\!\left(x + \tfrac{\Delta x}{2},\, y\right) - F_x\!\left(x - \tfrac{\Delta x}{2},\, y\right)\right]\Delta y \]

A change over a short distance is the slope times the distance. The slope of \(F_x\) going sideways is \(\frac{\partial F_x}{\partial x}\), and the distance is \(\Delta x\).

\[ \text{right and left together} = \frac{\partial F_x}{\partial x}\,\Delta x\,\Delta y \]

The top and bottom walls work the same way, with \(F_y\) crossing them and \(y\) in place of \(x\).

\[ \text{top and bottom together} = \frac{\partial F_y}{\partial y}\,\Delta x\,\Delta y \]

Add all four walls, and divide by the box's area, \(\Delta x\,\Delta y\).

\[ \frac{\text{net flow out}}{\text{area}} = \frac{\partial F_x}{\partial x} + \frac{\partial F_y}{\partial y} \]
\[ \text{div}\,\mathbf{F} = \nabla\cdot\mathbf{F} = \frac{\partial F_x}{\partial x} + \frac{\partial F_y}{\partial y} \]

The symbol \(\nabla\) is the one from the gradient, the list of slopes \(\left(\frac{\partial}{\partial x}, \frac{\partial}{\partial y}\right)\). Treat it as if it were a vector and take its dot product with \(\mathbf{F}\) (multiply matching components and add), and you get exactly this sum. That's all the notation \(\nabla\cdot\mathbf{F}\) means. In three dimensions the box is a small cube, "area" becomes volume, and one more term joins the sum: \(\frac{\partial F_z}{\partial z}\).

Try it on \(\mathbf{F} = (x, y)\), a flow straight out from the origin that gets faster as it goes. \(\frac{\partial F_x}{\partial x} = 1\) and \(\frac{\partial F_y}{\partial y} = 1\), so the divergence is 2 everywhere. Fluid is being made at every point, which is the only way a flow can speed up as it spreads.

Curl: what turns a small wheel

Now the paddle wheel. Its paddles don't care about flow through the walls. They're pushed by the flow along the edge. Go round the box anticlockwise and add up the part of the field that points along your path. That's a line integral round a closed loop (again from line and surface integrals), and it has its own name, the circulation. If it comes to zero, the pushes on opposite paddles balance and the wheel stays still.

Divide by the area and shrink the box round the point, as before. What the ratio settles on is the curl there:

\[ \text{curl} = \frac{\text{flow round a small box's edge}}{\text{area of the box}} \]

Go up the right wall. The part of the field along your path is \(F_y\), and the wall's length is \(\Delta y\).

\[ \text{up the right wall:}\quad F_y\!\left(x + \tfrac{\Delta x}{2},\, y\right)\Delta y \]

Come down the left wall. Now you're travelling against \(F_y\), so it counts with a minus sign.

\[ \text{down the left wall:}\quad -F_y\!\left(x - \tfrac{\Delta x}{2},\, y\right)\Delta y \]

Together they leave the change in \(F_y\) from left to right, which is its sideways slope times \(\Delta x\).

\[ \text{right and left together} = \frac{\partial F_y}{\partial x}\,\Delta x\,\Delta y \]

Along the top you travel to the left, against \(F_x\). Along the bottom you travel to the right, with it. Each of those walls is \(\Delta x\) long.

\[ \text{top:}\quad -F_x\!\left(x,\, y + \tfrac{\Delta y}{2}\right)\Delta x \qquad \text{bottom:}\quad F_x\!\left(x,\, y - \tfrac{\Delta y}{2}\right)\Delta x \]

Together they leave minus the change in \(F_x\) from bottom to top, which is minus its upward slope times \(\Delta y\).

\[ \text{top and bottom together} = -\frac{\partial F_x}{\partial y}\,\Delta x\,\Delta y \]

Add the four walls and divide by the area.

\[ \frac{\text{flow round the edge}}{\text{area}} = \frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y} \]
\[ \text{curl}\,\mathbf{F} = \frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y} \qquad\qquad \text{positive means anticlockwise} \]

The two terms are the two ways to turn a wheel. If the upward flow is stronger on the right than on the left, the right-hand paddle is lifted harder, and the wheel turns anticlockwise. If the sideways flow is stronger at the top than at the bottom, the top paddle is pushed harder, and the wheel turns clockwise. That's why the second term has a minus sign.

This explains the two surprises in the first figure.

So curl isn't about whether the flow goes round something. It's about whether the flow would turn a small wheel placed at that point.

In three dimensions a wheel's axle can point any way, so the curl is a vector, written \(\nabla\times\mathbf{F}\) because its components follow the pattern of a cross product with \(\nabla\). It points along the axle of the wheel that spins fastest. The number in this lesson is its \(z\) part: the spin of a wheel whose axle sticks straight out of the page. The other two parts are built the same way from the other pairs of directions.

Divergence and curl are the language electricity and magnetism are written in. Charge is the source of the electric field \(\mathbf{E}\): its divergence \(\nabla\cdot\mathbf{E}\) is the density of charge at a point divided by a constant, which is Gauss's law. Nobody has ever found a magnetic charge, so the magnetic field \(\mathbf{B}\) has \(\nabla\cdot\mathbf{B} = 0\) everywhere, and its lines never start or stop. The curl of \(\mathbf{B}\) is set by electric currents, and by electric fields that are changing. And a magnetic field that changes in time gives the electric field a curl, which is induction, the way every generator works. Put the four together and you have Maxwell's equations.

Problems

Find the divergence and the curl of \(\mathbf{F} = (3x,\, -2y)\).

Answer

\(\frac{\partial F_x}{\partial x} = 3\) and \(\frac{\partial F_y}{\partial y} = -2\), so the divergence is \(3 - 2 = 1\).

\(\frac{\partial F_y}{\partial x} = 0\) and \(\frac{\partial F_x}{\partial y} = 0\), so the curl is \(0\). It stretches along \(x\) and squeezes along \(y\), but a little more comes out than goes in, and nothing turns.

Find the divergence and the curl of \(\mathbf{F} = (x^2,\, xy)\) at the point \((1, 2)\).

Answer

Divergence: \(\frac{\partial}{\partial x}x^2 + \frac{\partial}{\partial y}xy = 2x + x = 3x\), which is \(3\) at \((1, 2)\).

Curl: \(\frac{\partial}{\partial x}xy - \frac{\partial}{\partial y}x^2 = y - 0 = y\), which is \(2\) at \((1, 2)\). A wheel there turns anticlockwise.

Check the divergence the slow way. For \(\mathbf{F} = (2x,\, y)\), take the box with corners \((0, 0)\) and \((2, 1)\). Find the flow out through each of its four walls, add them, and divide by the box's area. Then compare with \(\frac{\partial F_x}{\partial x} + \frac{\partial F_y}{\partial y}\).

Answer

Right wall, at \(x = 2\): \(F_x = 4\) all along it, and the wall is 1 long, so \(4\) flows out.

Left wall, at \(x = 0\): \(F_x = 0\), so nothing crosses.

Top wall, at \(y = 1\): \(F_y = 1\), and the wall is 2 long, so \(2\) flows out.

Bottom wall, at \(y = 0\): \(F_y = 0\), so nothing crosses.

Net flow out is \(4 + 0 + 2 + 0 = 6\), and the area is \(2 \times 1 = 2\), so the ratio is \(3\). The formula gives \(2 + 1 = 3\). This field changes evenly, so the box didn't even need to be small.

A river flows as \(\mathbf{F} = (4 - y^2,\, 0)\), with banks at \(y = \pm 2\). Find its divergence, and its curl at \(y = 1\), \(y = 0\) and \(y = -1\). Which way does a paddle wheel turn at each?

Answer

Divergence: \(\frac{\partial}{\partial x}(4 - y^2) + \frac{\partial}{\partial y}0 = 0\). Water isn't being made anywhere.

Curl: \(\frac{\partial}{\partial x}0 - \frac{\partial}{\partial y}(4 - y^2) = 0 - (-2y) = 2y\). At \(y = 1\) it's \(+2\), anticlockwise. At \(y = 0\) it's \(0\), and the wheel drifts downstream without turning. At \(y = -1\) it's \(-2\), clockwise. On each side, the paddle nearer the middle of the river is the one pushed harder.

The source in the first figure, far from its middle, has the shape \(\mathbf{F} = \frac{(x,\; y)}{x^2 + y^2}\). Show that its divergence is zero everywhere except at the origin, where the formula breaks down. Then find the net flow out through a circle of radius \(r\) about the origin. You'll need the quotient rule.

Answer

By the quotient rule, \(\frac{\partial}{\partial x}\frac{x}{x^2 + y^2} = \frac{(x^2 + y^2) - x \cdot 2x}{(x^2 + y^2)^2} = \frac{y^2 - x^2}{(x^2 + y^2)^2}\). Swapping the letters, \(\frac{\partial}{\partial y}\frac{y}{x^2 + y^2} = \frac{x^2 - y^2}{(x^2 + y^2)^2}\). The two add up to zero.

On the circle, \(x^2 + y^2 = r^2\), so the arrow \((x, y)\), which has length \(r\), is divided by \(r^2\): the field points straight out with strength \(\frac{1}{r}\). The circle's edge is \(2\pi r\) long, so the flow out is \(\frac{1}{r} \times 2\pi r = 2\pi\).

That's the same for every circle, large or small. Everything that flows out is made at the one point in the middle, and nowhere else. The electric field round a charge behaves just like this, and it's the heart of Gauss's law.

Take the height \(h = x^2 y\) and find its gradient. Then find the curl of that gradient.

Answer

\(\nabla h = \left(\frac{\partial h}{\partial x},\, \frac{\partial h}{\partial y}\right) = (2xy,\; x^2)\).

Its curl is \(\frac{\partial}{\partial x}x^2 - \frac{\partial}{\partial y}2xy = 2x - 2x = 0\).

That isn't luck. The curl of any gradient is \(\frac{\partial}{\partial x}\frac{\partial h}{\partial y} - \frac{\partial}{\partial y}\frac{\partial h}{\partial x}\), and for a smooth function it doesn't matter in which order you take the two slopes. So a field that is the downhill direction of some landscape can never turn a wheel. The electric field of charges that aren't moving is one of those.

Learn more

An unhandled error has occurred. Reload ๐Ÿ—™