Multivariable CalculusSurface Integrals5 of 6
Surface Integrals · 5

The Divergence Theorem

We need to find the outward flux of a 3D vector field across a surface without setting up a separate surface integral for every face or curved wall.

1

Flux Equals Total Source Inside

The outward flux across a closed boundary equals the total fluid generated by all the sources and drains inside the region.

Flux Equals Total Source Inside
F\htmlClass{lc-blue}{\mathbf{F}}

Because fluid cannot appear out of nowhere, whatever is pumped in by faucets or removed by drains inside an enclosed space has to cross the outer walls:

Total Flux through the outside\displaystyle \flux{\text{Total Flux through the outside}} =Total Source on the inside\displaystyle = \source{\text{Total Source on the inside}}

Moving a faucet or drain anywhere inside the box changes which wall the water exits through without changing the total outward flux at all. The total flux changes only when a faucet or drain crosses the boundary wall to the outside.

Moving a faucet or drain inside only shifts which walls the water crosses, while dragging one outside changes the total flux.
2

Divergence as Faucet Strength at a Point

Instead of a list of faucets, we are given a vector field F=⟨P,Q,R⟩\field{\mathbf{F} = \langle P, Q, R \rangle}. The divergence of F\field{\mathbf{F}} measures the faucet strength at any single point by adding the rates at which the flow speeds up in the xx, yy, and zz directions.

Divergence as Faucet Strength at a Point
F=⟨P,Q,R⟩\field{\mathbf{F} = \langle P, Q, R \rangle}
x\htmlClass{lc-mute}{x}
y\htmlClass{lc-mute}{y}
z\htmlClass{lc-mute}{z}

Comparing opposite walls of a tiny box in all three directions gives the total expansion rate at that point:

div F\displaystyle \source{\text{div}\,\mathbf{F}} =∇⋅F\displaystyle = \source{\nabla \cdot \mathbf{F}} =∂P∂x+∂Q∂y+∂R∂z⏟faucet strength at (x,y,z)\displaystyle = \underbrace{\source{\frac{\partial P}{\partial x} + \frac{\partial Q}{\partial y} + \frac{\partial R}{\partial z}}}_{\source{\text{faucet strength at }(x,y,z)}}

A positive divergence (∇⋅F>0\source{\nabla \cdot \mathbf{F} > 0}) means fluid is expanding out of that point like a faucet, while a negative divergence (∇⋅F<0\source{\nabla \cdot \mathbf{F} < 0}) means fluid is compressing into it like a drain. For F=⟨2x,3y,z⟩\field{\mathbf{F} = \langle 2x, 3y, z \rangle}, adding the three partial derivatives gives a constant faucet strength everywhere in space:

∇⋅F\displaystyle \source{\nabla \cdot \mathbf{F}} =∂∂x(2x)+∂∂y(3y)+∂∂z(z)\displaystyle = \source{\frac{\partial}{\partial x}}(\field{2x}) + \source{\frac{\partial}{\partial y}}(\field{3y}) + \source{\frac{\partial}{\partial z}}(\field{z}) =2+3+1=6\displaystyle = \source{2 + 3 + 1 = 6}
3

Why Interior Walls Cancel: The Divergence Theorem

Now let's connect the faucet strength at a single point to the flux across a large 3D shape. The Divergence Theorem says we can find the outward flux of F\field{\mathbf{F}} across a closed surface SS by integrating the divergence ∇⋅F\source{\nabla \cdot \mathbf{F}} over the solid region EE inside.

Why Interior Walls Cancel: The Divergence Theorem
AA
BB

When we chop the solid into tiny boxes, the flux going out of one box into a neighbor is the exact opposite of the flux going from that neighbor back in. Every shared interior wall cancels out, leaving only the outer boundary SS:

∬Sclosed outwardsurfaceF⋅n dS\displaystyle \iint_{\substack{S \\ \text{closed outward} \\ \text{surface}}} \flux{\mathbf{F} \cdot \mathbf{n}}\,dS =∭Esolidinterior∇⋅F dV\displaystyle = \iiint_{\substack{E \\ \text{solid} \\ \text{interior}}} \source{\nabla \cdot \mathbf{F}}\,dV

In this formula, n\mathbf{n} always points outward because positive divergence (∇⋅F>0\source{\nabla \cdot \mathbf{F} > 0}) pushes fluid out of the region. If a problem asks for the inward flux instead, compute the outward flux with the theorem as usual and flip the sign of the answer at the end.

Whenever an interior wall splits the 3D region in two, the flux leaving one piece across that wall cancels the flux leaving the other, so interior walls always cancel to zero and only the outer boundary remains.

Wherever an inside wall splits a region, the flow leaving one piece equals the flow entering the other, so the shared wall always cancels out.
4

Constant Divergence: Flux Through a Sphere

First, let's find the outward flux of F=⟨2x,3y,z⟩\field{\mathbf{F} = \langle 2x, 3y, z \rangle} through the surface of a sphere of radius R=3R = 3:

∬S⟨2x,3y,z⟩⋅n dS\displaystyle \iint_S \field{\langle 2x, 3y, z \rangle} \cdot \mathbf{n}\,dS
Constant Divergence: Flux Through a Sphere
F=⟨2x,3y,z⟩\field{\mathbf{F} = \langle 2x, 3y, z \rangle}
∬SF⋅n dS=  ?\iint_S \flux{\mathbf{F} \cdot \mathbf{n}}\, dS = \;?
x\htmlClass{lc-mute}{x}
y\htmlClass{lc-mute}{y}
z\htmlClass{lc-mute}{z}
R=3R = 3
Text solution
Switch from the surface to the volume insideInstead of parametrizing the sphere in spherical coordinates, we integrate the divergence ∇⋅F=2+3+1=6\source{\nabla \cdot \mathbf{F} = 2 + 3 + 1 = 6} over the solid sphere EE.
Flux\displaystyle \flux{\text{Flux}} =∬SF⋅n dS\displaystyle = \iint_S \flux{\mathbf{F} \cdot \mathbf{n}}\,dS =∭E6 dV\displaystyle = \iiint_E \source{6}\,dV
Factor out the constant and multiply by the sphere's volumeBecause every unit of volume pumps out 6\source{6} units of fluid, we pull 6\source{6} out front and multiply by the volume of a sphere of radius 33.
Flux\displaystyle \flux{\text{Flux}} =6∭E1 dV\displaystyle = \source{6} \iiint_E 1\,dV =6×(43π×33)\displaystyle = \source{6} \times \left(\frac{4}{3}\pi \times 3^3\right) =6×36π\displaystyle = \source{6} \times 36\pi =216π\displaystyle = 216\pi

So the total outward flux through the sphere is 216π216\pi.

5

Variable Divergence in a Cylinder

Now let's see what happens when the vector field has extra terms that don't affect the divergence and the faucet strength changes from point to point. We want to find the outward flux of

F=⟨xy2+sin⁡(yz),  yx2+exz,  z(x2+y2)+cos⁡(xy)⟩\displaystyle \field{\mathbf{F} = \left\langle xy^2 + \sin(yz),\; yx^2 + e^{xz},\; z(x^2 + y^2) + \cos(xy) \right\rangle}

through the closed cylinder x2+y2≤4x^2 + y^2 \le 4, 0≤z≤50 \le z \le 5.

Variable Divergence and Decoy Terms in a Cylinder
F=⟨xy2+sin⁡(yz),yx2+exz,z(x2+y2)+cos⁡(xy)⟩\field{\mathbf{F} = \left\langle \begin{aligned} &xy^2 + \sin(yz), \\ &yx^2 + e^{xz}, \\ &z(x^2 + y^2) + \cos(xy) \end{aligned} \right\rangle}
Flux=  ?\flux{\text{Flux}} = \;?
x\htmlClass{lc-mute}{x}
y\htmlClass{lc-mute}{y}
z\htmlClass{lc-mute}{z}
x2+y2≤4x^2 + y^2 \le 4
0≤z≤50 \le z \le 5
Text solution
Take the divergence to clear out the terms that don't changeEach partial derivative checks how fast a component changes along its own direction, so terms missing that variable pass straight through the box unchanged and drop out.
∇⋅F\displaystyle \source{\nabla \cdot \mathbf{F}} =∂∂x(xy2+sin⁡(yz)⏟no x)+∂∂y(yx2+exz⏟no y)+∂∂z(z(x2+y2)+cos⁡(xy)⏟no z)\displaystyle = \source{\frac{\partial}{\partial x}}\bigl(\field{xy^2} + \underbrace{\field{\sin(yz)}}_{\text{no }x}\bigr) + \source{\frac{\partial}{\partial y}}\bigl(\field{yx^2} + \underbrace{\field{e^{xz}}}_{\text{no }y}\bigr) + \source{\frac{\partial}{\partial z}}\bigl(\field{z(x^2 + y^2)} + \underbrace{\field{\cos(xy)}}_{\text{no }z}\bigr) =y2+x2+(x2+y2)=2(x2+y2)\displaystyle = \source{y^2 + x^2 + (x^2 + y^2) = 2(x^2 + y^2)}
Set up the triple integral in cylindrical coordinatesSince the divergence grows from zero on the center zz-axis toward the outer wall, we integrate over the cylinder using x2+y2=r2\convert{x^2 + y^2 = r^2} and dV=r dz dr dθdV = r\,dz\,dr\,d\theta.
Flux\displaystyle \flux{\text{Flux}} =∫02π∫02∫05(2r2)⋅r dz dr dθ\displaystyle = \int_0^{2\pi} \int_0^2 \int_0^5 \source{(2r^2)} \cdot r\,dz\,dr\,d\theta =∫02π∫02∫052r3 dz dr dθ\displaystyle = \int_0^{2\pi} \int_0^2 \int_0^5 2r^3\,dz\,dr\,d\theta
Integrate from the inside outWith no zz in the integrand, the zz integral from 00 to 55 multiplies by 55, and then we integrate with respect to rr and θ\theta.
Flux\displaystyle \flux{\text{Flux}} =∫02π∫0210r3 dr dθ\displaystyle = \int_0^{2\pi} \int_0^2 10r^3\,dr\,d\theta =∫02π[10r44]02dθ\displaystyle = \int_0^{2\pi} \left[\frac{10r^4}{4}\right]_0^2 d\theta =∫02π40 dθ\displaystyle = \int_0^{2\pi} 40\,d\theta =40×2π\displaystyle = 40 \times 2\pi =80π\displaystyle = 80\pi

So the outward flux through the closed cylinder is 80π80\pi.

Inside the cylinder, those unchanging terms give zero net flux through any tiny box, while the remaining outward expansion is zero on the center zz-axis and grows stronger toward the outer wall.

Flow passing straight through the box always cancels out on opposite walls, while outward expansion starts at zero on the center axis and grows stronger toward the side wall.
6

Closing an Open Surface with a Flat Disk

The Divergence Theorem only works on a completely closed surface, because if a side is missing, water generated inside can escape through the opening without crossing the surface. Suppose we want the downward, outward flux of

F=⟨x+sin⁡(y),  y+cos⁡(z),  z+x2+y2⟩\displaystyle \field{\mathbf{F} = \langle x + \sin(y),\; y + \cos(z),\; z + x^2 + y^2 \rangle}

through the curved surface of the lower hemisphere x2+y2+z2=4x^2 + y^2 + z^2 = 4, z≤0z \le 0, which is open at the top at z=0\disk{z = 0}.

Closing an Open Surface with a Flat Disk
x2+y2+z2=4, z≤0x^2 + y^2 + z^2 = 4,\ z \le 0
F=⟨x+sin⁡y, y+cos⁡z, z+x2+y2⟩\field{\mathbf{F} = \langle x + \sin y,\ y + \cos z,\ z + x^2 + y^2 \rangle}
∬hemisphereF⋅n dS=  ?\iint_{\text{hemisphere}} \flux{\mathbf{F} \cdot \mathbf{n}}\, dS = \;?
x\htmlClass{lc-mute}{x}
y\htmlClass{lc-mute}{y}
z\htmlClass{lc-mute}{z}
z=0z = 0
n\mathbf{n}
Text solution
Close the open top with a flat disk and find the total fluxAdding the flat circular disk at z=0\disk{z = 0} encloses the solid hemisphere EE of radius 22, where ∇⋅F=1+1+1=3\source{\nabla \cdot \mathbf{F} = 1 + 1 + 1 = 3} is constant.
∬HemisphereF⋅n dS⏟What we want+∬DiskF⋅n dS⏟Easy flat surface\displaystyle \underbrace{\iint_{\text{Hemisphere}} \flux{\mathbf{F} \cdot \mathbf{n}}\,dS}_{\text{What we want}} + \underbrace{\iint_{\disk{\text{Disk}}} \flux{\mathbf{F} \cdot \mathbf{n}}\,dS}_{\text{Easy flat surface}} =∭E∇⋅F dV⏟Total Faucets Inside\displaystyle = \underbrace{\iiint_E \source{\nabla \cdot \mathbf{F}}\,dV}_{\source{\text{Total Faucets Inside}}} =3×(23π×23)\displaystyle = \source{3} \times \left(\frac{2}{3}\pi \times 2^3\right) =16π\displaystyle = 16\pi
Compute the outward flux through the flat diskOn the top disk at z=0\disk{z = 0}, pointing out of the enclosed hemisphere means pointing straight up with n=⟨0,0,1⟩\mathbf{n} = \langle 0, 0, 1 \rangle, which picks out the zz-component at z=0\disk{z = 0}.
F⋅⟨0,0,1⟩\displaystyle \flux{\mathbf{F} \cdot \langle 0, 0, 1 \rangle} =z+x2+y2\displaystyle = \field{z + x^2 + y^2} =x2+y2(at z=0)\displaystyle = x^2 + y^2 \quad (\text{at } \disk{z = 0})
Flux through Disk\displaystyle \flux{\text{Flux through Disk}} =∬Disk(x2+y2) dA\displaystyle = \iint_{\disk{\text{Disk}}} (x^2 + y^2)\,dA =∫02π∫02r2⋅r dr dθ\displaystyle = \int_0^{2\pi} \int_0^2 r^2 \cdot r\,dr\,d\theta =2π[r44]02\displaystyle = 2\pi \left[\frac{r^4}{4}\right]_0^2 =2π(4)\displaystyle = 2\pi(4) =8π\displaystyle = 8\pi
Subtract the disk's flux from the totalOut of the 16π16\pi total leaving the closed shape, 8π8\pi escapes out the top disk, so the rest exits through the hemisphere.
Flux through Hemisphere\displaystyle \flux{\text{Flux through Hemisphere}} =16π−8π\displaystyle = 16\pi - 8\pi =8π\displaystyle = 8\pi

So the downward, outward flux through the open hemisphere is 8π8\pi.

Key concepts

Whenever you need to find the 3D flux ∬SF⋅n dS\iint_S \flux{\mathbf{F} \cdot \mathbf{n}}\,dS, check whether the surface SS is closed before parametrizing anything. On a closed surface, the Divergence Theorem replaces the surface integral with the total faucet strength inside the solid volume EE:

∬SF⋅n dS\displaystyle \iint_S \flux{\mathbf{F} \cdot \mathbf{n}}\,dS =∭E(∂P∂x+∂Q∂y+∂R∂z)dV\displaystyle = \iiint_E \left(\source{\frac{\partial P}{\partial x} + \frac{\partial Q}{\partial y} + \frac{\partial R}{\partial z}}\right) dV

Taking the divergence immediately clears away terms that don't depend on their own coordinate, like sin⁡(yz)\field{\sin(yz)} in P\field{P} or cos⁡(xy)\field{\cos(xy)} in R\field{R}. From there, look at what remains of ∇⋅F\source{\nabla \cdot \mathbf{F}}:

Key concept

If ∇⋅F\source{\nabla \cdot \mathbf{F}} is a constant (such as ∇⋅⟨2x,3y,z⟩=6\source{\nabla \cdot \field{\langle 2x, 3y, z \rangle} = 6}), skip the integral and multiply that constant by the solid's volume.

Key concept

If ∇⋅F\source{\nabla \cdot \mathbf{F}} depends on position (such as 2(x2+y2)=2r2\source{2(x^2 + y^2) = 2r^2} inside a cylinder), integrate it over the 3D solid, remembering the extra rr in dV=r dz dr dθdV = r\,dz\,dr\,d\theta for cylindrical coordinates.

Key concept

Because faucets push fluid out, the theorem always gives outward flux; if a question asks for inward flux, flip the sign at the very end.

When not to use the theorem directly: If the surface is open (such as the lower hemisphere x2+y2+z2=4x^2 + y^2 + z^2 = 4, z≤0z \le 0 with an open top at z=0\disk{z = 0}), fluid escapes out the opening, so ∭E∇⋅F dV\iiint_E \source{\nabla \cdot \mathbf{F}}\,dV does not equal the flux through the curved surface alone. Close the opening with a flat disk first, find ∭E∇⋅F dV\iiint_E \source{\nabla \cdot \mathbf{F}}\,dV for the combined closed surface, and subtract the surface integral over the flat disk (using the normal n\mathbf{n} that points out of the enclosed solid, like ⟨0,0,1⟩\langle 0, 0, 1 \rangle on a top disk at z=0\disk{z = 0}).

7

Practice

1

Find the outward flux of F=⟨3x,−y,2z⟩\field{\mathbf{F} = \langle 3x, -y, 2z \rangle} through the surface of the sphere x2+y2+z2=9x^2 + y^2 + z^2 = 9.

Find the faucet strength ∇⋅F\source{\nabla \cdot \mathbf{F}} first. Do you need to set up an integral if it is constant?

Take the divergence of F\field{\mathbf{F}}:
∇⋅F\displaystyle \source{\nabla \cdot \mathbf{F}} =∂∂x(3x)+∂∂y(−y)+∂∂z(2z)\displaystyle = \source{\frac{\partial}{\partial x}}(\field{3x}) + \source{\frac{\partial}{\partial y}}(\field{-y}) + \source{\frac{\partial}{\partial z}}(\field{2z}) =3−1+2=4\displaystyle = \source{3 - 1 + 2 = 4}
(Watch the minus sign on −y\field{-y}; adding 3+1+2=63 + 1 + 2 = 6 leads to the wrong answer 216π216\pi.) Since the divergence is a constant 4\source{4}, multiply 4\source{4} by the volume of the sphere. From x2+y2+z2=9=32x^2 + y^2 + z^2 = 9 = 3^2, the radius is R=3R = 3 (be careful not to plug in R=9R = 9, which gives 3888π3888\pi):
Flux\displaystyle \flux{\text{Flux}} =4×(43π(3)3)\displaystyle = \source{4} \times \left(\frac{4}{3}\pi (3)^3\right) =4×36π\displaystyle = \source{4} \times 36\pi =144π\displaystyle = 144\pi
2

Find the inward flux of F=⟨2x+sin⁡(yz),5y+exz,−z+x2y2⟩\field{\mathbf{F} = \langle 2x + \sin(yz), 5y + e^{xz}, -z + x^2y^2 \rangle} through the closed rectangular box 0≤x≤20 \le x \le 2, 0≤y≤30 \le y \le 3, 0≤z≤40 \le z \le 4.

Which terms in F\field{\mathbf{F}} drop out in the divergence, and which direction does the problem ask for?

Taking the divergence clears out sin⁡(yz)\field{\sin(yz)}, exz\field{e^{xz}}, and x2y2\field{x^2y^2} because they don't contain the variable we are differentiating by:
∇⋅F=2+5−1=6\displaystyle \source{\nabla \cdot \mathbf{F} = 2 + 5 - 1 = 6}
Since ∇⋅F=6\source{\nabla \cdot \mathbf{F} = 6} is constant, the outward flux is 6\source{6} times the volume of the 2×3×42 \times 3 \times 4 box:
Outward Flux\displaystyle \flux{\text{Outward Flux}} =6×(2×3×4)\displaystyle = \source{6} \times (2 \times 3 \times 4) =144\displaystyle = 144
The Divergence Theorem always gives outward flux, so stopping at +144+144 is the most common mistake here. Flip the sign for the inward flux:
Inward Flux\displaystyle \flux{\text{Inward Flux}} =−144\displaystyle = -144
3

Find the outward flux of F=⟨2xy2+cos⁡(yz),2yx2+exz,z(x2+y2)+sin⁡(xy)⟩\field{\mathbf{F} = \langle 2xy^2 + \cos(yz), 2yx^2 + e^{xz}, z(x^2 + y^2) + \sin(xy) \rangle} through the closed cylinder x2+y2≤9x^2 + y^2 \le 9, 0≤z≤20 \le z \le 2.

After the terms without the matching variable drop out of ∇⋅F\source{\nabla \cdot \mathbf{F}}, group the remaining terms into x2+y2x^2 + y^2 to switch to cylindrical coordinates.

The terms cos⁡(yz)\field{\cos(yz)}, exz\field{e^{xz}}, and sin⁡(xy)\field{\sin(xy)} drop out in the partial derivatives:
∇⋅F=2y2+2x2+(x2+y2)=3(x2+y2)=3r2\displaystyle \source{\nabla \cdot \mathbf{F} = 2y^2 + 2x^2 + (x^2 + y^2) = 3(x^2 + y^2) = 3r^2}
Set up the triple integral over the cylinder of radius 33 and height 22 in cylindrical coordinates, making sure to include the extra rr in dV=r dz dr dθdV = r\,dz\,dr\,d\theta (forgetting that rr and integrating 3r2\source{3r^2} gives the wrong answer 108π108\pi):
Flux\displaystyle \flux{\text{Flux}} =∫02π∫03∫02(3r2)⋅r dz dr dθ\displaystyle = \int_0^{2\pi} \int_0^3 \int_0^2 \source{(3r^2)} \cdot r\,dz\,dr\,d\theta =∫02π∫036r3 dr dθ\displaystyle = \int_0^{2\pi} \int_0^3 6r^3\,dr\,d\theta =2π[6r44]03\displaystyle = 2\pi \left[\frac{6r^4}{4}\right]_0^3 =243π\displaystyle = 243\pi
4

Find the upward, outward flux of F=⟨2x+ey,2y+sin⁡(z),2z+2(x2+y2)⟩\field{\mathbf{F} = \langle 2x + e^y, 2y + \sin(z), 2z + 2(x^2 + y^2) \rangle} through the upper hemisphere x2+y2+z2=9x^2 + y^2 + z^2 = 9, z≥0z \ge 0, which is open at the bottom at z=0\disk{z = 0}.

Close the open bottom at z=0\disk{z = 0} with a flat disk. Which way does the outward normal n\mathbf{n} point on the bottom of an upper hemisphere?

Close the surface with the flat disk x2+y2≤9\disk{x^2 + y^2 \le 9} at z=0\disk{z = 0}. Since ∇⋅F=2+2+2=6\source{\nabla \cdot \mathbf{F} = 2 + 2 + 2 = 6}, the total outward flux through the upper hemisphere plus the bottom disk is 6\source{6} times the volume of the hemisphere of radius 33:
Total Flux (Hemisphere + Disk)\displaystyle \flux{\text{Total Flux (Hemisphere + Disk)}} =6×(23π(3)3)\displaystyle = \source{6} \times \left(\frac{2}{3}\pi (3)^3\right) =108π\displaystyle = 108\pi
On the bottom disk at z=0\disk{z = 0}, pointing out of the upper hemisphere means pointing straight down, so n=⟨0,0,−1⟩\mathbf{n} = \langle 0, 0, -1 \rangle (using ⟨0,0,1⟩\langle 0, 0, 1 \rangle gives +81π+81\pi for the disk and leads to the wrong answer 27π27\pi). At z=0\disk{z = 0}, this gives F⋅n=−(2z+2(x2+y2))=−2(x2+y2)\flux{\mathbf{F} \cdot \mathbf{n}} = -(\field{2z + 2(x^2 + y^2)}) = -2(x^2 + y^2):
Flux through Disk\displaystyle \flux{\text{Flux through Disk}} =∫02π∫03(−2r2)⋅r dr dθ\displaystyle = \int_0^{2\pi} \int_0^3 (-2r^2) \cdot r\,dr\,d\theta =2π[−2r44]03\displaystyle = 2\pi \left[-\frac{2r^4}{4}\right]_0^3 =−81π\displaystyle = -81\pi
Subtract the disk's flux from the total closed flux:
Flux through Hemisphere\displaystyle \flux{\text{Flux through Hemisphere}} =108π−(−81π)\displaystyle = 108\pi - (-81\pi) =189π\displaystyle = 189\pi