## Work and energy – continuous charge

Required math: vectors, calculus

Required physics: electrostatics

Reference: Griffiths, David J. (2007) Introduction to Electrodynamics, 3rd Edition; Prentice Hall – Problems 2.32, 2.33.

We’ve seen that, for discrete point charges, the work required to assemble a collection of ${n}$ charges ${q_{i}}$ is

$\displaystyle W=\frac{1}{2}\sum_{i=1}^{n}q_{i}V(\mathbf{r}_{i}) \ \ \ \ \ (1)$

where ${V(\mathbf{r}_{i})}$ is the potential at the location of charge ${q_{i}}$ due to all the other charges (excluding ${q_{i}}$).

For a continuous charge density ${\rho}$ we can write this as an integral over the volume containing the charges:

$\displaystyle W=\frac{1}{2}\int\rho(\mathbf{r})V(\mathbf{r})d^{3}\mathbf{r} \ \ \ \ \ (2)$

Note, however, that there is a subtle distinction between the discrete and continuous formulas. In the discrete formula, the potential term in the sum excludes the charge ${q_{i}}$, but in the integral form, the potential is the complete potential due to the entire charge distribution. In the continuous case, we don’t talk about point charges (unless we write the density ${\rho}$ as a sum of delta functions), so in that sense the continuous formula is more accurate. However, if point charges such as electrons do truly exist, then we can’t either build them or take them apart, so it seems fair enough to exclude the energies involved in doing so. However, as we’ve seen in the post on discrete charges, the energy associated with a point charge is actually infinite, so it’s dodgy to just ignore it. This problem plagues both classical and quantum electrodynamics, but most books just ignore it.

The integral formula can be expressed in terms of the electric field by using a bit of vector calculus. We know from Gauss’s law for electrostatics that

$\displaystyle \rho=\epsilon_{0}\nabla\cdot\mathbf{E} \ \ \ \ \ (3)$

so we can write the work as

$\displaystyle W=\frac{\epsilon_{0}}{2}\int(\nabla\cdot\mathbf{E})V(\mathbf{r})d^{3}\mathbf{r} \ \ \ \ \ (4)$

A theorem from vector calculus says

 $\displaystyle \nabla\cdot(V\mathbf{E})$ $\displaystyle =$ $\displaystyle V\nabla\cdot\mathbf{E}+\mathbf{E}\cdot\nabla V\ \ \ \ \ (5)$ $\displaystyle V\nabla\cdot\mathbf{E}$ $\displaystyle =$ $\displaystyle \nabla\cdot(V\mathbf{E})-\mathbf{E}\cdot\nabla V\ \ \ \ \ (6)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \nabla\cdot(V\mathbf{E})+E^{2} \ \ \ \ \ (7)$

In the last line, we used the relation ${\mathbf{E}=-\nabla V}$.

Therefore, the work becomes

$\displaystyle W=\frac{\epsilon_{0}}{2}\int\left[\nabla\cdot(V\mathbf{E})+E^{2}\right]d^{3}\mathbf{r} \ \ \ \ \ (8)$

We can now use the divergence theorem on the first term, and convert it from a volume integral to a surface integral if we select some surface that encloses all the charge (we’re assuming that we’re dealing with realistic systems so that all the charge is at a finite distance, and not with things like infinite planes of charge). That is, we can say

$\displaystyle W=\frac{\epsilon_{0}}{2}\oint V\mathbf{E}\cdot d\mathbf{a}+\frac{\epsilon_{0}}{2}\int E^{2}d^{3}\mathbf{r} \ \ \ \ \ (9)$

Since all we require is that the surface encloses all the charges, we can let the surface tend to infinity. In that case, since the charges are all at finite distances, and we are taking the potential to be zero at infinity, and the electric field falls off as ${1/r^{2}}$, the surface integral will go to zero at infinity. The volume integral is always positive (since we’re integrating the square of the field, which is always positive), so what happens is that as we include more volume, the surface integral decreases and the volume integral increases in such a way as to keep the total work constant. That is, we get

$\displaystyle W=\frac{\epsilon_{0}}{2}\int E^{2}d^{3}\mathbf{r} \ \ \ \ \ (10)$

where the integral now covers all space. Note the distinction between 2 and 10: in the first case, we need to integrate only over that volume where ${\rho\ne0}$; in the second case we need to integrate over all space, since in general the electric field is always non-zero over any finite distance, even for a localized charge distribution.

As an example, we can work out the energy stored in a uniformly charged solid sphere of radius ${R}$ and charge ${q}$. We’ll do it four different ways to show how each of the above methods works.

Example 1. We can use 2. We found the potential of the sphere earlier (Example 1 in this post). The charge density ${\rho}$ in terms of the total charge is

$\displaystyle \rho=\frac{3q}{4\pi R^{3}} \ \ \ \ \ (11)$

and the potential inside the sphere (all we need here, since we need to integrate only over that volume where ${\rho\ne0}$) is

$\displaystyle V=\frac{q}{8\pi\epsilon_{0}R}\left(3-\frac{r^{2}}{R^{2}}\right) \ \ \ \ \ (12)$

Therefore, we get

 $\displaystyle W$ $\displaystyle =$ $\displaystyle \frac{1}{2}\int\rho Vd^{3}\mathbf{r}\ \ \ \ \ (13)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{3q^{2}}{32\pi^{2}\epsilon_{0}R^{4}}\int_{0}^{R}\int_{0}^{\pi}\int_{0}^{2\pi}\left(3-\frac{r^{2}}{R^{2}}\right)r^{2}\sin\theta d\phi d\theta dr\ \ \ \ \ (14)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{3}{20}\frac{q^{2}}{\pi\epsilon_{0}R} \ \ \ \ \ (15)$

Example 2. Same problem, but now we use 10. We worked out the field earlier (Example 2 in this post). In this case, we will need the field for both inside and outside the sphere, since we must integrate over all space. We have, for inside:

 $\displaystyle E_{in}$ $\displaystyle =$ $\displaystyle \frac{r\rho}{3\epsilon_{0}}\ \ \ \ \ (16)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{rq}{4\pi\epsilon_{0}R^{3}} \ \ \ \ \ (17)$

and for outside:

 $\displaystyle E_{out}$ $\displaystyle =$ $\displaystyle \frac{R^{3}\rho}{3\epsilon_{0}r^{2}}\ \ \ \ \ (18)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{q}{4\pi\epsilon_{0}r^{2}} \ \ \ \ \ (19)$

The energy is then

 $\displaystyle W$ $\displaystyle =$ $\displaystyle \frac{\epsilon_{0}}{2}\left[\int_{0}^{R}\int_{0}^{\pi}\int_{0}^{2\pi}E_{in}^{2}r^{2}\sin\theta d\phi d\theta dr+\int_{R}^{\infty}\int_{0}^{\pi}\int_{0}^{2\pi}E_{out}^{2}r^{2}\sin\theta d\phi d\theta dr\right]\ \ \ \ \ (20)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{3}{20}\frac{q^{2}}{\pi\epsilon_{0}R} \ \ \ \ \ (21)$

Example 3. This time we use the formula 9, so the integral is split between a volume integral and a surface integral. If we use a surface of radius ${a>R}$, then the volume component can be worked out using the same integrals as in Example 2, but changing the limit on the second integral.

 $\displaystyle W_{vol}$ $\displaystyle =$ $\displaystyle \frac{\epsilon_{0}}{2}\left[\int_{0}^{R}\int_{0}^{\pi}\int_{0}^{2\pi}E_{in}^{2}r^{2}\sin\theta d\phi d\theta dr+\int_{R}^{a}\int_{0}^{\pi}\int_{0}^{2\pi}E_{out}^{2}r^{2}\sin\theta d\phi d\theta dr\right]\ \ \ \ \ (22)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{q^{2}}{40\pi\epsilon_{0}aR}(6a-5R) \ \ \ \ \ (23)$

Note that as ${a\rightarrow\infty}$, this integral tends to the total energy as worked out in the previous two examples: ${W_{vol}\rightarrow\frac{3}{20}\frac{q^{2}}{\pi\epsilon_{0}R}}$.

The surface integral uses the potential and field at a distance ${r=a}$. This time we need the potential outside the sphere, which is

$\displaystyle V_{out}=\frac{q}{4\pi\epsilon_{0}}\frac{1}{a} \ \ \ \ \ (24)$

The field at ${r=a}$ is

$\displaystyle E_{out}=\frac{q}{4\pi\epsilon_{0}a^{2}} \ \ \ \ \ (25)$

Both of these are constants over the bounding sphere, so we get

 $\displaystyle W_{surf}$ $\displaystyle =$ $\displaystyle \frac{\epsilon_{0}}{2}\frac{q^{2}}{16\pi^{2}a^{3}}\int_{0}^{\pi}\int_{0}^{2\pi}a^{2}\sin\theta d\phi d\theta\ \ \ \ \ (26)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{q^{2}}{8\pi\epsilon_{0}a} \ \ \ \ \ (27)$

The total energy is

 $\displaystyle W$ $\displaystyle =$ $\displaystyle W_{vol}+W_{surf}\ \ \ \ \ (28)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{3}{20}\frac{q^{2}}{\pi\epsilon_{0}R} \ \ \ \ \ (29)$

Example 4. Finally, we can build up the solid sphere by adding successive layers of charge of thickness ${dr}$. We have, when the sphere has intermediate radius ${r}$:

 $\displaystyle q$ $\displaystyle =$ $\displaystyle \frac{4}{3}\pi r^{3}\rho\ \ \ \ \ (30)$ $\displaystyle dq$ $\displaystyle =$ $\displaystyle 4\pi r^{2}\rho dr \ \ \ \ \ (31)$

This amount of charge is brought from infinity and added to a spherical volume of charge ${q}$ and radius ${r}$. We know from above that the potential of such a sphere at its outer boundary is

 $\displaystyle V$ $\displaystyle =$ $\displaystyle \frac{q}{4\pi\epsilon_{0}r}\ \ \ \ \ (32)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{\rho r^{2}}{3\epsilon_{0}} \ \ \ \ \ (33)$

so the amount of work needed to add this charge to the sphere is

 $\displaystyle dW$ $\displaystyle =$ $\displaystyle Vdq\ \ \ \ \ (34)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{4\pi\rho^{2}}{3\epsilon_{0}}r^{4}dr \ \ \ \ \ (35)$

We can then integrate this to find the total work:

 $\displaystyle W$ $\displaystyle =$ $\displaystyle \frac{4\pi\rho^{2}}{3\epsilon_{0}}\int_{0}^{R}r^{4}dr\ \ \ \ \ (36)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{4\pi\rho^{2}}{15\epsilon_{0}}R^{5}\ \ \ \ \ (37)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{3}{20}\frac{q^{2}}{\pi\epsilon_{0}R} \ \ \ \ \ (38)$