Why Cavities Change the Sign
A solid with a cavity has more than one boundary component. Its boundary includes the outside surface and the walls that enclose the empty region. The Divergence Theorem still applies, but its orientation rule applies to the solid itself: every normal must point outward from the solid.
On the outside surface, this is the familiar direction away from the enclosed region. On a cavity wall, moving outward from the solid takes you into the cavity. That direction is opposite to the normal that would point outward from the cavity considered as a solid of its own. This reversal gives the inner boundary its signed flux contribution.
Boundary Components and Their Normals
Let \(D\) be a solid formed from an outer solid \(O\) by removing the interiors of \(m\) disjoint cavities \(K_1,\ldots,K_m\). Assume each cavity is wholly inside \(O\), the cavity closures do not intersect one another, and the relevant boundaries are piecewise smooth. Write \(S_0=\partial O\) for the outer boundary and \(S_j=\partial K_j\) for the wall of cavity \(j\).
Let \(\mathbf{n}_0\) denote the usual outward unit normal on \(S_0\). On \(S_j\), let \(\mathbf{m}_j\) denote the usual outward unit normal for the cavity \(K_j\). The normal pointing outward from the remaining solid \(D\) on that same surface is \(-\mathbf{m}_j\).
For a vector field \(\mathbf{F}\), flux through an oriented surface \(S\) with unit normal \(\mathbf{n}\) is \(\iint_S \mathbf{F}\cdot\mathbf{n}\,dS\). Thus the flux of \(\mathbf{F}\) through the \(j\)th cavity wall with the orientation required for \(D\) is the negative of its flux when oriented outward from \(K_j\).
The Divergence Theorem for a Solid with Cavities
Suppose \(\mathbf{F}\) has continuous first partial derivatives on an open set containing the closure of \(D\), and the boundary of \(D\) is piecewise smooth. Let \(\mathbf{n}\) be the outward-from-\(D\) unit normal on every component. The Divergence Theorem states that the total outward flux across the entire boundary equals the integral of the divergence over the solid.
Because the boundary consists of the outer component and the cavity walls, the left side can also be written using their separate orientations:
The minus signs do not mean that inner fluxes are always negative numbers. They mean that each inner surface is oriented opposite to the cavity’s usual outward orientation. The value of the flux with that reversed orientation depends on the field and can be positive or negative.
Why the Inner Sign Is Reversed
The orientation can be understood by comparing the solid with the outer solid before its cavities are removed. For this comparison, suppose the field is smooth throughout \(O\), including the cavity interiors, so the Divergence Theorem can be applied separately to \(O\) and to each \(K_j\). Subtract the volume integrals over the cavities from the integral over \(O\). The remaining volume is \(D\). The corresponding boundary integrals subtract the cavity fluxes in their usual outward orientations.
\(\iiint_O \nabla\cdot\mathbf{F}\,dV=\iint_{S_0}\mathbf{F}\cdot\mathbf{n}_0\,dS.\)
\(\iiint_{K_j}\nabla\cdot\mathbf{F}\,dV=\iint_{S_j}\mathbf{F}\cdot\mathbf{m}_j\,dS.\)
Since the cavity interiors are removed from \(O\), subtracting their volume integrals leaves the integral over \(D\). Subtracting their boundary fluxes gives the minus signs on the inner surfaces.
In particular, the boundary orientation is not an extra convention chosen to make an equation work. It is the outward orientation of the actual region \(D\). The comparison above explains why that orientation gives the correct signs. The Divergence Theorem for \(D\) itself only requires the field to be defined and continuously differentiable near \(\overline D\); it does not require the field to extend smoothly through the cavity interiors.
Worked Example: A Concentric Spherical Cavity
Worked Example: Flux Through a Spherical Shell
Let \(D\) be the region between the spheres of radii \(1\) and \(2\), both centered at the origin. Find the outward flux of \(\mathbf{F}(x,y,z)=(x,y,z)\) across the entire boundary of \(D\), and check it using the Divergence Theorem.
The divergence is \(\nabla\cdot\mathbf{F}=1+1+1=3\). On the outer sphere, the outward normal is \(\mathbf{n}_0=(x,y,z)/2\), so \(\mathbf{F}\cdot\mathbf{n}_0=(x^2+y^2+z^2)/2=4/2=2\). The sphere has area \(4\pi(2^2)=16\pi\). Therefore its flux is \(2(16\pi)=32\pi\).
On the inner sphere, the outward-from-\(D\) normal points toward the origin: \(\mathbf{n}=-(x,y,z)\), since the radius is \(1\). Hence \(\mathbf{F}\cdot\mathbf{n}=-(x^2+y^2+z^2)=-1\). Its area is \(4\pi(1^2)=4\pi\), so its signed contribution is \((-1)(4\pi)=-4\pi\). The total boundary flux is \(32\pi-4\pi=28\pi\).
For the volume check, the shell volume is \(\frac{4\pi}{3}(2^3-1^3)=\frac{28\pi}{3}\). Thus the divergence integral is \(3\left(\frac{28\pi}{3}\right)=28\pi\), agreeing with the boundary calculation.
Worked Example: An Off-Center Cavity
Worked Example: An Affine Field on a Spherical Solid with a Cavity
Let \(D\) be the ball of radius \(3\) centered at the origin with the ball of radius \(1\) centered at \((1,0,0)\) removed. For \(\mathbf{F}(x,y,z)=(2x,y,z)\), compute the total outward flux, showing the contributions from the outer and inner boundaries.
The divergence is \(2+1+1=4\). On the outer sphere, whose radius is \(R=3\), the outward unit normal is \((x,y,z)/R\), so the flux integrand is \((2x^2+y^2+z^2)/R\). By symmetry, the three integrals of \(x^2,y^2,z^2\) over this sphere are equal. Their sum is \(\iint (x^2+y^2+z^2)\,dS=R^2(4\pi R^2)=4\pi R^4\), so each integral is \(4\pi R^4/3\). Therefore the outer flux is \((2+1+1)(4\pi R^4/3)/R=16\pi R^3/3=144\pi\).
For the cavity, write a point on its unit sphere as \((x,y,z)=(1,0,0)+(u_x,u_y,u_z)\), where \(u_x^2+u_y^2+u_z^2=1\). The usual outward normal from the cavity is \(\mathbf{m}=(u_x,u_y,u_z)\). The field there is \((2+2u_x,u_y,u_z)\), giving \(\mathbf{F}\cdot\mathbf{m}=2u_x+2u_x^2+u_y^2+u_z^2=2u_x+1+u_x^2\). The integral of \(u_x\) over the sphere is zero by symmetry, the integral of \(1\) is \(4\pi\), and the integral of \(u_x^2\) is one third of the integral of \(u_x^2+u_y^2+u_z^2=1\), hence \(4\pi/3\). The cavity’s usual outward flux is \(4\pi+4\pi/3=16\pi/3\). The normal for \(D\) is \(-\mathbf{m}\), so the inner contribution is \(-16\pi/3\).
The total boundary flux is \(144\pi-16\pi/3=416\pi/3\). As a check, the volume of \(D\) is \(\frac{4\pi}{3}(3^3-1^3)=104\pi/3\), and the divergence integral is \(4(104\pi/3)=416\pi/3\). The results agree.
Worked Example: Two Separate Cavities
Worked Example: Keeping Track of Multiple Inner Components
Take the ball of radius \(3\) centered at the origin and remove two disjoint balls: one of radius \(1\) centered at \((1,0,0)\), and one of radius \(1/2\) centered at \((-1,0,0)\). For \(\mathbf{F}(x,y,z)=(x,y,z)\), compute the total outward flux.
The divergence is \(3\). The outer sphere has radius \(3\); there, \(\mathbf{F}\cdot\mathbf{n}=3\), so its flux is \(3\cdot 4\pi(3^2)=108\pi\). For a cavity of radius \(r\) centered at \(\mathbf{c}\), write a point on its surface as \(\mathbf{c}+\mathbf{u}\), where \(|\mathbf{u}|=r\). Its usual outward normal is \(\mathbf{u}/r\), and \(\mathbf{F}\cdot(\mathbf{u}/r)=(\mathbf{c}+\mathbf{u})\cdot\mathbf{u}/r=\mathbf{c}\cdot\mathbf{u}/r+r\). The first term integrates to zero by symmetry, leaving \(r\cdot4\pi r^2=4\pi r^3\). The outward-from-the-solid flux is the negative of this value.
For the radius-\(1\) cavity, the signed contribution is \(-4\pi(1^3)=-4\pi\). For the radius-\(1/2\) cavity, it is \(-4\pi(1/2)^3=-\pi/2\). Thus the total boundary flux is \(108\pi-4\pi-\pi/2=207\pi/2\).
The volume of the remaining solid is \(\frac{4\pi}{3}(27-1-\frac18)=\frac{4\pi}{3}\cdot\frac{207}{8}=\frac{69\pi}{2}\). Multiplying by the divergence gives \(3(69\pi/2)=207\pi/2\), which checks the flux sum.
A Common Sign Error
A frequent mistake is to orient a cavity wall as if the cavity itself were the solid. For example, in the spherical shell example, using the cavity’s usual outward normal would give \(+4\pi\) instead of the required \(-4\pi\). That would produce a claimed total flux of \(32\pi+4\pi=36\pi\), which does not equal the divergence integral \(28\pi\).
The correction is to ask, at each boundary component, which direction points out of the material region being studied. On the inner sphere, that direction points into the hole, so it is the negative of the cavity’s usual outward normal. A reliable setup writes the total as outer flux minus the usual outward fluxes of the cavities, then checks the result against the divergence integral.
Check Your Understanding
Use the orientation rule and the Divergence Theorem to answer these questions.
- In which direction does the outward-from-the-solid normal point on a cavity wall?
- How is the signed flux on a cavity wall related to the flux using the cavity’s usual outward normal?
- For a solid with two cavities, how should the boundary flux be organized?
- Why can an inner boundary contribution not be assumed negative just because it is an inner boundary?
- What volume integral provides a check on the total boundary flux?