Learning Objectives
- Use the divergence theorem to calculate the flux of a vector field.
- Apply the divergence theorem to an electrostatic field.
Using the Divergence Theorem
The divergence theorem translates between the flux integral of closed surface and a triple integral over the solid enclosed by . Therefore, the theorem allows us to compute flux integrals or triple integrals that would ordinarily be difficult to compute by translating the flux integral into a triple integral and vice versa.
Example: applying the divergence theorem
Calculate the surface integral , where is cylinder , , including the circular top and bottom, and .
Try it
Use the divergence theorem to calculate flux integral , where is the boundary of the box given by , , , and (see the following figure).

Figure 1. The box given by , , , and
Example: applying the divergence theorem
Let be the velocity field of a fluid. Let be the solid cube given by , , , and let be the boundary of this cube (see the following figure). Find the flow rate of the fluid across .

Figure 2. Vector field .
try it
Let be the velocity field of a fluid. Let be the solid cube given by , , , and let be the boundary of this cube (see the following figure). Find the flow rate of the fluid across .

Figure 3. The solid cube given by , ,
Watch the following video to see the worked solution to the above Try It
Example “Applying the Divergence Theorem” illustrates a remarkable consequence of the divergence theorem. Let be a piecewise, smooth closed surface and let be a vector field defined on an open region containing the surface enclosed by . If has the form , then the divergence of is zero. By the divergence theorem, the flux of across is also zero. This makes certain flux integrals incredibly easy to calculate. For example, suppose we wanted to calculate the flux integral where is a cube and
.
Calculating the flux integral directly would be difficult, if not impossible, using techniques we studied previously. At the very least, we would have to break the flux integral into six integrals, one for each face of the cube. But, because the divergence of this field is zero, the divergence theorem immediately shows that the flux integral is zero.
We can now use the divergence theorem to justify the physical interpretation of divergence that we discussed earlier. Recall that if is a continuous three-dimensional vector field and is a point in the domain of , then the divergence of at is a measure of the “outflowing-ness” of at . If represents the velocity field of a fluid, then the divergence of at is a measure of the net flow rate out of point (the flow of fluid out of less the flow of fluid in to ). To see how the divergence theorem justifies this interpretation, let be a ball of very small radius with center , and assume that is in the domain of . Furthermore, assume that has a positive, outward orientation. Since the radius of is small and is continuous, the divergence of is approximately constant on . That is, if is any point in , then . Let denote the boundary sphere of . We can approximate the flux across using the divergence theorem as follows:
.
As we shrink the radius to zero via a limit, the quantity gets arbitrarily close to the flux. Therefore,
and we can consider the divergence at as measuring the net rate of outward flux per unit volume at . Since “outflowing-ness” is an informal term for the net rate of outward flux per unit volume, we have justified the physical interpretation of divergence we discussed earlier, and we have used the divergence theorem to give this justification.
Application to Electrostatic Fields
The divergence theorem has many applications in physics and engineering. It allows us to write many physical laws in both an integral form and a differential form (in much the same way that Stokes’ theorem allowed us to translate between an integral and differential form of Faraday’s law). Areas of study such as fluid dynamics, electromagnetism, and quantum mechanics have equations that describe the conservation of mass, momentum, or energy, and the divergence theorem allows us to give these equations in both integral and differential forms.
One of the most common applications of the divergence theorem is to electrostatic fields. An important result in this subject is Gauss’ law. This law states that if is a closed surface in electrostatic field , then the flux of across is the total charge enclosed by (divided by an electric constant). We now use the divergence theorem to justify the special case of this law in which the electrostatic field is generated by a stationary point charge at the origin.
If is a point in space, then the distance from the point to the origin is . Let denote radial vector field . The vector at a given position in space points in the direction of unit radial vector and is scaled by the quantity . Therefore, the magnitude of a vector at a given point is inversely proportional to the square of the vector’s distance from the origin. Suppose we have a stationary charge of Coulombs at the origin, existing in a vacuum. The charge generates electrostatic field given by
,
where the approximation farad (F)/m is an electric constant. (The constant is a measure of the resistance encountered when forming an electric field in a vacuum.) Notice that is a radial vector field similar to the gravitational field described in Example “A Unit Vector Field”. The difference is that this field points outward whereas the gravitational field points inward. Because
,
we say that electrostatic fields obey an inverse-square law. That is, the electrostatic force at a given point is inversely proportional to the square of the distance from the source of the charge (which in this case is at the origin). Given this vector field, we show that the flux across closed surface is zero if the charge is outside of , and that the flux is if the charge is inside of . In other words, the flux across is the charge inside the surface divided by constant . This is a special case of Gauss’ law, and here we use the divergence theorem to justify this special case.
To show that the flux across is the charge inside the surface divided by constant , we need two intermediate steps. First we show that the divergence of is zero and then we show that the flux of across any smooth surface is either zero or . We can then justify this special case of Gauss’ law.
Example: the divergence of is Zero
Verify that the divergence of is zero where is defined (away from the origin).
Notice that since the divergence of is zero and is scaled by a constant, the divergence of electrostatic field is also zero (except at the origin).
theorem: flux across a smooth surface
Let be a connected, piecewise smooth closed surface and let . Then,
In other words, this theorem says that the flux of across any piecewise smooth closed surface depends only on whether the origin is inside of .
Proof
The logic of this proof follows the logic of Example “Using Green’s Theorem on a Region with Holes”, only we use the divergence theorem rather than Green’s theorem.
First, suppose that does not encompass the origin. In this case, the solid enclosed by is in the domain of , and since the divergence of is zero, we can immediately apply the divergence theorem and find that is zero.
Now suppose that does encompass the origin. We cannot just use the divergence theorem to calculate the flux, because the field is not defined at the origin. Let be a sphere of radius inside of centered at the origin. The outward normal vector field on the sphere, in spherical coordinates, is
(see Example “Calculating Surface Area”). Therefore, on the surface of the sphere, the dot product (in spherical coordinates) is
.
The flux of across is
.
Now, remember that we are interested in the flux across , not necessarily the flux across . To calculate the flux across , let be the solid between surfaces and . Then, the boundary of consists of and . Denote this boundary by to indicate that is oriented outward but now is oriented inward. We would like to apply the divergence theorem to solid E. Notice that the divergence theorem, as stated, can’t handle a solid such as because has a hole. However, the divergence theorem can be extended to handle solids with holes, just as Green’s theorem can be extended to handle regions with holes. This allows us to use the divergence theorem in the following way. By the divergence theorem,
.
Therefore,
,
and we have our desired result.
Now we return to calculating the flux across a smooth surface in the context of electrostatic field of a point charge at the origin. Let be a piecewise smooth closed surface that encompasses the origin. Then
.
If does not encompass the origin, then
.
Therefore, we have justified the claim that we set out to justify: the flux across closed surface is zero if the charge is outside of , and the flux is if the charge is inside of .
This analysis works only if there is a single point charge at the origin. In this case, Gauss’ law says that the flux of across is the total charge enclosed by . Gauss’ law can be extended to handle multiple charged solids in space, not just a single point charge at the origin. The logic is similar to the previous analysis, but beyond the scope of this text. In full generality, Gauss’ law states that if is a piecewise smooth closed surface and is the total amount of charge inside of , then the flux of across is .
Example: using Gauss’ Law
Suppose we have four stationary point charges in space, all with a charge of 0.002 Coulombs (C). The charges are located at , , , and . Let denote the electrostatic field generated by these point charges. If is the sphere of radius 2 oriented outward and centered at the origin, then find .
try it
Work the previous example for surface that is a sphere of radius 4 centered at the origin, oriented outward.
Candela Citations
- CP 6.67. Authored by: Ryan Melton. License: CC BY: Attribution
- Calculus Volume 3. Authored by: Gilbert Strang, Edwin (Jed) Herman. Provided by: OpenStax. Located at: https://openstax.org/books/calculus-volume-3/pages/1-introduction. License: CC BY-NC-SA: Attribution-NonCommercial-ShareAlike. License Terms: Access for free at https://openstax.org/books/calculus-volume-3/pages/1-introduction