From Box Faces to Curved Boundaries
For a rectangular box, the divergence theorem follows by applying the Fundamental Theorem of Calculus in each coordinate direction. When boxes are joined, flux through each shared face cancels: the two boxes use opposite outward normals there. These facts explain the theorem for a union of boxes.
A curved boundary is not made of box faces. The remaining question is how to pass from the exact box calculation to a solid with a smooth or piecewise smooth boundary. The key is to approximate the solid by small boxes while keeping track of the oriented flux near its boundary. The boundary need not be approximated in a way that preserves its area.
For a vector field \(\mathbf F=(P,Q,R)\) whose component functions have continuous first partial derivatives on a neighborhood of \(E\), its divergence is \(\nabla\cdot\mathbf F=\frac{\partial P}{\partial x}+\frac{\partial Q}{\partial y}+\frac{\partial R}{\partial z}\). The flux across a smooth oriented surface \(S\) is the surface integral of \(\mathbf F\cdot\mathbf n\).
The boundary is oriented outward. Edges and corners do not have a unique normal, but they occupy zero surface area and do not affect the flux integral.
The Exact Starting Point: One Box
Consider a box \(B=[a,b]\times[c,d]\times[e,f]\). The two faces perpendicular to the \(x\)-axis contribute \(\int_c^d\int_e^f [P(b,y,z)-P(a,y,z)]\,dz\,dy\). By the one-variable Fundamental Theorem of Calculus, this is the integral of \(\frac{\partial P}{\partial x}\) over \(B\). Applying the same reasoning to the other pairs of faces gives
This identity is exact for every box. It is the local balance from which the more general result is built.
Worked Example: Flux Balance on a Box
Let \(B=[0,2]\times[0,1]\times[0,3]\) and \(\mathbf F=(x,y,z)\). Each component has a continuous first derivative, and \(\nabla\cdot\mathbf F=1+1+1=3\). The box has volume \(2\cdot1\cdot3=6\), so the volume integral is
Now compute the six face fluxes. On \(x=2\), the outward normal is \((1,0,0)\), so the flux is \(2\cdot(1\cdot3)=6\); on \(x=0\), it is \(0\). On \(y=1\), the flux is \(1\cdot(2\cdot3)=6\); on \(y=0\), it is \(0\). On \(z=3\), the flux is \(3\cdot(2\cdot1)=6\); on \(z=0\), it is \(0\). Thus the total boundary flux is \(6+0+6+0+6+0=18\), matching the volume integral.
As a check, the three pairs of opposite faces contribute \(2\), \(2\), and \(2\) units of net flux, respectively; their sum is \(6\), not \(18\). That would be incorrect because it omits the face areas. Including those areas gives the computed total \(18\).
Why Interior Faces Disappear
Suppose a box is divided into smaller boxes. Every face shared by two neighboring boxes is counted twice in the sum of their outward fluxes. On that face the field has the same values from either side, but the outward unit normals are opposites. Therefore the two contributions add to zero:
After all shared faces cancel, only faces on the outside of the union remain. The same cancellation explains why adding the box identities leaves the divergence integral over the whole union equal to its outer boundary flux. This is the crucial bookkeeping step; it is not an approximation.
Worked Example: Two Boxes and Their Shared Face
Join the unit boxes \(B_1=[0,1]\times[0,1]\times[0,1]\) and \(B_2=[1,2]\times[0,1]\times[0,1]\). Take \(\mathbf F=(x,0,0)\), so \(\nabla\cdot\mathbf F=1\).
On the shared face \(x=1\), \(B_1\)'s outward normal is \((1,0,0)\), giving flux \(1\cdot1=1\). The normal for \(B_2\) is \((-1,0,0)\), giving flux \(-1\cdot1=-1\). The shared-face total is \(1-1=0\).
The outer face \(x=0\) contributes \(0\), and \(x=2\) contributes \(2\cdot1=2\). All faces perpendicular to the \(y\)- or \(z\)-axis have zero flux because the corresponding components of \(\mathbf F\) are zero. The total outer flux is \(2\).
The joined solid has volume \(2\), so its divergence integral is \(1\cdot2=2\), agreeing with the outer flux. The check confirms both the sign of the shared-face contributions and the cancellation.
What Changes at a Smooth Boundary?
Subdivide space into cubes with side length \(h\). Cubes lying entirely inside \(E\) satisfy the exact box identity, and shared faces between them cancel. Cubes that meet \(\partial E\) are different: their faces do not reproduce the actual curved boundary. As \(h\) decreases, however, these boundary cubes become a finer approximation to it.
For a piecewise smooth boundary, the volume of the layer of such cubes tends to zero with \(h\). One way to see the scale is to use local graph descriptions of the boundary: a surface patch of finite area has a neighborhood of thickness proportional to \(h\) whose volume is proportional to \(h\). Consequently, the total volume of the boundary layer tends to zero. Since \(\nabla\cdot\mathbf F\) is continuous and bounded on the solid, the contribution of that layer to the volume integral tends to zero as well.
For flux, it is not enough to say that the boundary cubes are small. Their oriented faces must approximate the oriented surface. The local graph calculation below gives the reason this works. It also explains why the relevant quantity is flux, rather than surface area alone.
A Local Graph Calculation
Near a smooth boundary point, choose coordinates so the boundary is the graph \(z=g(x,y)\), with the solid locally below the graph. Let \(\mathbf F=(P,Q,R)\) be supported inside this coordinate patch, so contributions from the patch's vertical sides and lower end vanish. Integrate its divergence over the part of the solid below the graph.
For the \(x\)-derivative, the Fundamental Theorem of Calculus applied to the variable upper limit gives
The corresponding \(y\)-derivative contributes \(-\int\int Q(x,y,g(x,y))g_y(x,y)\,dx\,dy\). Integrating the \(z\)-derivative from the lower end, where the supported field vanishes, to \(g(x,y)\) contributes \(\int\int R(x,y,g(x,y))\,dx\,dy\). Adding these terms yields
for this localized field and boundary patch. The outward normal-area element for a solid below the graph is \(\mathbf n\,dS=(-g_x,-g_y,1)\,dx\,dy\). Therefore the right-hand side is precisely the flux across the graph. If the solid lies above the graph, both the outward orientation and the corresponding signs reverse.
Passing from Local Patches to the Whole Solid
A piecewise smooth boundary can be covered by finitely many graph patches. To apply the local calculation without counting overlapping patches more than once, choose smooth weights \(\phi_j\) supported in the patches and an interior-supported weight \(\phi_0\), with their sum equal to \(1\) near \(E\). Such a finite smooth partition of unity exists for a finite open cover of a compact region.
Apply the graph calculation to each boundary-supported field \(\phi_j\mathbf F\). Its divergence integral equals its outward flux on that patch.
The field \(\phi_0\mathbf F\) is supported away from the boundary. Its total divergence integral is zero, by integrating each partial derivative over space and using that the field vanishes outside its support.
Because the weights sum to \(1\), their fields sum to \(\mathbf F\). Their boundary fluxes add to the flux of \(\mathbf F\), and their divergence integrals add to the integral of \(\nabla\cdot\mathbf F\).
This proves the divergence theorem for a piecewise smooth solid. The box-subdivision viewpoint gives the same structure: interior contributions cancel, volume contributions fill the solid, and the oriented boundary contributions converge to the flux on its smooth patches.
Worked Example: A Solid Bounded by a Graph
Let \(E\) be the region above the square \([0,1]\times[0,1]\) in the \(xy\)-plane and below \(z=g(x,y)=1+x^2+y^2\). Let \(\mathbf F=(0,0,z)\). Its divergence is \(1\), so
On the top graph, the outward normal-area element is \((-2x,-2y,1)\,dx\,dy\). At the graph, \(\mathbf F=(0,0,1+x^2+y^2)\), so its flux there is
The bottom face has \(z=0\), so \(\mathbf F=\mathbf 0\) there and its flux is zero. Each vertical side has a horizontal normal, while \(\mathbf F\) is vertical, so all four side fluxes are zero. Thus the total boundary flux is \(5/3\), equal to the volume integral. This check exhibits the graph formula directly: only the component paired with the vertical component of the normal contributes.
A Common Mistake: Confusing Flux with Area
A staircase approximation to a sloped surface need not have an area approaching the surface's area. For example, the graph \(z=x\) over \(0\leq x\leq1\), \(0\leq y\leq1\) has area \(\sqrt{2}\). A staircase made from horizontal treads and vertical risers has total area \(1+1=2\), regardless of how finely it is subdivided.
It would therefore be wrong to argue that the staircase boundary converges because its area approaches \(\sqrt{2}\). It does not. For \(\mathbf F=(0,0,1)\), however, the true graph has flux \(1\): its upward normal-area element has vertical component \(1\,dx\,dy\). The staircase's horizontal treads have total upward projected area \(1\), while its vertical risers have zero flux because their normals have no vertical component. The flux still agrees.
Check Your Understanding
Use the box identity, cancellation, and local graph calculation to answer these questions.
- Why do the flux contributions from a shared face of two adjacent boxes sum to zero?
- Which property of a piecewise smooth boundary helps ensure that the volume of its boundary layer tends to zero as the box size decreases?
- For a solid lying below \(z=g(x,y)\), what is the outward normal-area element on the graph?
- Why can a staircase surface fail to approximate the area of a smooth surface while still giving the correct limiting flux?
- In the graph-bounded example, why do the vertical sides have zero flux for \(\mathbf F=(0,0,z)\)?