Section 2.2 · Topic 3 of 8

2.2.3 Divergence

Interactive: Vector Field Explorer

Think of a vector field as the velocity of a flowing fluid, and draw a small imaginary box somewhere in the flow (Figure 2.2.4). Count what flows out of the box and subtract what flows in. If the result is positive, fluid is being created inside the box: there is a spring, a source. If it is negative, there is a drain, a sink. If it is zero, everything that enters also leaves. The divergence is exactly this "net outflow", measured per unit volume of the box.

Four computed vector fields and a small box (dashed) in each. (a) \vec A=x\,\vec a_x+y\,\vec a_y: everything flows out of the box (a source). (b) \vec A=-x\,\vec a_x-y\,\vec a_y: everything flows in (a sink). (c) \vec A=x\,\vec a_x-y\,\vec a_y: the flow enters through the top and bottom and leaves through the sides. What enters equals what leaves, so the divergence is zero although the field is far from uniform. (d) \vec A=(x+1.15)\,\vec a_x: parallel arrows, but they grow in the direction in which they point, so more leaves through the right face than enters through the left (a source again). The divergence values follow from (2.2.6).
Figure 2.2.4. Four computed vector fields and a small box (dashed) in each. (a) : everything flows out of the box (a source). (b) : everything flows in (a sink). (c) : the flow enters through the top and bottom and leaves through the sides. What enters equals what leaves, so the divergence is zero although the field is far from uniform. (d) : parallel arrows, but they grow in the direction in which they point, so more leaves through the right face than enters through the left (a source again). The divergence values follow from (2.2.6).

Flux through a small surface

To turn "what flows through a surface" into mathematics we need the notion of flux. The flux of a vector field through a small surface element of area with unit normal is

where is the angle between and . Only the normal component of the field crosses the surface (Figure 2.2.5). For the velocity field of a fluid, is the volume of fluid flowing through per second. For a closed surface we always choose pointing outward, so that the total flux is the net amount "flowing out" of the enclosed volume: positive if more leaves than enters.

Flux through a small surface element of area dS (seen edge-on, blue) in a uniform field \vec A (orange lines). (a) The normal \vec a_n is parallel to \vec A: the element catches the largest number of field lines. (b) \vec a_n\perp\vec A: the field slides along the element and nothing crosses it. (c) In between, the element catches only the lines that cross its projection dS\cos\theta on a plane perpendicular to \vec A. Hence d\Psi=\vec A\cdot d\vec S=A\,dS\cos\theta.
Figure 2.2.5. Flux through a small surface element of area (seen edge-on, blue) in a uniform field (orange lines). (a) The normal is parallel to : the element catches the largest number of field lines. (b) : the field slides along the element and nothing crosses it. (c) In between, the element catches only the lines that cross its projection on a plane perpendicular to . Hence .
Definition · Divergence

The divergence of a vector field at a point is the net outward flux of per unit volume, as the volume about the point tends to zero:

where is the closed surface bounding the small volume .

From the definition to the formula: a small box

Let us evaluate (2.2.5) for a small rectangular box centred at , with edges , , parallel to the axes (Figure 2.2.6). The plan has three steps: (1) the flux through the two faces perpendicular to the -axis, (2) the same for the other two pairs of faces, and (3) divide by the volume and shrink the box.

Step 1. Consider first the two faces perpendicular to the -axis. On them only is normal to the surface, so only contributes.

  • On the face at the outward normal is . For a small face we may take the field at its centre:

  • On the opposite face, at , the outward normal is , so the flux carries a minus sign:

Expanding in a Taylor series about the centre,

the values at the centre cancel in the sum of the two face fluxes and the two half-differences add up:

Step 2. The pairs of faces perpendicular to and to give, in exactly the same way, and .

Step 3. Adding the three pairs, dividing by , and letting the box shrink to the point (the neglected higher-order terms vanish in the limit) we obtain

Divergence in Cartesian coordinates

This is also what we get by formally "multiplying out" the dot product of (2.2.1) with , with each derivative acting on the component that stands next to it. The formula is therefore not a definition by itself but a consequence of the physical definition (2.2.5). The divergence turns a vector field into a scalar field.

A small box centred at \mathrm P(x_0,y_0,z_0). Through the face at x_0+\Delta x/2 (outward normal \vec a_x) the flux is A_x(x_0+\Delta x/2)\,\Delta y\Delta z, and through the hidden face at x_0-\Delta x/2 (outward normal -\vec a_x) it is -A_x(x_0-\Delta x/2)\,\Delta y\Delta z. Their sum is (\partial A_x/\partial x)\,\Delta x\Delta y\Delta z. Here the field leaving is stronger than the field entering, so this pair of faces contributes a positive net outward flux.
Figure 2.2.6. A small box centred at . Through the face at (outward normal ) the flux is , and through the hidden face at (outward normal ) it is . Their sum is . Here the field leaving is stronger than the field entering, so this pair of faces contributes a positive net outward flux.
Physical picture

A positive divergence at a point means that more flux leaves an infinitesimal neighbourhood of the point than enters it: the point is a source of the field. A negative divergence marks a sink, and a zero divergence means that as much enters as leaves. A field whose divergence is zero everywhere is called solenoidal. Note that a field can have non-zero divergence without "spreading out" visibly: has parallel field lines, yet because the field grows in the direction in which it points, so each box lets out more than it takes in (Figure 2.2.4d and the middle picture of Figure 2.2.10).

In plain words

The divergence answers "is something being produced here?". Put a tiny box around the point and count the flux going out minus the flux coming in, per unit volume. Only the change of each component along its own direction matters: , , .

Move the probe box around the source field below: the net outflow divided by the size of the box is the same everywhere (the divergence is at every point), not only at the origin where the arrows seem to start. Then switch to the other fields and compare with Figure 2.2.4.

InteractiveLoading simulation…

The divergence has the unit of the field divided by metres. In Section 3.2 we shall find that the sources of the electric flux density are the charges, : the divergence of the field is the volume charge density at that point.

Quick check

Find the divergence of the uniform field and of . Which one is a source?

: a uniform flow enters and leaves each box equally. : although its lines are parallel too, this field is a source everywhere, because it grows along its own direction.

Common mistake

Giving the divergence as a vector, for example The dot product produces a scalar: the three derivatives are simply added. Another frequent slip is differentiating a component with respect to the wrong variable (e.g. ). In the divergence each component is differentiated only with respect to its own coordinate.

← Back to Section 2.2 contents

Electromagnetic Fields and Waves · Prof. Gökhan Çınar© 2026 Gökhan Çınar. All rights reserved. Copyright