Section 2.4 · Topic 2 of 5
2.4.2 The divergence (Gauss's) theorem
The divergence was defined in Eq. (2.3.51) as the outward flux per unit volume of an infinitesimal volume. The divergence theorem extends this local statement to a region of finite size.
Let be a volume bounded by the closed surface , with pointing outwards from , and let have continuous first derivatives in . Then
In words: the net outward flux of a vector field through a closed surface equals the volume integral of its divergence over the region enclosed by the surface.

Think of as the velocity of water and of as a region of a pool with some taps (sources, ) and drains (sinks, ) in it. Water is neither created nor destroyed anywhere else, so the net amount flowing out through the walls of the region per second must equal what the taps inside deliver minus what the drains inside swallow. The left side of Eq. (2.4.2) measures the flow through the walls, and the right side adds up the taps and drains.
Why it is true
Divide into a large number of small cells (Figure 2.4.4). By the definition (2.3.51), the outward flux from each cell is , to first order. Now add the fluxes of all the cells. Every interior face is shared by two neighbouring cells, and its outward normal for one cell is the inward normal for the other: the flux leaving one cell through that face enters its neighbour, and the two contributions cancel exactly (panel b). Only the faces that lie on the outer surface have no partner, so the sum of all cell fluxes is the flux through :
Try it yourself: drag and resize the loop in the source field below. The outward flux through the boundary and the integral of the divergence over the enclosed area agree for every shape and position.
Meaning
The divergence measures the strength of the sources (positive divergence) and sinks (negative divergence) of a field at each point. The theorem says that what flows out through the boundary is exactly what is produced inside. If a field is divergence-free in a region, its net flux through every closed surface that encloses only points of that region is zero: whatever enters also leaves (the Remark below shows why the enclosed volume, not just the surface, must lie in the region). In electrostatics this theorem is the bridge between the integral form of Gauss's law (a statement about the flux through a closed surface) and its differential form (a statement about the divergence at a point), see Section 3.2. The theorem is also an important computational tool: a surface integral over six faces of a box may be replaced by a single volume integral, or vice versa.
The hypothesis that be continuously differentiable throughout matters. The field of the Physical picture in Section 2.3.10 has zero divergence everywhere except at the origin, yet its flux through a sphere centred at the origin is , not . There is no contradiction: the field is singular at the origin, which lies inside , so the theorem in the form (2.4.2) does not apply to that volume. The entire flux originates from the singular point, which is the mathematical model of a point charge.
The same effect can be seen in the plane with the field , the two-dimensional analogue of : its divergence is zero away from the origin, yet every loop that encloses the origin has outward flux . Move the loop on and off the singular point.
Using an inward on part of the surface, or forgetting a face (all six faces for a box, the side and both lids for a cylinder). The divergence theorem needs the closed surface with pointing outwards everywhere.
- Sketch the region and its boundary, and fix the orientation ( outwards for a closed surface, right-hand rule between and for Stokes).
- Derivative side: compute or in the system that fits the region, and integrate it with the proper or .
- Boundary side: split the boundary into smooth pieces (faces, sides, arcs), write or on each piece, evaluate the dot product, integrate, and add the pieces.
- Compare the two numbers. If they differ, re-check orientations and missing pieces first.
Use the divergence theorem and to find the outward flux of the position vector through a sphere of radius centred at the origin. Check the result directly.
. Directly: on the sphere , so the flux is .