Using the Divergence Theorem

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 [latex]S[/latex] and a triple integral over the solid enclosed by [latex]S[/latex]. 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 [latex]\displaystyle\iint_{S}{\bf{F}}\cdot d{\bf{S}}[/latex], where [latex]S[/latex] is cylinder [latex]x^2+y^2=1[/latex], [latex]0\leq z\leq2[/latex], including the circular top and bottom, and [latex]{\bf{F}}=\left\langle\frac{x^3}{3}+yz,\frac{y^3}3-\sin(xz),z-x-y\right\rangle[/latex].

Try it

Use the divergence theorem to calculate flux integral [latex]\displaystyle\iint_S{\bf{F}}\cdot d{\bf{S}}[/latex], where [latex]S[/latex] is the boundary of the box given by [latex]0\leq x\leq2[/latex], [latex]1\leq y\leq4[/latex], [latex]0\leq z\leq1[/latex], and [latex]{\bf{F}}=\langle x^2+yz,y-z,2x+2y+2z\rangle[/latex] (see the following figure).

This figure is a vector diagram in three dimensions. The box of the figure spans x from 0 to 2; y from 0 to 4; and z from 0 to 1. The vectors point up increasingly with distance from the origin; toward larger x with increasing distance from the origin; and toward smaller y values with increasing height.

Figure 1. The box given by [latex]0\leq x\leq2[/latex], [latex]1\leq y\leq4[/latex], [latex]0\leq z\leq1[/latex], and [latex]{\bf{F}}=\langle x^2+yz,y-z,2x+2y+2z\rangle[/latex]

Example: applying the divergence theorem

Let [latex]{\bf{v}}=\left\langle-\frac{y}z,\frac{x}z,0\right\rangle[/latex] be the velocity field of a fluid. Let [latex]C[/latex] be the solid cube given by [latex]1\leq x \leq4[/latex], [latex]2\leq y\leq5[/latex], [latex]1\leq z\leq4[/latex], and let [latex]S[/latex] be the boundary of this cube (see the following figure). Find the flow rate of the fluid across [latex]S[/latex].

<img src="/apps/archive/20220422.171947/resources/4df0ac7e1163d69369ff76a71f516bddb63c4bcb" data-media-type="image/jpeg" alt="This is a figure of a diagram of the given vector field in three dimensions. The x components are –y/z, the y components are x/z, and the z components are 0." id="13">

Figure 2. Vector field [latex]{\bf{v}}=\left\langle-\frac{y}z,\frac{x}z,0\right\rangle[/latex].

try it

Let [latex]{\bf{v}}=\left\langle\frac{x}z,\frac{y}z,0\right\rangle[/latex] be the velocity field of a fluid. Let [latex]C[/latex] be the solid cube given by [latex]1\leq x\leq4[/latex], [latex]2\leq y\leq5[/latex], [latex]1\leq z\leq4[/latex], and let [latex]S[/latex] be the boundary of this cube (see the following figure). Find the flow rate of the fluid across [latex]S[/latex].

This is a figure of a diagram of the given vector field in three dimensions. The x components are x/z, the y components are y/z, and the z components are 0.

Figure 3. The solid cube given by [latex]1\leq x\leq4[/latex], [latex]2\leq y\leq5[/latex], [latex]1\leq z\leq4[/latex]

Watch the following video to see the worked solution to the above Try It

You can view the transcript for “CP 6.67” here (opens in new window).

Example “Applying the Divergence Theorem” illustrates a remarkable consequence of the divergence theorem. Let [latex]S[/latex] be a piecewise, smooth closed surface and let [latex]{\bf{F}}[/latex] be a vector field defined on an open region containing the surface enclosed by [latex]S[/latex]. If [latex]{\bf{F}}[/latex] has the form [latex]{\bf{F}}=\langle f(y,z),g(x,z),h(x,y)\rangle[/latex], then the divergence of [latex]{\bf{F}}[/latex] is zero. By the divergence theorem, the flux of [latex]{\bf{F}}[/latex] across [latex]S[/latex] is also zero. This makes certain flux integrals incredibly easy to calculate. For example, suppose we wanted to calculate the flux integral [latex]\displaystyle\iint_S{\bf{F}}\cdot d{\bf{S}}[/latex] where [latex]S[/latex] is a cube and

[latex]\large{{\bf{F}}=\langle\sin(y)e^{yz},x^2z^2,\cos(xy)e^{\sin x}\rangle}[/latex].

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 [latex]{\bf{F}}[/latex] is a continuous three-dimensional vector field and [latex]P[/latex] is a point in the domain of [latex]{\bf{F}}[/latex], then the divergence of [latex]{\bf{F}}[/latex] at [latex]P[/latex] is a measure of the “outflowing-ness” of [latex]{\bf{F}}[/latex] at [latex]P[/latex]. If [latex]{\bf{F}}[/latex] represents the velocity field of a fluid, then the divergence of [latex]{\bf{F}}[/latex] at [latex]P[/latex] is a measure of the net flow rate out of point [latex]P[/latex] (the flow of fluid out of [latex]P[/latex] less the flow of fluid in to [latex]P[/latex]). To see how the divergence theorem justifies this interpretation, let [latex]B_r[/latex] be a ball of very small radius [latex]r[/latex] with center [latex]P[/latex], and assume that [latex]B_r[/latex] is in the domain of [latex]{\bf{F}}[/latex]. Furthermore, assume that [latex]B_r[/latex] has a positive, outward orientation. Since the radius of [latex]B_r[/latex] is small and [latex]{\bf{F}}[/latex] is continuous, the divergence of [latex]{\bf{F}}[/latex] is approximately constant on [latex]B_r[/latex]. That is, if [latex]P'[/latex] is any point in [latex]B_r[/latex], then [latex]\text{div }{\bf{F}}(P)\approx\text{div }{\bf{F}}(P^\prime)[/latex]. Let [latex]S_r[/latex] denote the boundary sphere of [latex]B_r[/latex]. We can approximate the flux across [latex]S_r[/latex] using the divergence theorem as follows:

[latex]\begin{aligned} \displaystyle\iint_S{\bf{F}}\cdot d{\bf{S}}&=\displaystyle\iiint_{B_r}\text{div }{\bf{F}}dV \\ &\approx\displaystyle\iiint_{B_r}\text{div }{\bf{F}}(P)dV \\ &=\text{div }{\bf{F}}(P)V(B_r) \end{aligned}[/latex].

As we shrink the radius [latex]r[/latex] to zero via a limit, the quantity [latex]\text{div }{\bf{F}}(P)V(B_r)[/latex] gets arbitrarily close to the flux. Therefore,

[latex]\large{\text{div }{\bf{F}}(P)=\displaystyle\lim_{r\to0}\frac{1}{V(B_r)}\displaystyle\iint_{S_r}{\bf{F}}\cdot d{\bf{S}}}[/latex]

and we can consider the divergence at [latex]P[/latex] as measuring the net rate of outward flux per unit volume at [latex]P[/latex]. 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 [latex]S[/latex] is a closed surface in electrostatic field [latex]{\bf{E}}[/latex], then the flux of [latex]{\bf{E}}[/latex] across [latex]S[/latex] is the total charge enclosed by [latex]S[/latex] (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 [latex](x, y, z)[/latex] is a point in space, then the distance from the point to the origin is [latex]r=\sqrt{x^2+y^2+z^2}[/latex]. Let [latex]{\bf{F}}_r[/latex] denote radial vector field [latex]{\bf{F}}_r=\frac1{r^2}\left\langle\frac{x}y,\frac{y}r,\frac{z}r\right\rangle[/latex]. The vector at a given position in space points in the direction of unit radial vector [latex]\left\langle\frac{x}y,\frac{y}r,\frac{z}r\right\rangle[/latex] and is scaled by the quantity [latex]1/r^2[/latex]. 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 [latex]q[/latex] Coulombs at the origin, existing in a vacuum. The charge generates electrostatic field [latex]{\bf{E}}[/latex] given by

[latex]\large{{\bf{E}}=\frac{q}{4\pi\varepsilon_0}{\bf{F}}_r}[/latex],

where the approximation [latex]\varepsilon=8.854\times10^{-12}[/latex] farad (F)/m is an electric constant. (The constant [latex]\varepsilon_0[/latex] is a measure of the resistance encountered when forming an electric field in a vacuum.) Notice that [latex]{\bf{E}}[/latex] 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

[latex]\large{{\bf{E}}=\frac{q}{4\pi\varepsilon_0}{\bf{F}}_r=\frac{q}{4\pi\varepsilon_0}\left(\frac1{r^1}\left\langle\frac{x}y,\frac{y}r,\frac{z}r\right\rangle\right)}[/latex],

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 [latex]S[/latex] is zero if the charge is outside of [latex]S[/latex], and that the flux is [latex]q/\varepsilon_0[/latex] if the charge is inside of [latex]S[/latex]. In other words, the flux across [latex]S[/latex] is the charge inside the surface divided by constant [latex]\varepsilon_0[/latex]. 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 [latex]S[/latex] is the charge inside the surface divided by constant [latex]\varepsilon_0[/latex], we need two intermediate steps. First we show that the divergence of [latex]{\bf{F}}_r[/latex] is zero and then we show that the flux of [latex]{\bf{F}}_r[/latex] across any smooth surface [latex]S[/latex] is either zero or [latex]4\pi[/latex]. We can then justify this special case of Gauss’ law.

Example: the divergence of [latex]F_r[/latex] is Zero

Verify that the divergence of [latex]{\bf{F}}_r[/latex] is zero where [latex]{\bf{F}}_r[/latex] is defined (away from the origin).

Notice that since the divergence of [latex]{\bf{F}}_r[/latex] is zero and [latex]{\bf{E}}[/latex] is [latex]{\bf{F}}_r[/latex] scaled by a constant, the divergence of electrostatic field [latex]{\bf{E}}[/latex] is also zero (except at the origin).

theorem: flux across a smooth surface

Let [latex]S[/latex] be a connected, piecewise smooth closed surface and let [latex]{\bf{F}}_r=\frac{1}{r^2}\left\langle\frac{x}r,\frac{y}r,\frac{z}r\right\rangle[/latex]. Then,

[latex]\begin{equation*} \displaystyle\iint_S{\bf{F}}\cdot d{\bf{S}} = \left\{ \begin{array}{ll} 0 & \quad \text{if }S\text{ does not encompass the origin} \\ 4\pi & \quad \text{if }S\text{ encompasses the origin.} \end{array} \right. \end{equation*} [/latex]

In other words, this theorem says that the flux of [latex]{\bf{F}}_r[/latex] across any piecewise smooth closed surface [latex]S[/latex] depends only on whether the origin is inside of [latex]S[/latex].

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 [latex]S[/latex] does not encompass the origin. In this case, the solid enclosed by [latex]S[/latex] is in the domain of [latex]{\bf{F}}_r[/latex], and since the divergence of [latex]{\bf{F}}_r[/latex] is zero, we can immediately apply the divergence theorem and find that [latex]\displaystyle\iint_S{\bf{F}}\cdot d{\bf{S}}[/latex] is zero.

Now suppose that [latex]S[/latex] 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 [latex]S_a[/latex] be a sphere of radius [latex]a[/latex] inside of [latex]S[/latex] centered at the origin. The outward normal vector field on the sphere, in spherical coordinates, is

[latex]\large{{\bf{t}}_\phi\times{\bf{t}}_\theta=\langle a^2\cos\theta\sin^2\phi,a^2\sin\theta\sin^2\phi,a^2\sin\phi\cos\phi\rangle}[/latex]

(see Example “Calculating Surface Area”). Therefore, on the surface of the sphere, the dot product [latex]{\bf{F}}_r\cdot{\bf{N}}[/latex] (in spherical coordinates) is

[latex] \begin{aligned} {\bf{F}}_r\cdot{\bf{N}}&=\left\langle\frac{\sin\phi\cos\theta}{a^2},\frac{\sin\phi\sin\theta}{a^2},\frac{\cos\phi}{a^2}\right\rangle\cdot\langle a^2\cos\theta\sin^2\phi,a^2\sin\theta\sin^2\phi,a^2\sin\phi\cos\phi\rangle \\ &=\sin\phi(\langle\sin\phi\cos\theta,\sin\phi\sin\theta,\cos\phi\rangle\cdot\langle\sin\phi\cos\theta,\sin\phi\sin\theta,\cos\phi\rangle) \\ &=\sin\phi \end{aligned}[/latex].

The flux of [latex]{\bf{F}}_r[/latex] across [latex]S_a[/latex] is

[latex]\large{\displaystyle\iint_{S_a}{\bf{F}}_r\cdot{\bf{N}}dS=\displaystyle\int_0^{2\pi}\displaystyle\int_0^\pi\sin\phi d\phi d\theta=4\pi}[/latex].

Now, remember that we are interested in the flux across [latex]S[/latex], not necessarily the flux across [latex]S_a[/latex]. To calculate the flux across [latex]S[/latex], let [latex]E[/latex] be the solid between surfaces [latex]S_a[/latex] and [latex]S[/latex]. Then, the boundary of [latex]E[/latex] consists of [latex]S_a[/latex] and [latex]S[/latex]. Denote this boundary by [latex]S-S_a[/latex] to indicate that [latex]S[/latex] is oriented outward but now [latex]S_a[/latex] 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 [latex]E[/latex] because [latex]E[/latex] 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,

[latex]\begin{aligned} \displaystyle\iint_{S-S_a}{\bf{F}}_r\cdot{\bf{N}}dS&=\displaystyle\iint_S{\bf{F}}_r\cdot{\bf{N}}dS-\displaystyle\iint_{S_a}{\bf{F}}_r\cdot{\bf{N}}dS \\ &=\displaystyle\iiint_E\text{div }{\bf{F}}_r dV \\ &=\displaystyle\iiint_E0 \ dV=0 \end{aligned}[/latex].

Therefore,

[latex]\large{\displaystyle\iint_S{\bf{F}}_r\cdot{\bf{N}}dS=\displaystyle\iint_{S_a}{\bf{F}}_r\cdotdS=4\pi}[/latex],

and we have our desired result.

[latex]_\blacksquare[/latex]

Now we return to calculating the flux across a smooth surface in the context of electrostatic field [latex]{\bf{E}}=\frac{q}{4\pi\varepsilon_0}{\bf{F}}_r[/latex] of a point charge at the origin. Let [latex]S[/latex] be a piecewise smooth closed surface that encompasses the origin. Then

[latex]\begin{aligned} \displaystyle\iint_S{\bf{E}}\cdot d{\bf{S}}&=\displaystyle\iint_S\frac{q}{4\pi\varepsilon_0}{\bf{F}}_r\cdot d{\bf{S}} \\ &=\frac{q}{4\pi\varepsilon_0}\displaystyle\iint_S{\bf{F}}_r\cdot d{\bf{S}} \\ &=\frac{q}{\varepsilon_0} \end{aligned}[/latex].

If [latex]S[/latex] does not encompass the origin, then

[latex]\large{\displaystyle\iint_S{\bf{E}}\cdot d{\bf{S}}=\frac{q}{4\pi\varepsilon_0}\displaystyle\iint_S{\bf{F}}_r\cdot d{\bf{S}}=0}[/latex].

Therefore, we have justified the claim that we set out to justify: the flux across closed surface [latex]S[/latex] is zero if the charge is outside of [latex]S[/latex], and the flux is [latex]q/\varepsilon_0[/latex] if the charge is inside of [latex]S[/latex].

This analysis works only if there is a single point charge at the origin. In this case, Gauss’ law says that the flux of [latex]{\bf{E}}[/latex] across [latex]S[/latex] is the total charge enclosed by [latex]S[/latex]. 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 [latex]S[/latex] is a piecewise smooth closed surface and [latex]Q[/latex] is the total amount of charge inside of [latex]S[/latex], then the flux of [latex]{\bf{E}}[/latex] across [latex]S[/latex] is [latex]Q/\varepsilon_0[/latex].

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 [latex](0, 1, 1)[/latex], [latex](1, 1, 4)[/latex], [latex](-1, 0, 0)[/latex], and [latex](-2, -2, 2)[/latex]. Let [latex]{\bf{E}}[/latex] denote the electrostatic field generated by these point charges. If [latex]S[/latex] is the sphere of radius 2 oriented outward and centered at the origin, then find [latex]\displaystyle\iint_S{\bf{E}}\cdot d{\bf{S}}[/latex].

try it

Work the previous example for surface [latex]S[/latex] that is a sphere of radius 4 centered at the origin, oriented outward.