# Divergence theorem

   A novice might find a proof easier to follow if we greatly restrict the conditions of the theorem, but carefully explain each step. For that reason, we prove the divergence theorem for a rectangular box, using a vector field that depends on only one variable.
* See Wikipedia:Divergence theorem for more rigorous proofs.
* See the subpage, Divergence theorem/Proof for another proof.
The Divergence (Gauss-Ostrogradsky) theorem relates the integral over a volume, ${\mathsf {V}}$, of the divergence of a vector function, $\mathbf {\vec {F}}$, and the integral of that same function over the the volume's surface:
                      $\int _{\mathsf {V}}\underbrace {\left(\mathbf {\vec {\nabla }} \cdot \mathbf {\vec {F}} \right)\,dV} _{\text{triple integral}}=\oint _{\mathsf {S}}\underbrace {\left(\mathbf {\vec {F}} \cdot \mathbf {\hat {n}} \right)\,dS} _{\text{double integral}}.$         (1)

### Special case of a field that depends on only one variable:

Figure 2 shows a vector field using red arrows to denote the field's direction and magnitude. The field occupies all three dimensions, but is only directed in the x or y directions. And, the field varies only along the x-axis. In other words, $\mathbf {\vec {F}}$ is of the form,
                      $\mathbf {\vec {F}} =F_{x}(x)\mathbf {\hat {i}} +F_{y}(x)\mathbf {\hat {j}}$         (2)
where $F_{x}$ and $F_{y}$ are arbitrary "smooth" functions of only the variable $x.$ A z-component, $F_{z}(x)$, could be included in (2) without adding any complexity to the proof, except that the third component could not easily be depicted in Figure 2.

### Volume integral

Our first task is to use the fundamental theorem of calculus to perform this integral over the volume of the box. Despite the fact that the vector field points in two directions, the divergence operator $\mathbf {\vec {\nabla }}$ removes any involvement of the y-component, since the field does not depend on $y$:
                      $\mathbf {{\vec {\nabla }}\cdot {\vec {F}}} ={\frac {\partial F_{x}}{\partial x}}={\text{ a function of }}x{\text{ only.}}$         (3)
Integrals over three-dimensional boxes are easy to perform:
                      $\int \left(\mathbf {{\vec {\nabla }}\cdot {\vec {F}}} \right)\,dV=\int _{x_{1}}^{x_{2}}dx\int _{y_{1}}^{y_{2}}dy\int _{z_{1}}^{z_{2}}dz\left({\frac {\partial F_{x}}{\partial x}}\right)$         (4)
Since $\partial F_{x}/\partial x$ does not depend on $y$ or $z,$ the partial derivative may be treated as a constant with regard to those to variables. The integrations in (4) are structured so that they may be performed in any order, which permits us to write:
                      $\int \left(\mathbf {{\vec {\nabla }}\cdot {\vec {F}}} \right)\,dV=$$\underbrace {\int _{x_{1}}^{x_{2}}dx\left({\frac {\partial F_{x}}{\partial x}}\right)} _{F_{x}(x_{2})-F_{x}(x_{1})}\;\underbrace {\int _{y_{1}}^{y_{2}}dy} _{y_{2}-y_{1}}\;\underbrace {\int _{z_{1}}^{z_{2}}dz} _{z_{2}-z_{1}}\,$$=\,\left[F_{x}(x_{2})-F_{x}(x_{1})\right]\cdot A$,         (5)
where $A=(y_{2}-y_{1})(z_{2}-z_{1})$ is the area of the two sides at $x=x_{1}$ and $x=x_{2}$ as shown in Figure 2.

### Surface integrals

Now we calculate the surface integral and verify that it yields the same result as (5). The surface integral over the box involves six rectangles. One way to define a two-dimensional surface in three-dimensions is to state one equation involving the three variables. The six surfaces of the box in Figure 2 can be labeled by the set of six (infinite) planes: $\{x=x_{1},x=x_{2},y=y_{1},y=y_{2},z=z_{1},z=z_{2}\}$. In contrast with one-dimensional integrals, surface and volume integrals require much more than simply stating the two endpoints associated with a one dimensional integral. Each of the six surfaces must be integrated separately, and the integral over the entire surface equals the sum of the six individual integrals. A common shorthand for surface integrals is, ${\hat {\mathbf {n} }}\,d\mathbf {S} =d{\vec {A}}$, where ${\hat {\mathbf {n} }}$ the outward unit normal, and $d\mathbf {S} =\left|d{\vec {A}}\right|.$
                      $\int \underbrace {(\,.\,.\,.)} _{\text{6 sides}}=\overbrace {\int \underbrace {(\,.\,.\,.)} _{x=x_{1}}+\int \underbrace {(\,.\,.\,.)} _{x=x_{2}}} ^{\text{x-pair}}+\overbrace {\int \underbrace {(\,.\,.\,.)} _{y=y_{1}}+\int \underbrace {(\,.\,.\,.)} _{y=y_{2}}} ^{\text{y-pair}}+\overbrace {\int \underbrace {(\,.\,.\,.)} _{z=z_{1}}+\int \underbrace {(\,.\,.\,.)} _{z=z_{2}}} ^{\text{z-pair}}$         (6)

#### Integration over x-pair surfaces

The two most important surfaces are the pair already discussed, with area $A$, and outward unit normals in the x-direction, shown as the left and right ends of the box shown in Figure 2. Since $x$ is constant over each of these two surfaces, the the surface integral of anything that depends only on $\mathbf {\vec {F}} (x)$ is trivial, and depends only on the area, which is the same area, $A$, shown in Figure 2 and also at (5). The algebra for the surface at $x=x_{1}$ is:
                      $\underbrace {\int \left(\mathbf {\vec {F}} \cdot \mathbf {\hat {n}} \right)dS} _{x=x_{1}}=\underbrace {\left(\mathbf {\vec {F}} \cdot \mathbf {\hat {n}} \right)} _{-F_{x}(x_{1})}\cdot \underbrace {\int \,dS} _{A}=-F_{x}(x_{1})\cdot A$.         (7)
To understand how $\mathbf {\vec {F}} \cdot \mathbf {\hat {n}}$ was evaluated in (7), recall that the outward unit normal points in the negative x direction on that side. Also, when a vector is dotted with a unit vector, only one component of the vector survives:
                      $\underbrace {\mathbf {\vec {F}} \cdot \mathbf {\hat {n}} } _{x=x_{1}}=\left(F_{x}\mathbf {\hat {i}} +F_{y}\mathbf {\hat {j}} \right)\cdot \left(-\mathbf {\hat {i}} \right)=-F_{x}$,         (8)
since, $\mathbf {\hat {n}} =-\mathbf {\hat {i}}$, at $x=x_{1}.$ On the other side, $\mathbf {\hat {n}}$ points in the opposite direction, so that combining (5) with (7) establishes that (1) is true, but only if we can establish that the other four surface integrals vanish.

#### Integration over the y-pair and z-pair surfaces

We begin with the y-pair of surfaces, i.e., those that occupy a portion of the $y=y_{1}$ or the $y=y_{2}$ planes. Since the vector field $\mathbf {\vec {F}} (x,y,z)$ depends on the $x$-variable, the integral is not trivial. By the reasoning used at (7) and (8), we only need integrate the $y$-component, $F_{y}$, because the unit vector points in the $\pm \mathbf {\hat {j}}$ direction. Fortunately, the absence of a $y$-dependence of our vector field ensures that the following two integrals are equal:
                      $\underbrace {\iint F_{y}(x)dS} _{y=y_{1}}=\underbrace {\iint F_{y}(x)dS} _{y=y_{2}}=\int _{z_{1}}^{z_{2}}dz\int _{x_{1}}^{x_{2}}F_{y}(x)dx=(z_{2}-z_{1})\int _{x_{1}}^{x_{2}}F_{y}(x)dx$         (9)
Since the outward unit normals, $\mathbf {\hat {n}} =\pm \mathbf {\hat {j}} ,$ are equal and opposite on both sides, the pair of surface integrals at (9) cancel. The same argument can be the $z$-pair of surfaces.

### Conclusion

Although we have proven the divergence theorem on a rectangular box for a small subset of all possible differentiable vector fields ${\vec {F}}({\vec {r}})$, we have established the essential role played by the fundamental theorem of calculus in one-dimension. Essentially, we have placed the two endpoints of segment along the x-axis by the six surfaces that form the boundary of a three-dimensional box. Also, the reader who can grasp this proof is probably capable of developing a proof for any vector field ${\vec {F}}({\vec {r}})$ for which the divergence is well defined. It just takes a lot of algebra.

## Footnotes

* ↑ For example, $x^{2}+y^{2}+z^{3}=1$ is the surface of a unit sphere.
* ↑ Here we adopt the notation that $(\mathbf {\hat {i}} ,\mathbf {\hat {j}} ,\mathbf {\hat {k}} )$ refer to unit vectors in the $(x,y,z)$ directions, respectively.
Subpages: Special:Prefixindex/Divergence theorem/