# Divergence theorem

(Redirected from Gauss' divergence theorem)

In vector calculus, the divergence theorem, also known as Gauss's theorem or Ostrogradsky's theorem, is a result that relates the flux of a vector field through a closed surface to the divergence of the field in the volume enclosed.

More precisely, the divergence theorem states that the surface integral of a vector field over a closed surface, which is called the flux through the surface, is equal to the volume integral of the divergence over the region inside the surface. Intuitively, it states that the sum of all sources of the field in a region (with sinks regarded as negative sources) gives the net flux out of the region.

The divergence theorem is an important result for the mathematics of physics and engineering, in particular in electrostatics and fluid dynamics.

In physics and engineering, the divergence theorem is usually applied in three dimensions. However, it generalizes to any number of dimensions. In one dimension, it is equivalent to integration by parts. In two dimensions, it is equivalent to Green's theorem.

## Explanation using liquid flow

Vector fields are often illustrated using the example of the velocity field of a fluid, such as a gas or liquid. A moving liquid has a velocity—a speed and a direction—at each point, which can be represented by a vector, so that the velocity of the liquid forms a vector field. Consider an imaginary closed surface S inside a body of liquid, enclosing a volume of liquid. The flux of liquid out of the volume is equal to the volume rate of fluid crossing this surface, i.e., the surface integral of the velocity over the surface.

Since liquids are incompressible, the amount of liquid inside a closed volume is constant; if there are no sources or sinks inside the volume then the flux of liquid out of S is zero. If the liquid is moving, it may flow into the volume at some points on the surface S and out of the volume at other points, but the amounts flowing in and out at any moment are equal, so the net flux of liquid out of the volume is zero.

However if a source of liquid is inside the closed surface, such as a pipe through which liquid is introduced, the additional liquid will exert pressure on the surrounding liquid, causing an outward flow in all directions. This will cause a net outward flow through the surface S. The flux outward through S equals the volume rate of flow of fluid into S from the pipe. Similarly if there is a sink or drain inside S, such as a pipe which drains the liquid off, the external pressure of the liquid will cause a velocity throughout the liquid directed inward toward the location of the drain. The volume rate of flow of liquid inward through the surface S equals the rate of liquid removed by the sink.

If there are multiple sources and sinks of liquid inside S, the flux through the surface can be calculated by adding up the volume rate of liquid added by the sources and subtracting the rate of liquid drained off by the sinks. The volume rate of flow of liquid through a source or sink (with the flow through a sink given a negative sign) is equal to the divergence of the velocity field at the pipe mouth, so adding up (integrating) the divergence of the liquid throughout the volume enclosed by S equals the volume rate of flux through S. This is the divergence theorem.

The divergence theorem is employed in any conservation law which states that the total volume of all sinks and sources, that is the volume integral of the divergence, is equal to the net flow across the volume's boundary.

## Mathematical statement

Suppose V is a subset of $\mathbb {R} ^{n}$  (in the case of n = 3, V represents a volume in three-dimensional space) which is compact and has a piecewise smooth boundary S (also indicated with V = S). If F is a continuously differentiable vector field defined on a neighborhood of V, then:‹See TfM›[failed verificationsee discussion]

$\iiint _{V}\left(\mathbf {\nabla } \cdot \mathbf {F} \right)\,dV=$   $S$  $(\mathbf {F} \cdot \mathbf {n} )\,dS.$

The left side is a volume integral over the volume V, the right side is the surface integral over the boundary of the volume V. The closed manifold V is oriented by outward-pointing normals, and n is the outward pointing unit normal at each point on the boundary V. (dS may be used as a shorthand for ndS.) In terms of the intuitive description above, the left-hand side of the equation represents the total of the sources in the volume V, and the right-hand side represents the total flow across the boundary S.

## Informal derivation

The divergence theorem follows from the fact that if a volume $V$  is partitioned into separate parts, the flux out of the original volume is equal to the sum of the flux out of each component volume. This is true despite the fact that the new subvolumes have surfaces that were not part of the original volume's surface, because these surfaces are just partitions between two of the subvolumes and the flux through them just passes from one volume to the other and so cancels out when the flux out of the subvolumes is summed.

A volume divided into two subvolumes. At right the two subvolumes are separated to show the flux out of the different surfaces.

See the diagram. A closed, bounded volume $V$  is divided into two volumes $V_{1}$  and $V_{2}$  by a surface $S_{3}$  (green). The flux $\Phi (V_{\text{i}})$  out of each component region $V_{\text{i}}$  is equal to the sum of the flux through its two faces, so the sum of the flux out of the two parts is

$\Phi (V_{\text{1}})+\Phi (V_{\text{2}})=\Phi _{\text{1}}+\Phi _{\text{31}}+\Phi _{\text{2}}+\Phi _{\text{32}}$

where $\Phi _{\text{1}}$  and $\Phi _{\text{2}}$  are the flux out of surfaces $S_{1}$  and $S_{2}$ , $\Phi _{\text{31}}$  is the flux through $S_{3}$  out of volume 1, and $\Phi _{\text{32}}$  is the flux through $S_{3}$  out of volume 2. The point is that surface $S_{3}$  is part of the surface of both volumes. The "outward" direction of the normal vector ${\hat {n}}$  is opposite for each volume, so the flux out of one through $S_{3}$  is equal to the negative of the flux out of the other

$\Phi _{\text{32}}=\iint _{S_{3}}\mathbf {F} \cdot \mathbf {(} -{\hat {n}})\;dS=-\iint _{S_{3}}\mathbf {F} \cdot \mathbf {\hat {n}} \;dS=-\Phi _{\text{31}}$

so these two fluxes cancel in the sum. Therefore

$\Phi (V_{\text{1}})+\Phi (V_{\text{2}})=\Phi _{\text{1}}+\Phi _{\text{2}}$

Since the union of surfaces $S_{1}$  and $S_{2}$  is $S$

$\Phi (V_{\text{1}})+\Phi (V_{\text{2}})=\Phi (V)$

The volume can be divided into many subvolumes and the flux out of V is equal to the sum of the flux out of each subvolume, because the flux through the green surfaces cancels out in the sum. In (b) the volumes are shown separated slightly, illustrating that each green partition is part of the boundary of two adjacent volumes

This principle applies to a volume divided into any number of parts, as shown in the diagram. Since the integral over each internal partition (green surfaces) appears with opposite signs in the flux of the two adjacent volumes they cancel out, and the only contribution to the flux is the integral over the external surfaces (grey). Since the external surfaces of all the component volumes equal the original surface.

$\Phi (V)=\sum _{V_{\text{i}}\subset V}\Phi (V_{\text{i}})$

As the volume is subdivided into smaller parts, the ratio of the flux $\Phi (V_{\text{i}})$  out of each volume to the volume $|V_{\text{i}}|$  approaches $\operatorname {div} \mathbf {F}$

The flux $\Phi$  out of each volume is the surface integral of the vector field $\mathbf {F} (\mathbf {x} )$  over the surface

$\iint _{S(V)}\mathbf {F} \cdot \mathbf {\hat {n}} \;dS=\sum _{V_{\text{i}}\subset V}\iint _{S(V_{\text{i}})}\mathbf {F} \cdot \mathbf {\hat {n}} \;dS$

The goal is to divide the original volume into infinitely many infinitesimal volumes. As the volume is divided into smaller and smaller parts, the surface integral on the right, the flux out of each subvolume, approaches zero because the surface area $S(V_{\text{i}})$  approaches zero. However, from the definition of divergence, the ratio of flux to volume, ${\Phi (V_{\text{i}}) \over |V_{\text{i}}|}={1 \over |V_{\text{i}}|}\iint _{S(V_{\text{i}})}\mathbf {F} \cdot \mathbf {\hat {n}} \;dS$ , the part in parentheses below, does not in general vanish but approaches the divergence $\operatorname {div} \mathbf {F}$  as the volume approaches zero.

$\iint _{S(V)}\mathbf {F} \cdot \mathbf {\hat {n}} \;dS=\sum _{V_{\text{i}}\subset V}{\Big (}{1 \over |V_{\text{i}}|}\iint _{S(V_{\text{i}})}\mathbf {F} \cdot \mathbf {\hat {n}} \;dS{\Big )}|V_{\text{i}}|$

As long as the vector field $\mathbf {F} (\mathbf {x} )$  has continuous derivatives, the sum above holds even in the limit when the volume is divided into infinitely small increments

$\iint _{S(V)}\mathbf {F} \cdot \mathbf {\hat {n}} \;dS=\lim _{|V_{\text{i}}|\to 0}\sum _{V_{\text{i}}\subset V}{\Big (}{1 \over |V_{\text{i}}|}\iint _{S(V_{\text{i}})}\mathbf {F} \cdot \mathbf {\hat {n}} \;dS{\Big )}|V_{\text{i}}|$

As $|V_{\text{i}}|$  approaches zero volume, it becomes the infinitesimal $dV$ , the part in parentheses becomes the divergence, and the sum becomes a volume integral over $V$

$\;\iint _{S(V)}\mathbf {F} \cdot \mathbf {\hat {n}} \;dS=\iiint _{V}\operatorname {div} \mathbf {F} \;dV\;$

Since this derivation is coordinate free, it shows that the divergence does not depend on the coordinates used.

## Corollaries

By replacing $\mathbf {F}$  in the divergence theorem with specific forms, other useful identities can be derived (cf. vector identities).

• With $\mathbf {F} \rightarrow \mathbf {F} g$  for a scalar function g and a vector field F,
$\iiint _{V}\left[\mathbf {F} \cdot \left(\nabla g\right)+g\left(\nabla \cdot \mathbf {F} \right)\right]dV=$   $S$  $g\mathbf {F} \cdot \mathbf {n} dS.$
A special case of this is F = ∇ f, in which case the theorem is the basis for Green's identities.
• With $\mathbf {F} \rightarrow \mathbf {F} \times \mathbf {G}$  for two vector fields F and G, where $\times$  denotes a cross product,
$\iiint _{V}\left[\mathbf {G} \cdot \left(\nabla \times \mathbf {F} \right)-\mathbf {F} \cdot \left(\nabla \times \mathbf {G} \right)\right]\,dV=$   $S$  $(\mathbf {F} \times \mathbf {G} )\cdot \mathbf {n} d\mathbf {S} .$
• With $\mathbf {F} \rightarrow \mathbf {F} \cdot \mathbf {G}$  for two vector fields F and G, where $\cdot$  denotes a dot product,
$\iiint _{V}\nabla \left(\mathbf {F} \cdot \mathbf {G} \right)dV=\iiint _{V}\left[\mathbf {F} \cdot \left(\nabla \cdot \mathbf {G} \right)+\left(\nabla \cdot \mathbf {F} \right)\cdot \mathbf {G} \right]\,dV=$   $S$  $(\mathbf {F} \cdot \mathbf {G} )\cdot \mathbf {n} d\mathbf {S} .$
• With $\mathbf {F} \rightarrow f\mathbf {c}$  for a scalar function f and vector field c:
$\iiint _{V}\mathbf {c} \cdot \nabla f\,dV=$   $S$  $(\mathbf {c} f)\cdot \mathbf {n} dS-\iiint _{V}f(\nabla \cdot \mathbf {c} )\,dV.$
The last term on the right vanishes for constant $\mathbf {c}$  or any divergence free (solenoidal) vector field, e.g. Incompressible flows without sources or sinks such as phase change or chemical reactions etc. In particular, taking $\mathbf {c}$  to be constant:
$\iiint _{V}\nabla f\,dV=$   $S$  $fd\mathbf {S} .$
• With $\mathbf {F} \rightarrow \mathbf {c} \times \mathbf {F}$  for vector field F and constant vector c:
$\iiint _{V}\mathbf {c} \cdot (\nabla \times \mathbf {F} )\,dV=$   $S$  $(\mathbf {F} \times \mathbf {c} )\cdot \mathbf {n} d\mathbf {S} .$
By reordering the triple product on the right hand side and taking out the constant vector of the integral,
$\iiint _{V}(\nabla \times \mathbf {F} )\,dV\cdot \mathbf {c} =$   $S$  $(d\mathbf {S} \times \mathbf {F} )\cdot \mathbf {c} .$
Hence,
$\iiint _{V}(\nabla \times \mathbf {F} )\,dV=$   $S$  $\mathbf {n} \times \mathbf {F} dS.$

## Example

The divergence theorem can be used to calculate a flux through a closed surface that fully encloses a volume, like any of the surfaces on the left. It can not directly be used to calculate the flux through surfaces with boundaries, like those on the right. (Surfaces are blue, boundaries are red.)

Suppose we wish to evaluate

$S$  $\mathbf {F} \cdot \mathbf {n} \,dS,$

where S is the unit sphere defined by

$S=\left\{(x,y,z)\in \mathbb {R} ^{3}\ :\ x^{2}+y^{2}+z^{2}=1\right\},$

and F is the vector field

$\mathbf {F} =2x\mathbf {i} +y^{2}\mathbf {j} +z^{2}\mathbf {k} .$

The direct computation of this integral is quite difficult, but we can simplify the derivation of the result using the divergence theorem, because the divergence theorem says that the integral is equal to:

$\iiint _{W}(\nabla \cdot \mathbf {F} )\,dV=2\iiint _{W}(1+y+z)\,dV=2\iiint _{W}dV+2\iiint _{W}y\,dV+2\iiint _{W}z\,dV,$

where W is the unit ball:

$W=\left\{(x,y,z)\in \mathbb {R} ^{3}\ :\ x^{2}+y^{2}+z^{2}\leq 1\right\}.$

Since the function y is positive in one hemisphere of W and negative in the other, in an equal and opposite way, its total integral over W is zero. The same is true for z:

$\iiint _{W}y\,dV=\iiint _{W}z\,dV=0.$

Therefore,

$S$  $\mathbf {F} \cdot \mathbf {n} \,{d}S=2\iiint _{W}\,dV={\frac {8\pi }{3}},$

because the unit ball W has volume 4π/3.

## Applications

### Differential form and integral form of physical laws

As a result of the divergence theorem, a host of physical laws can be written in both a differential form (where one quantity is the divergence of another) and an integral form (where the flux of one quantity through a closed surface is equal to another quantity). Three examples are Gauss's law (in electrostatics), Gauss's law for magnetism, and Gauss's law for gravity.

#### Continuity equations

Continuity equations offer more examples of laws with both differential and integral forms, related to each other by the divergence theorem. In fluid dynamics, electromagnetism, quantum mechanics, relativity theory, and a number of other fields, there are continuity equations that describe the conservation of mass, momentum, energy, probability, or other quantities. Generically, these equations state that the divergence of the flow of the conserved quantity is equal to the distribution of sources or sinks of that quantity. The divergence theorem states that any such continuity equation can be written in a differential form (in terms of a divergence) and an integral form (in terms of a flux).

### Inverse-square laws

Any inverse-square law can instead be written in a Gauss's law-type form (with a differential and integral form, as described above). Two examples are Gauss's law (in electrostatics), which follows from the inverse-square Coulomb's law, and Gauss's law for gravity, which follows from the inverse-square Newton's law of universal gravitation. The derivation of the Gauss's law-type equation from the inverse-square formulation or vice versa is exactly the same in both cases; see either of those articles for details.

## History

The theorem was first discovered by Lagrange in 1762, then later independently rediscovered by Gauss in 1813, by Ostrogradsky, who also gave the first proof of the general theorem, in 1826, by Green in 1828, Simeon-Denis Poisson in 1824 and Frédéric Sarrus in 1828.

## Worked examples

### Example 1

To verify the planar variant of the divergence theorem for a region $R$ :

$R=\left\{(x,y)\in \mathbb {R} ^{2}\ :\ x^{2}+y^{2}\leq 1\right\},$

and the vector field:

$\mathbf {F} (x,y)=2y\mathbf {i} +5x\mathbf {j} .$

The boundary of $R$  is the unit circle, $C$ , that can be represented parametrically by:

$x=\cos(s),\quad y=\sin(s)$

such that $0\leq s\leq 2\pi$  where $s$  units is the length arc from the point $s=0$  to the point $P$  on $C$ . Then a vector equation of $C$  is

$C(s)=\cos(s)\mathbf {i} +\sin(s)\mathbf {j} .$

At a point $P$  on $C$ :

$P=(\cos(s),\,\sin(s))\,\Rightarrow \,\mathbf {F} =2\sin(s)\mathbf {i} +5\cos(s)\mathbf {j} .$

Therefore,

{\begin{aligned}\oint _{C}\mathbf {F} \cdot \mathbf {n} \,ds&=\int _{0}^{2\pi }(2\sin(s)\mathbf {i} +5\cos(s)\mathbf {j} )\cdot (\cos(s)\mathbf {i} +\sin(s)\mathbf {j} )\,ds\\&=\int _{0}^{2\pi }(2\sin(s)\cos(s)+5\sin(s)\cos(s))\,ds\\&=7\int _{0}^{2\pi }\sin(s)\cos(s)\,ds\\&=0.\end{aligned}}

Because $M=2y,{\frac {\partial M}{\partial x}}=0$ , and because $N=5x,{\frac {\partial N}{\partial y}}=0$ . Thus

$\iint _{R}\,\mathbf {\nabla } \cdot \mathbf {F} \,dA=\iint _{R}\left({\frac {\partial M}{\partial x}}+{\frac {\partial N}{\partial y}}\right)\,dA=0.$

### Example 2

Let's say we wanted to evaluate the flux of the following vector field defined by $\mathbf {F} =2x^{2}{\textbf {i}}+2y^{2}{\textbf {j}}+2z^{2}{\textbf {k}}$  bounded by the following inequalities:

$\left\{0\leq x\leq 3\right\}\left\{-2\leq y\leq 2\right\}\left\{0\leq z\leq 2\pi \right\}$

By the divergence theorem,

$\iiint _{V}\left(\mathbf {\nabla } \cdot \mathbf {F} \right)dV=$   $S$  $(\mathbf {F} \cdot \mathbf {n} )\,dS.$

We now need to determine the divergence of ${\textbf {F}}$ . If $\mathbf {F}$  is a three-dimensional vector field, then the divergence of ${\textbf {F}}$  is given by $\nabla \cdot {\textbf {F}}=\left({\frac {\partial }{\partial x}}{\textbf {i}}+{\frac {\partial }{\partial y}}{\textbf {j}}+{\frac {\partial }{\partial z}}{\textbf {k}}\right)\cdot {\textbf {F}}$ .

Thus, we can set up the following the flux integral $I=$   ${S}$  $\mathbf {F} \cdot \mathbf {n} dS,$  as follows:

{\begin{aligned}I&=\iiint _{V}\nabla \cdot \mathbf {F} dV\\[6pt]&=\iiint _{V}{\frac {\partial \mathbf {F_{x}} }{\partial {x}}}+{\frac {\partial \mathbf {F_{y}} }{\partial {y}}}+{\frac {\partial \mathbf {F_{z}} }{\partial {z}}}dV\\[6pt]&=\iiint _{V}4x+4y+4zdV\\[6pt]&=\int _{0}^{3}\int _{-2}^{2}\int _{0}^{2\pi }4x+4y+4z\,dV\end{aligned}}

Now that we have set up the integral, we can evaluate it.

{\begin{aligned}\int _{0}^{3}\int _{-2}^{2}\int _{0}^{2\pi }4x+4y+4zdV&=\int _{-2}^{2}\int _{0}^{2\pi }12y+12z+18dydz\\[6pt]&=\int _{0}^{2\pi }24(2z+3)\,dz\\[6pt]&=48\pi \cdot (2\pi +3)\end{aligned}}

## Generalizations

### Multiple dimensions

One can use the general Stokes' Theorem to equate the n-dimensional volume integral of the divergence of a vector field F over a region U to the (n − 1)-dimensional surface integral of F over the boundary of U:

$\underbrace {\int \cdots \int _{U}} _{n}\nabla \cdot \mathbf {F} \,dV=\underbrace {\oint \cdots \oint _{\partial U}} _{n-1}\mathbf {F} \cdot \mathbf {n} \,dS$

This equation is also known as the divergence theorem.

When n = 2, this is equivalent to Green's theorem.

When n = 1, it reduces to integration by parts.

### Tensor fields

Writing the theorem in Einstein notation:

$\iiint _{V}{\dfrac {\partial \mathbf {F} _{i}}{\partial x_{i}}}dV=$   $S$  $\mathbf {F} _{i}n_{i}\,dS$

suggestively, replacing the vector field F with a rank-n tensor field T, this can be generalized to:

$\iiint _{V}{\dfrac {\partial T_{i_{1}i_{2}\cdots i_{q}\cdots i_{n}}}{\partial x_{i_{q}}}}dV=$   $S$  $T_{i_{1}i_{2}\cdots i_{q}\cdots i_{n}}n_{i_{q}}\,dS.$

where on each side, tensor contraction occurs for at least one index. This form of the theorem is still in 3d, each index takes values 1, 2, and 3. It can be generalized further still to higher (or lower) dimensions (for example to 4d spacetime in general relativity).