1. Definition
    1. div ( U ) \text{div}(\mathbf{U})
      1. Example – div ( U ) \text{div}(\mathbf{U}) for U = U x ( x ) x ^ \mathbf{U}=U_x(x)\mathbf{\hat{x}}
    2. U \boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U}
      1. Example – U = U o x ^ \mathbf{U}=U_o\mathbf{\hat{x}}
      2. Example – U = U o s ^ \mathbf{U}=U_o\hat{\mathbf{s}}
      3. U = U o r ^ \mathbf{U}=U_o\hat{\mathbf{r}}
      4. Example – Divergence of E \mathbf{E} Due to Solid Sphere of Charge
      5. Problem
      6. Divergence of E \mathbf{E} Due to Solid Sphere of Charge
  2. The Divergence Theorem
    1. Example – U = r ^ \mathbf{U}=\hat{\mathbf{r}}
    2. Problems
      1. U = r r ^ \mathbf{U}=r\hat{\mathbf{r}}
      2. E \mathbf{E} Due to Solid Sphere of Charge
      3. Radial Field and Sphere not Centered on Origin

See 1.2.4 of Griffiths.

The divergence of a vector field is is a scalar function of position and is defined to be

div ( U ) = lim Δ τ 0 U d A Δ τ = lim Δ τ 0 Φ U Δ τ \text{div}(\mathbf{U})=\lim_{\Delta \tau\rightarrow 0}\frac{\oint \mathbf{U}\boldsymbol{\cdot} d\mathbf{A}}{\Delta \tau}=\lim_{\Delta \tau\rightarrow 0}\frac{\Phi_U}{\Delta \tau}

at any point in space, where Δ τ \Delta \tau is a differential volume that surrounds the point. The numerator is a flux, so the physical interpretation is that it is proportional to the net flux into or out of a vanishingly small volume.

In general, this formula will not be used to compute divergence. However, it is important to understand its meaning by using it at least once, which is done in the following example.

Note that Griffiths does not state the definition given above. Instead, in Chapter 1.2.4, he uses the formula U \boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U} and states that the divergence is “a measure of how much the vector U \mathbf{U} spreads out (diverges) from the point in question”. One needs to be very careful with this definition as it does not always work as expected. The vector fields and field lines for U = s ^ / s \mathbf{U}=\hat{\mathbf{s}}/s and U = r ^ / r 2 \mathbf{U}=\hat{\mathbf{r}}/r^2 appear to be diverging everwhere. However, for these two U \mathbf{U} , div ( U ) \text{div}(\mathbf{U}) is zero everwhere except at the origin.

There are two vector functions for each coordinate system that you should know the divergence for.

Cartesian

  1. U = x ^ \mathbf{U} = \mathbf{\hat{x}} for x > 0 x>0 and U = x ^ \mathbf{U} = \mathbf{\hat{x}} for x < 0 x<0 – the divergence is zero for all x x except as x 0 x \rightarrow 0 where it approaches infinity.

  2. U = x x ^ \mathbf{U} = x\mathbf{\hat{x}} – the divergence is constant for all x x

Cylindrical

  1. U = s s ^ \mathbf{U}=s\hat{\mathbf{s}} – the divergence is constant for all s s

  2. U = s ^ / s \mathbf{U}=\hat{\mathbf{s}}/s – the divergence is zero for all s s except as s 0 s\rightarrow 0 where it approaches infinity.

Spherical

  1. U = r r ^ \mathbf{U}=r\hat{\mathbf{r}} – the divergence is constant for all r r

  2. U = r ^ / r 2 \mathbf{U}=\hat{\mathbf{r}}/r^2 – the divergence is zero for all r r except as r 0 r\rightarrow 0 where it approaches infinity.

If U = U x ( x ) x ^ \mathbf{U}=U_x(x)\mathbf{\hat{x}}

1. Compute div ( U ) \text{div}(\mathbf{U}) that applies for any point x x .

2. Evaluate div ( U ) \text{div}(\mathbf{U}) when U x ( x ) = U o U_x(x)=U_o

Answer

A side view of a cube centered on the origin with sides of length Δ x \Delta x , Δ y \Delta y , and Δ z \Delta z is shown in the following figure.

1. Only two of the six sides contribute to the flux U d A \oint \mathbf{U}\boldsymbol{\cdot} d\mathbf{A} . The right face at x = Δ x / 2 x=\Delta x/2 contributes + U x ( x + Δ x / 2 ) Δ y Δ z +U_x(x+\Delta x/2)\Delta y\Delta z and the left face at x = Δ x / 2 x=-\Delta x/2 contributes U x ( x Δ x / 2 ) Δ y Δ z -U_x(x-\Delta x/2)\Delta y\Delta z . The differential volume is Δ τ = Δ x Δ y Δ z \Delta \tau = \Delta x\Delta y\Delta z . As a result,

div ( U ) = lim Δ τ 0 U d A Δ τ \displaystyle\text{div}(\mathbf{U})=\lim_{\Delta \tau\rightarrow 0}\frac{\oint \mathbf{U}\boldsymbol{\cdot} d\mathbf{A}}{\Delta \tau}

div ( U ) = lim Δ τ 0 + U x ( x + Δ x / 2 ) Δ y Δ z U x ( x Δ x / 2 ) Δ y Δ z Δ x Δ y Δ z \displaystyle\phantom{\text{div}(\mathbf{U})}=\lim_{\Delta \tau\rightarrow 0}\frac{+U_x(x+\Delta x/2)\Delta y\Delta z-U_x(x-\Delta x/2)\Delta y\Delta z}{\Delta x\Delta y\Delta z}

This simplifies to

div ( U ) = lim Δ x 0 U x ( x + Δ x / 2 ) U x ( x Δ x / 2 ) Δ x \displaystyle\text{div}(\mathbf{U})=\lim_{\Delta x\rightarrow 0}\frac{U_x(x+\Delta x/2)-U_x(x-\Delta x/2)}{\Delta x}

which is the definition of the derivative of U x ( x ) U_x(x) . We conclude that

div ( U ) = d U x ( x ) d x \displaystyle\text{div}(\mathbf{U})=\frac{dU_x(x)}{dx}

2. When U x ( x ) = U o U_x(x)=U_o , d U x ( x ) d x = 0 \displaystyle\frac{dU_x(x)}{dx}=0 , so div ( U ) = 0 \text{div}(\mathbf{U})=0 . The geometrical interpretation of this result is that for a small volume the flux in equals the flux out, which should be clear from the diagram and then flow analogy of field lines.

If U x / x \partial U_x/\partial x , U y / y \partial U_y/\partial y , and U z / z \partial U_z/\partial z all exist, then we do not need to evaluate a surface integral and take a limit to compute div ( U ) \text{div}(\mathbf{U}) . In this case, in cartesian coordinates, it can be shown that

div ( U ) = U = U x x + U y y + U z z \text{div}(\mathbf{U}) = \boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U}=\frac{\partial U_x}{\partial x}+\frac{\partial U_y}{\partial y}+\frac{\partial U_z}{\partial z}

where the definition

x ^ x + y ^ y + z ^ f z \boldsymbol{\nabla} \equiv \mathbf{\hat{x}}\frac{\partial }{\partial x}+\mathbf{\hat{y}}\frac{\partial }{\partial y}+\mathbf{\hat{z}}\frac{\partial f}{\partial z}

was used. If U = U x ( x ) x ^ \mathbf{U}=U_x(x)\mathbf{\hat{x}} as in the previous problem, we get U = U x ( x ) x = d U x ( x ) d x \boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U}=\frac{\partial U_x(x)}{\partial x}=\frac{d U_x(x)}{d x} , which is the same result found using the definition of div ( U ) \text{div}(\mathbf{U}) involving a limit in the previous example.

In general, we will compute divergences using the formula U \boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U} instead of the equation that defines div ( U ) \text{div}(\mathbf{U}) .

Caution: It is easy to mix up the gradient and divergence. The gradient involves applying the vector operator \boldsymbol{\nabla} to a scalar function f ( x , y , z ) f(x,y,z) , so the result is a vector:

f ( x , y , z ) = f x x ^ + f y y ^ + f z z ^ \displaystyle\boldsymbol{\nabla}f(x,y,z)=\frac{\partial f}{\partial x}\mathbf{\hat{x}}+\frac{\partial f}{\partial y}\mathbf{\hat{y}}+\frac{\partial f}{\partial z}\mathbf{\hat{z}}

The divergence involves dotting the vector operator \boldsymbol{\nabla} with a vector function U ( x , y , z ) \mathbf{U}(x,y,z) , so the result is a scalar:

U = U x ( x , y , z ) x + U y ( x , y , z ) y + U z ( x , y , z ) z \displaystyle\boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U}=\frac{\partial U_x(x,y,z)}{\partial x}+\frac{\partial U_y(x,y,z)}{\partial y}+\frac{\partial U_z(x,y,z)}{\partial z}

If U = U o x ^ \mathbf{U}=U_o\mathbf{\hat{x}} , compute div ( U ) \text{div}(\mathbf{U}) using U \boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U} .

Answer:

Here U x = U o U_x=U_o and U y = U z = 0 U_y=U_z=0 so

U = U x ( x , y , z ) x + U y ( x , y , z ) y + U z ( x , y , z ) z = U o x = 0 \displaystyle\boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U}=\frac{\partial U_x(x,y,z)}{\partial x}+\frac{\partial U_y(x,y,z)}{\partial y}+\frac{\partial U_z(x,y,z)}{\partial z}=\frac{\partial U_o}{\partial x}=0

which is the same result found in the previous example using the definition of div ( U ) \text{div}(\mathbf{U})

If U = U o s ^ \mathbf{U}=U_o\hat{\mathbf{s}} , compute div ( U ) \text{div}(\mathbf{U}) using U \boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U} .

Answer:

To compute

U = U x ( x , y , z ) x + U y ( x , y , z ) y + U z ( x , y , z ) z \displaystyle\boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U}=\frac{\partial U_x(x,y,z)}{\partial x}+\frac{\partial U_y(x,y,z)}{\partial y}+\frac{\partial U_z(x,y,z)}{\partial z}

we need to first write s ^ \mathbf{\hat{s}} fully in cartesian coordinates. From Vectors, s ^ = cos ϕ x ^ + sin ϕ y ^ \hat{\mathbf{s}} = \cos\phi\mathbf{\hat{x}} + \sin\phi\mathbf{\hat{y}} , cos ϕ = x / ( x 2 + y 2 ) 1 / 2 \cos\phi = x/(x^2+y^2)^{1/2} , and sin ϕ = y / ( x 2 + y 2 ) 1 / 2 \sin\phi = y/(x^2+y^2)^{1/2} , so

s ^ = x ( x 2 + y 2 ) 1 / 2 x ^ + y ( x 2 + y 2 ) 1 / 2 y ^ \hat{\mathbf{s}}=\frac{x}{(x^2+y^2)^{1/2}}\mathbf{\hat{x}} + \frac{y}{(x^2+y^2)^{1/2}}\mathbf{\hat{y}}

and thus U x = U o x / ( x 2 + y 2 ) 1 / 2 U_x=U_ox/(x^2+y^2)^{1/2} , U y = U o y / ( x 2 + y 2 ) 1 / 2 U_y = U_o y/(x^2+y^2)^{1/2} , and U z = 0 U_z=0 . To finish the problem, evaluate

U x ( x , y , z ) x + U y ( x , y , z ) y + U z ( x , y , z ) z \displaystyle\frac{\partial U_x(x,y,z)}{\partial x}+\frac{\partial U_y(x,y,z)}{\partial y}+\frac{\partial U_z(x,y,z)}{\partial z}

The result should be U o ( x 2 + y 2 ) 1 / 2 = U o s \displaystyle\frac{U_o}{(x^2+y^2)^{1/2}}=\frac{U_o}{s} .

An easier way to solve this is to use the vector operator \boldsymbol{\nabla} written in cylindrical coordinates. The equation is given on the second–to–last page of Griffiths and is

U = 1 s ( s U s ) s + 1 s U ϕ ϕ + U z z \displaystyle\boldsymbol{\nabla}\cdot\mathbf{U}={1 \over s}{\partial \left( s U_s \right) \over \partial s}+{1 \over s}{\partial U_\phi \over \partial \phi}+{\partial U_z \over \partial z}

For U = U o s ^ \mathbf{U}=U_o\hat{\mathbf{s}} , U s = U o U_s=U_o and U ϕ = U z = 0 U_\phi=U_z=0 and so the last two terms are zero and the first term is straight–forward to calculate:

U = 1 s ( s U s ) s = 1 s ( s U o ) s = U o s = U o ( x 2 + y 2 ) 1 / 2 \displaystyle\boldsymbol{\nabla}\cdot\mathbf{U}={1 \over s}{\partial \left( s U_s \right) \over \partial s}=\frac{1}{s}\frac{\partial (sU_o)}{\partial s}=\frac{U_o}{s}=\frac{U_o}{(x^2+y^2)^{1/2}}

Sketch the vector field U = U o r ^ \mathbf{U}=U_o\hat{\mathbf{r}} and then compute div ( U ) \text{div}(\mathbf{U}) using U \boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U} in two ways:

1. using the equation for \boldsymbol{\nabla} fully in cartesian coordinates, and

2. using the equation for \boldsymbol{\nabla} fully in spherical coordinates.

Outside of a solid and long cylinder of radius R R with a uniform linear charge density of λ \lambda , the field is

E ( s ) = 2 k λ s ^ s \displaystyle\mathbf{E}(s)=2k\lambda\frac{\boldsymbol{\hat{s}}}{s}

inside, it is

E ( s ) = 2 k λ s R 2 s ^ \displaystyle\mathbf{E}(s)=2k\lambda\frac{s}{R^2}\boldsymbol{\hat{s}}

Compute E \boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{E} using any coordinate system and plot it versus s s .

Answer

In cylindrical coordinates,

U = 1 s ( s U s ) s + 1 s U ϕ ϕ + U z z \displaystyle\boldsymbol{\nabla}\cdot\mathbf{U}={1 \over s}{\partial \left( s U_s \right) \over \partial s}+{1 \over s}{\partial U_\phi \over \partial \phi}+{\partial U_z \over \partial z}

Inside and outside the sphere, U ϕ = U z = 0 U_\phi=U_z=0 so we need only to evaluate

U = 1 s ( s U s ) s \displaystyle\boldsymbol{\nabla}\cdot\mathbf{U}={1 \over s}{\partial \left( s U_s \right) \over \partial s}

Outside, U s = 2 k λ s \displaystyle U_s=\frac{2k\lambda}{s} so that U = 1 s ( s U s ) s = 1 s ( s 2 k λ s ) ) s = 2 k λ s ( 1 ) s = 0 \displaystyle\boldsymbol{\nabla}\cdot\mathbf{U}={1 \over s}{\partial \left( s U_s \right) \over \partial s}=\frac{1}{s}\frac{\partial (s\frac{2k\lambda}{s}))}{\partial s}=\frac{2k\lambda}{s}\frac{\partial (1)}{\partial s}=0

Note that this equation is only valid for s > 0 s>0 as it is for this problem; if s = 0 s=0 , the result is 0 / 0 0/0 .

Inside, U s = 2 k λ s R 2 \displaystyle U_s=2k\lambda\frac{s}{R^2} so that U = 2 k λ R 2 1 s ( s 2 ) s = 4 k λ R 2 \displaystyle\boldsymbol{\nabla}\cdot\mathbf{U}=\frac{2k\lambda}{R^2}\frac{1}{s}\frac{\partial (s^2)}{\partial s}=\frac{4k\lambda}{R^2}

The plot is constant for 0 s R 0\le s\le R and zero for s > R s \gt R .

Sketch the vector field U = r ^ / r 2 \mathbf{U}=\hat{\mathbf{r}}/r^2 and then show that

U = 0 \boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U}=0 if r 0 r\ne 0

and

U = 0 0 \boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U}=\frac{0}{0} if r = 0 r=0 .

You may do this using any coordinate system.

Outside of a solid sphere of radius R R with uniformly distributed charge Q Q , the field is

E ( r ) = k Q 1 r 2 r ^ \displaystyle\mathbf{E}(r)=kQ\frac{1}{r^2}\boldsymbol{\hat{r}}

inside, it is

E ( r ) = k Q r R 3 r ^ \displaystyle\mathbf{E}(r)=kQ\frac{r}{R^3}\boldsymbol{\hat{r}}

Compute E \boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{E} using any coordinate system and plot it versus r r .

Answer:

In spherical coordinates

E = 1 r 2 ( r 2 E r ) r + 1 r sin θ θ ( E θ sin θ ) + 1 r sin θ E ϕ ϕ \displaystyle\boldsymbol{\nabla}\cdot\mathbf{E}={1 \over r^2}{\partial \left( r^2 E_r \right) \over \partial r} + {1 \over r\sin\theta}{\partial \over \partial \theta} \left( E_\theta\sin\theta \right) + {1 \over r\sin\theta}{\partial E_\phi \over \partial \phi}

Here we have E θ = E ϕ = 0 E_\theta=E_\phi=0 inside and outside of the sphere.

Inside, E r = k Q r / R 3 E_r=kQr/R^3 , so

E = k Q R 3 1 r 2 r 3 r = 3 k Q R 3 \displaystyle\boldsymbol{\nabla}\cdot\mathbf{E}=\frac{kQ}{R^3}\frac{1}{r^2}\frac{\partial r^3}{\partial r}=\frac{3kQ}{R^3}

Using k = 1 / 4 π ϵ o k=1/4\pi\epsilon_o , and ρ o = Q / ( 4 / 3 ) π R 3 \rho_o=Q/(4/3)\pi R^3 , this can be written as

E = ρ o ϵ o \displaystyle\boldsymbol{\nabla}\cdot\mathbf{E}=\frac{\rho_o}{\epsilon_o}

Outside, E r = k Q / r 2 E_r=kQ/r^2 , so

E = k Q 1 r 2 r 2 ( 1 / r 2 ) r = k Q 1 r 2 ( 1 ) r = 0  for  r 0 \displaystyle\boldsymbol{\nabla}\cdot\mathbf{E}=kQ\frac{1}{r^2}\frac{\partial r^2 (1/r^2)}{\partial r}=kQ\frac{1}{r^2}\frac{\partial (1)}{\partial r}=0\text{ for } r\ne0

The plot is a horizontal line of amplitude ρ o / ϵ o \rho_o/\epsilon_o for r < R r\lt R and zero for r > R r \gt R . (If I ask you to plot something, I expect to see a plot even if in the solutions I sometimes don’t provide a plot.)

See also 1.3.4 of Griffiths.

The divergence theorem is

V ( U ) d τ = A U d A = Φ U \int_{\mathcal{V}} (\boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U}) d\tau=\oint_{\mathcal A} \mathbf{U}\cdot d\mathbf{A}=\Phi_U

This is a key vector calculus theorem that is used to derive Gauss’s law. The interpretation is that if we add up all of the divergences within a volume V \mathcal{V} , we will get the same result if we compute the flux through the closed surface A \mathcal{A} that encloses the volume.

Sketch the vector field U = r ^ \mathbf{U}=\hat{\mathbf{r}} and then verify the divergence theorem using for V \mathcal{V} a sphere of radius R R centered on the origin.

Answer

In spherical coordinates,

U = 1 r 2 ( r 2 U r ) r + 1 r sin θ θ ( U θ sin θ ) + 1 r sin θ U ϕ ϕ \displaystyle\boldsymbol{\nabla}\cdot\mathbf{U}={1 \over r^2}{\partial \left( r^2 U_r \right) \over \partial r} + {1 \over r\sin\theta}{\partial \over \partial \theta} \left( U_\theta\sin\theta \right) + {1 \over r\sin\theta}{\partial U_\phi \over \partial \phi}

Here U θ = U ϕ = 0 U_\theta=U_\phi=0 and U r = 1 U_r=1 . As a result, the second and third terms are zero and the first term evaluates as

U = 1 r 2 ( r 2 U r ) r = 1 r 2 ( r 2 ( 1 ) ) r = 2 r \displaystyle\boldsymbol{\nabla}\cdot\mathbf{U}={1 \over r^2}{\partial \left( r^2 U_r \right) \over \partial r}={1 \over r^2}{\partial \left( r^2 (1) \right) \over \partial r}=\frac{2}{r}

A differential volume for a sphere centered on the origin is d τ = r 2 sin θ d r d θ d ϕ d\tau=r^2\sin\theta dr d\theta d\phi . The volume integral is then

V ( U ) d τ = r = 0 R θ = 0 π ϕ = 0 2 π 2 r r 2 sin θ d r d θ d ϕ = 4 π R 2 \displaystyle\int_{\mathcal{V}} (\boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U}) d\tau= \int_{r=0}^{R}\int_{\theta=0}^\pi\int_{\phi=0}^{2\pi} \frac{2}{r}r^2\sin\theta dr d\theta d\phi=4\pi R^2

A differential element of area on a sphere of radius R R centered on the origin is

d A = R 2 sin θ d ϕ d θ dA=R^2\sin\theta d\phi d\theta

This element has a normal vector of r ^ \mathbf{\hat{r}} , so

d A = n ^ d A = r ^ R 2 sin θ d ϕ d θ d\mathbf{A}=\mathbf{\hat{n}}dA=\mathbf{\hat{r}}R^2\sin\theta d\phi d\theta

and so

U d A = R 2 sin θ d ϕ d θ \mathbf{U}\cdot d\mathbf{A}=R^2\sin\theta d\phi d\theta

The integral over a closed surface is

A U d A = θ = 0 π ϕ = 0 2 π R 2 sin θ d θ d ϕ = 4 π R 2 \displaystyle \oint_{\mathcal A} \mathbf{U}\cdot d\mathbf{A}=\int_{\theta=0}^\pi \int_{\phi=0}^{2\pi} R^2\sin\theta d\theta d\phi=4\pi R^2

Therefore,

V ( U ) d τ = 4 π R 2 = A U d A = 4 π R 2 \displaystyle\int_{\mathcal{V}} (\boldsymbol{\nabla}\boldsymbol{\cdot}\mathbf{U}) d\tau=4\pi R^2=\oint_{\mathcal A} \mathbf{U}\cdot d\mathbf{A}=4\pi R^2

Sketch the vector field U = r r ^ \mathbf{U}=r\hat{\mathbf{r}} and then verify the divergence theorem using for V \mathcal{V} a sphere of radius R R centered on the origin.

Outside of a solid sphere of radius R R with uniformly distributed charge Q Q , the field is

E ( r ) = k Q 1 r 2 r ^ \displaystyle\mathbf{E}(r)=kQ\frac{1}{r^2}\boldsymbol{\hat{r}}

inside, it is

E ( r ) = k Q r R 3 r ^ \displaystyle\mathbf{E}(r)=kQ\frac{r}{R^3}\boldsymbol{\hat{r}}

Verify the divergence theorem using

  1. the volume r R r\le R and

  2. the volume r R r\ge R (note that this volume has two surfaces).

Sketch the vector field U = r ^ / r 2 \mathbf{U}=\hat{\mathbf{r}}/r^2 and a sphere of radius R R centered on z = 2 R z=2R .

Then use the divergence theorem to find the flux Φ U \Phi_U through the sphere. If you choose to evaluate a surface integral rather than a volume integral, keep in mind that the normal to this sphere is not simply r ^ \hat{\mathbf{r}} because it is not centered on the origin.