Divergence Theorem
The divergence theorem, also called Gauss’s theorem, says that the outward flux of a vector field F through a closed surface S equals the triple integral of div F over the solid E inside it: ∬ F · n dS over S = ∭ div F dV over E. It turns a hard surface integral into an easier volume integral.
Before this lesson: Curl and Divergence, Surface Integrals, Triple Integrals and Stokes’ Theorem
What the divergence theorem means
The divergence of F at a point measures how much F spreads out there, per unit volume. A point with div F > 0 acts like a small source. Adding up all the sources inside E gives the total amount of fluid that is made inside E each second.
That fluid has to leave through the surface S. So the total outflow through S, which is the flux, equals the total of div F inside. Another way to see it: cut E into tiny boxes. The flux out of one box through a shared face is the flux into its neighbor, so those cancel. Only the faces on S are left.
Divergence theorem formula
\iint_S \mathbf{F} \cdot \mathbf{n} \, dS = \iiint_E \operatorname{div} \mathbf{F} \, dV, \qquad \operatorname{div} \mathbf{F} = \dfrac{\partial P}{\partial x} + \dfrac{\partial Q}{\partial y} + \dfrac{\partial R}{\partial z}Here E is a solid region whose boundary S is a closed, piecewise smooth surface with the outward normal n, and F = ⟨P, Q, R⟩ has continuous partial derivatives on a region that contains E.
When to use it
- The surface is closed, like a sphere, a box or a cylinder with its top and bottom.
- The surface is made of several pieces, so a direct flux integral would need one integral per piece.
- div F is simpler than F, for example a constant.
- The surface is not closed, but you can close it with a flat lid and subtract the flux through the lid.
Divergence theorem examples
Example 1: Flux out of a sphere
Use the divergence theorem to find the outward flux of F = ⟨x, y, z⟩ through the sphere x² + y² + z² = 9.
\operatorname{div} \mathbf{F} = 1 + 1 + 1 = 3Add P_x, Q_y and R_z (see curl and divergence).
\iiint_E 3 \, dV = 3 \cdot \dfrac{4}{3}\pi (3)^3E is the ball of radius 3. A constant integrates to the constant times the volume.
= 3 \cdot 36\pi = 108\pi
The ball’s volume is (4/3)π(27) = 36π.
Answer: 108π ≈ 339.29. This matches Example 4 of surface integrals, which found the same flux with a surface integral.
Example 2: Flux out of a cube
Find the outward flux of F = ⟨x², y², z²⟩ through the surface of the cube 0 ≤ x ≤ 1, 0 ≤ y ≤ 1, 0 ≤ z ≤ 1.
\operatorname{div} \mathbf{F} = 2x + 2y + 2zAdd P_x, Q_y and R_z.
\iiint_E 2x \, dV = \int_0^1 \int_0^1 \int_0^1 2x \, dx \, dy \, dz = 1
The x-integral is 1, and the y- and z-integrals each multiply by 1.
\iiint_E 2y \, dV = 1, \quad \iiint_E 2z \, dV = 1
The same steps with y and with z.
\iiint_E (2x + 2y + 2z) \, dV = 1 + 1 + 1 = 3
Add the three parts.
Answer: 3. Working directly would take six surface integrals, one for each face.
Example 3: Flux out of a cylinder
Find the outward flux of F = ⟨x³, y³, z⟩ through the closed cylinder x² + y² ≤ 4, 0 ≤ z ≤ 3, including its top and bottom.
\operatorname{div} \mathbf{F} = 3x^2 + 3y^2 + 1 = 3r^2 + 1Add the partials, then use x² + y² = r².
\iiint_E \operatorname{div} \mathbf{F} \, dV = \int_0^{2\pi} \int_0^2 \int_0^3 (3r^2 + 1) \, r \, dz \, dr \, d\thetaUse cylindrical coordinates, with dV = r dz dr dθ (see triple integrals in cylindrical coordinates).
\int_0^3 (3r^3 + r) \, dz = 3(3r^3 + r)
Inner integral. The integrand does not depend on z.
\int_0^2 3(3r^3 + r) \, dr = 3\left(12 + 2\right) = 42
Middle integral: 3r⁴/4 + r²/2 from 0 to 2 is 12 + 2.
\int_0^{2\pi} 42 \, d\theta = 84\piOuter integral.
Answer: 84π ≈ 263.89.
Example 4: Flux through a surface that is not closed
Find the upward flux of F = ⟨x, y, z²⟩ through the paraboloid z = 4 − x² − y², z ≥ 0. This surface has no bottom, so close it with the disk D: x² + y² ≤ 4 in the plane z = 0.
\operatorname{div} \mathbf{F} = 1 + 1 + 2z = 2 + 2zAdd the partials.
\int_0^{4 - r^2} (2 + 2z) \, dz = 2(4 - r^2) + (4 - r^2)^2Inner integral in cylindrical coordinates: 2z + z² from 0 to 4 − r².
\int_0^2 \big[2(4 - r^2) + (4 - r^2)^2\big] r \, dr = \dfrac{1}{2}\int_0^4 (2w + w^2) \, dwSubstitute w = 4 − r², so r dr = −dw/2; r = 0 gives w = 4 and r = 2 gives w = 0 (see u-substitution with definite integrals).
= \dfrac{1}{2}\left(16 + \dfrac{64}{3}\right) = \dfrac{56}{3}Integrate: w² + w³/3 from 0 to 4.
\iiint_E \operatorname{div} \mathbf{F} \, dV = 2\pi \cdot \dfrac{56}{3} = \dfrac{112\pi}{3}Outer integral over θ.
\iint_D \mathbf{F} \cdot (-\mathbf{k}) \, dA = \iint_D (-z^2) \, dA = 0Flux through the lid, whose outward normal points down. On D, z = 0.
\dfrac{112\pi}{3} - 0 = \dfrac{112\pi}{3}Flux through the paraboloid = total outward flux − flux through the lid.
Answer: 112π/3 ≈ 117.29.
Example 5: Air leaving a heated room
As a room warms up, the air expands with velocity v = ⟨0.1x, 0.1y, 0.2z⟩ m/s. The room is the box 0 ≤ x ≤ 5, 0 ≤ y ≤ 4, 0 ≤ z ≤ 3, in meters. How many cubic meters of air leave the room each second?
\operatorname{div} \mathbf{v} = 0.1 + 0.1 + 0.2 = 0.4Add the partials.
\text{volume} = 5 \cdot 4 \cdot 3 = 60Find the volume of the room.
\iint_S \mathbf{v} \cdot \mathbf{n} \, dS = 0.4 \cdot 60 = 24The divergence is constant, so multiply it by the volume.
Answer: 24 cubic meters of air per second flow out through the walls, floor and ceiling.
Common mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Using it on a surface that is not closed | Giving 32π/3, the integral of div F over the half ball, as the answer to Practice Problem 8 | Close the surface, then subtract the flux through the added piece. |
| Writing the divergence as a vector | Writing div ⟨x², y², z²⟩ = ⟨2x, 2y, 2z⟩ | The divergence is a number: 2x + 2y + 2z. |
| Using the inward normal | Getting −108π in Example 1 | The theorem uses the outward normal on the closed surface. |
| Forgetting the volume factor in dV | Integrating 3r² + 1 dz dr dθ without the extra r | Use dV = r dz dr dθ in cylindrical and ρ² sin φ dρ dφ dθ in spherical coordinates. |
| Ignoring a point where F is undefined | Using div F = 0 for F = r/|r|³ on a ball around the origin | F must be smooth on all of E. Cut out a small ball around the bad point first. |
Related methods
The big theorems of vector calculus
| Theorem | Left side | Right side |
|---|---|---|
| Fundamental theorem for line integrals | ∫ ∇f · dr along C | f(end) − f(start) |
| Green’s theorem | ∮ P dx + Q dy around C | ∬ (Q_x − P_y) dA over D |
| Stokes’ theorem | ∮ F · dr around C | ∬ (curl F) · n dS over S |
| Divergence theorem | ∬ F · n dS over closed S | ∭ div F dV over E |
Each one turns an integral over a boundary into an integral of a derivative over the inside. See conservative vector fields for the first one.
Regions with holes and Gauss’s law
For a solid shell between two closed surfaces, the boundary has two parts: the outer surface with its normal pointing out, and the inner surface with its normal pointing in, toward the hole. The field F = r/|r|³ has div F = 0 away from the origin, so its outward flux through any closed surface around the origin is the same as through a small sphere: 4π. In physics, this is Gauss’s law for electric fields.
Practice problems
- Find the outward flux of F = ⟨3x, 2y, z⟩ through the sphere x² + y² + z² = 1.
- Find the outward flux of F = ⟨xy, yz, zx⟩ through the surface of the cube 0 ≤ x, y, z ≤ 1.
- Find the outward flux of F = ⟨x − y, y + z, z − x⟩ through the surface of the box 0 ≤ x ≤ 2, 0 ≤ y ≤ 3, 0 ≤ z ≤ 1.
- Find the outward flux of F = ⟨x³, y³, z³⟩ through the sphere x² + y² + z² = 4.
- Find the outward flux of F = ⟨x, y, z⟩ through the closed cylinder x² + y² ≤ 1, 0 ≤ z ≤ 4.
- Find the outward flux of F = ⟨y², z², x²⟩ through the sphere x² + y² + z² = 49.
- Find the outward flux of F = ⟨x², 0, 0⟩ through the surface of the solid with x, y, z ≥ 0 and x + y + z ≤ 1.
- Find the upward flux of F = ⟨x, y, 2⟩ through the upper half of the sphere x² + y² + z² = 4. Close it with the disk x² + y² ≤ 4, z = 0.
- Find the outward flux of F = ⟨z, y, x⟩ through the boundary of the solid between the spheres of radius 1 and 2 centered at the origin.
- A gas expands with velocity v = ⟨2x, 2y, 2z⟩ cm/s inside a closed can of radius 3 cm and height 10 cm. How much gas leaves the can each second?
Show answers
1.
\operatorname{div} \mathbf{F} = 3 + 2 + 1 = 6Add the partials.
6 \cdot \dfrac{4}{3}\pi (1)^3 = 8\piMultiply by the volume of the unit ball.
Answer: 8π ≈ 25.13
2.
\operatorname{div} \mathbf{F} = y + z + xP_x = y, Q_y = z, R_z = x.
\iiint_E x \, dV = \dfrac{1}{2}Over the unit cube, x integrates to 1/2; so do y and z.
\dfrac{1}{2} + \dfrac{1}{2} + \dfrac{1}{2} = \dfrac{3}{2}Add the three parts.
Answer: 3/2
3.
\operatorname{div} \mathbf{F} = 1 + 1 + 1 = 3Add the partials.
3 \cdot (2 \cdot 3 \cdot 1) = 18
Multiply by the volume of the box.
Answer: 18
4.
\operatorname{div} \mathbf{F} = 3x^2 + 3y^2 + 3z^2 = 3\rho^2Add the partials and use x² + y² + z² = ρ².
\int_0^{2\pi} \int_0^{\pi} \int_0^2 3\rho^2 \cdot \rho^2\sin\varphi \, d\rho \, d\varphi \, d\thetaUse spherical coordinates (see triple integrals in spherical coordinates).
\int_0^2 3\rho^4 \, d\rho = \dfrac{96}{5}Inner integral: 3ρ⁵/5 from 0 to 2.
\dfrac{96}{5} \cdot 2 \cdot 2\pi = \dfrac{384\pi}{5}The φ-integral of sin φ is 2, and the θ-integral is 2π.
Answer: 384π/5 ≈ 241.27
5.
\operatorname{div} \mathbf{F} = 3Add the partials.
3 \cdot \pi (1)^2 (4) = 12\pi
Multiply by the volume of the cylinder.
Answer: 12π ≈ 37.70
6.
\operatorname{div} \mathbf{F} = 0 + 0 + 0 = 0P = y² has no x, Q = z² has no y, and R = x² has no z.
Answer: 0, for this sphere or any closed surface.
7.
\operatorname{div} \mathbf{F} = 2xOnly P_x is not 0.
\int_0^1 \int_0^{1-x} \int_0^{1-x-y} 2x \, dz \, dy \, dx = \int_0^1 \int_0^{1-x} 2x(1 - x - y) \, dy \, dxInner integral in z.
= \int_0^1 x(1 - x)^2 \, dx
Middle integral: 2x[(1 − x)y − y²/2] from 0 to 1 − x is x(1 − x)².
= \dfrac{1}{2} - \dfrac{2}{3} + \dfrac{1}{4} = \dfrac{1}{12}Expand x − 2x² + x³ and integrate from 0 to 1.
Answer: 1/12
8.
\iiint_E 2 \, dV = 2 \cdot \dfrac{2}{3}\pi (2)^3 = \dfrac{32\pi}{3}div F = 1 + 1 + 0 = 2, and the half ball has volume 16π/3.
\iint_D \mathbf{F} \cdot (-\mathbf{k}) \, dA = -2 \cdot 4\pi = -8\piFlux through the lid, with the outward normal pointing down.
\dfrac{32\pi}{3} - (-8\pi) = \dfrac{56\pi}{3}Subtract the lid’s flux from the total.
Answer: 56π/3 ≈ 58.64
9.
\operatorname{div} \mathbf{F} = 0 + 1 + 0 = 1Add the partials.
\dfrac{4}{3}\pi (2^3 - 1^3) = \dfrac{28\pi}{3}The flux is the volume of the shell.
Answer: 28π/3 ≈ 29.32
10.
\operatorname{div} \mathbf{v} = 2 + 2 + 2 = 6Add the partials.
6 \cdot \pi (3)^2 (10) = 540\pi
Multiply by the volume of the can, 90π.
Answer: 540π ≈ 1,696 cubic centimeters per second
Divergence theorem FAQ
What does the divergence theorem say?
The outward flux of a vector field through a closed surface equals the triple integral of its divergence over the solid inside. Flux out equals the total of the sources inside.
When can you use the divergence theorem?
Use it when the surface is closed and F has continuous partial derivatives on the whole solid inside. For a surface that is not closed, add a lid and subtract the lid’s flux.
What is the difference between Stokes’ theorem and the divergence theorem?
Stokes’ theorem relates a surface integral of curl F to a line integral around the surface’s edge. The divergence theorem relates a flux through a closed surface to a triple integral of div F.
Why is it called Gauss’s theorem?
It is named for Carl Friedrich Gauss, who used it in his work on gravitational attraction. Mikhail Ostrogradsky gave the first general proof, so it is also called Ostrogradsky’s theorem.
Summary
- Divergence theorem: ∬ F · n dS over a closed surface S = ∭ div F dV over the solid E inside.
- The normal n points outward.
- It replaces several surface integrals with one triple integral.
- For a surface that is not closed, add a lid and subtract its flux.
- If div F = 0 on E, the outward flux through S is 0.
Previous lesson: Stokes’ Theorem
Next course: Linear Algebra Index
Back to the Calculus 3 Index