# Divergence theorem

In vector calculus, the divergence theorem, also known as Gauss's theorem or Ostrogradsky's theorem, is a result that relates the flow (that is, flux) of a vector field through a surface to the behavior of the tensor field inside the surface.

More precisely, the divergence theorem states that the outward flux of a tensor field through a closed 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 (with sinks regarded as negative sources) gives the net flux out of a 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 the fundamental theorem of calculus. In two dimensions, it is equivalent to Green's theorem.

## Intuition

If a fluid is flowing in some area, then the rate at which fluid flows out of a certain region within that area can be calculated by adding up the sources inside the region and subtracting the sinks. The fluid flow is represented by a first order tensor (or vector) field, and the vector field's divergence at a given point describes the strength of the source or sink there. So, integrating the field's divergence over the interior of the region should equal the integral of the vector field over the region's boundary. The divergence theorem says that this is true.

The divergence theorem is employed in any conservation law which states that the volume total 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 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 V is a subset of $\mathbb ^$ (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 we have:

$\iiint _\left(\mathbf {\nabla } \cdot \mathbf \right)\,dV=$  $S$ $(\mathbf \cdot \mathbf )\,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 quite generally the boundary of V oriented by outward-pointing normals, and n is the outward pointing unit normal field of the boundary V. (dS may be used as a shorthand for ndS.) The symbol within the two integrals stresses once more that V is a closed surface. 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.

### Corollaries

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

• With $\mathbf \rightarrow \mathbf g$ for a scalar function g and a vector field F,
$\iiint _\left[\mathbf \cdot \left(\nabla g\right)+g\left(\nabla \cdot \mathbf \right)\right]dV=$  $S$ $g\mathbf \cdot \mathbf dS.$ A special case of this is F = ∇ f, in which case the theorem is the basis for Green's identities.
• With $\mathbf \rightarrow \mathbf \times \mathbf$ for two vector fields F and G,
$\iiint _\left[\mathbf \cdot \left(\nabla \times \mathbf \right)-\mathbf \cdot \left(\nabla \times \mathbf \right)\right]\,dV=$  $S$ $(\mathbf \times \mathbf )\cdot \mathbf d\mathbf .$ • With $\mathbf \rightarrow f\mathbf$ for a scalar function f and vector field c:
$\iiint _\mathbf \cdot \nabla f\,dV=$  $S$ $(\mathbf f)\cdot \mathbf dS-\iiint _f(\nabla \cdot \mathbf )\,dV.$ The last term on the right vanishes for constant $\mathbf$ 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$ to be constant:
$\iiint _\nabla f\,dV=$  $S$ $fd\mathbf .$ • With $\mathbf \rightarrow \mathbf \times \mathbf$ for vector field F and constant vector c:
$\iiint _\mathbf \cdot (\nabla \times \mathbf )\,dV=$  $S$ $(\mathbf \times \mathbf )\cdot \mathbf d\mathbf .$ By reordering the triple product on the right hand side and taking out the constant vector of the integral,
$\iiint _(\nabla \times \mathbf )\,dV\cdot \mathbf =$  $S$ $(d\mathbf \times \mathbf )\cdot \mathbf .$ Hence,
$\iiint _(\nabla \times \mathbf )\,dV=$  $S$ $\mathbf \times \mathbf dS.$ ## Example

Suppose we wish to evaluate $S$ $\mathbf \cdot \mathbf \,dS,$ where S is the unit sphere defined by

$S=\left\{(x,y,z)\in \mathbb ^\ :\ x^+y^+z^=1\right\},$ and F is the vector field

$\mathbf =2x\mathbf +y^\mathbf +z^\mathbf .$ 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 _(\nabla \cdot \mathbf )\,dV=2\iiint _(1+y+z)\,dV=2\iiint _dV+2\iiint _y\,dV+2\iiint _z\,dV,$ where W is the unit ball:

$W=\left\{(x,y,z)\in \mathbb ^\ :\ x^+y^+z^\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 _y\,dV=\iiint _z\,dV=0.$ Therefore, $S$ $\mathbf \cdot \mathbf \,S=2\iiint _\,dV={\frac },$ 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.

## Examples

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

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

$\mathbf (x,y)=2y\mathbf +5x\mathbf .$ 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 ≤ s ≤ 2π 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 +\sin(s)\mathbf .$ At a point P on C:

$P=(\cos(s),\,\sin(s))\,\Rightarrow \,\mathbf =2\sin(s)\mathbf +5\cos(s)\mathbf .$ Therefore,

${\begin\oint _\mathbf \cdot \mathbf \,ds&=\int _^(2\sin(s)\mathbf +5\cos(s)\mathbf )\cdot (\cos(s)\mathbf +\sin(s)\mathbf )\,ds\\&=\int _^(2\sin(s)\cos(s)+5\sin(s)\cos(s))\,ds\\&=7\int _^\sin(s)\cos(s)\,ds\\&=0.\end}$ Because M = 2y, M/x = 0, and because N = 5x, N/y = 0. Thus

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

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

$\left\\left\{-2\leq y\leq 2\right\}\left\$ We know from the Divergence Theorem that :$\iiint _\left(\mathbf {\nabla } \cdot \mathbf \right)\,dV=$  $S$ $(\mathbf \cdot \mathbf )\,dS.$ We need to determine $\nabla \cdot \mathbf$ The divergence of a three dimensional vector field, $\mathbf$ , is defined as ${\frac {\partial \mathbf } }{\partial }}+{\frac {\partial \mathbf } }{\partial }}+{\frac {\partial \mathbf } }{\partial }}$ Thus, we can set up the following integrals: ${S}$ $\mathbf \cdot \mathbf \,dS$ ${\begin&=\iiint _\nabla \cdot \mathbf \,dV\\&=\iiint _{\frac {\partial \mathbf } }{\partial }}+{\frac {\partial \mathbf } }{\partial }}+{\frac {\partial \mathbf } }{\partial }}\,dV\\&=\iiint _4x+4y+4z\,dV\\&=\int _^\int _{-2}^\int _^4x+4y+4z\,dV\end}$ Now that we have set up the integral, we can evaluate it.

${\begin&\int _^\int _{-2}^\int _^4x+4y+4z\,dV\\&=\int _{-2}^\int _^12y+12z+18\,dy\,dz\\&=\int _^24(2z+3)\,dz\\&=48\pi \cdot (2\pi +3)\\&\approx \end}$ ## 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 _} _\nabla \cdot \mathbf \,dV=\underbrace {\oint \cdots \oint _{\partial U}} _\mathbf \cdot \mathbf \,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 the Fundamental theorem of calculus.

### Tensor fields

Writing the theorem in Einstein notation:

$\iiint _{\dfrac {\partial \mathbf _}{\partial x_}}dV=$  $S$ $\mathbf _n_\,dS$ suggestively, replacing the vector field F with a rank-n tensor field T, this can be generalized to:

$\iiint _{\dfrac {\partial T_i_\cdots i_\cdots i_}}{\partial x_}}}dV=$  $S$ $T_i_\cdots i_\cdots i_}n_}\,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).