# The Unapologetic Mathematician

## Energy and the Magnetic Field

Last time we calculated the energy of the electric field. Now let’s repeat with the magnetic field, and let’s try to be a little more careful about it since magnetic fields can be slippery.

Let’s consider a static magnetic field $B$ generated by a collection of circuits $C_i$, each carrying a current $I_i$. Recall that Gauss’ law for magnetism tells us that $\nabla\cdot B=0$; since space is contractible, we know that its homology is trivial, and thus $B$ must be the curl of some other vector field $A$, which we call the “magnetic potential” or “vector potential”. Now we can write down the flux of the magnetic field through each circuit:

$\displaystyle\Phi_i=\int\limits_{S_i}B\cdot dS_i=\int\limits_{C_i}A\cdot dr_i$

Now Faraday’s law tells us about the electromotive force induced on the circuit:

$\displaystyle V_i=\frac{d\Phi_i}{dt}$

This electromotive force must be counterbalanced by a battery maintaining the current or else the magnetic field wouldn’t be static.

We can determine how much power the battery must expend to maintain the current; a charge $q$ moving around the circuit goes down by $qV_i$ in potential energy, which the battery must replace to send it around again. If $n$ such charges pass around in unit time, this is a work of $nqV_i$ per unit time; since $nq=I$ — the current — we find that the power expenditure is $P_i=I_iV_i$, or.

$\displaystyle P_i=I_i\frac{d\Phi_i}{dt}$

Thus if we want to ramp the currents — and the field — up from a cold start in a time $T$ it takes a total work of

$\displaystyle W=\sum\limits_{i=1}^N\int\limits_0^TI_i\frac{d\Phi_i}{dt}\,dt$

which is then the energy stored in the magnetic field.

This expression doesn’t depend on exactly how the field turns on, so let’s say the currents ramp up linearly:

$\displaystyle I_i(t)=I_i(T)\frac{t}{T}$

and since the fluxes are proportional to the currents they must also ramp up linearly:

$\displaystyle\Phi_i(t)=\Phi_i(T)\frac{t}{T}$

Plugging these in above, we find:

$\displaystyle W=\sum\limits_{i=1}^N\int\limits_0^TI_i(T)\Phi_i(T)\frac{t}{T^2}\,dt=\frac{1}{2}\sum\limits_{i=1}^NI_i(T)\Phi_i(T)$

Now we can plug in our original expression for the flux:

$\displaystyle W=\frac{1}{2}\sum\limits_{i=1}^NI_i\int\limits_{C_i}A\cdot dr_i$

This is great. But to be more general, let’s replace our currents with a current distribution:

$\displaystyle W=\frac{1}{2}\int\limits_{\mathbb{R}^3}A\cdot J\,dV$

Now we can use Ampère’s law to write

\displaystyle\begin{aligned}W&=\frac{1}{2\mu_0}\int\limits_{\mathbb{R}^3}A\cdot(\nabla\times B)\,dV\\&=\frac{1}{2\mu_0}\int\limits_{\mathbb{R}^3}B\cdot(\nabla\times A)-\nabla\cdot(A\times B)\,dV\\&=\frac{1}{2\mu_0}\int\limits_{\mathbb{R}^3}B\cdot B\,dV-\frac{1}{2\mu_0}\int\limits_{\mathbb{R}^3}\nabla\cdot(A\times B)\,dV\end{aligned}

We can pull the same sort of trick last time to make the second integral go away; use the divergence theorem to convert to

$\displaystyle\frac{1}{2\mu_0}\lim\limits_{R\to\infty}\int\limits_{S_R}(A\times B)\cdot dA$

and take the surface far enough away that the integral becomes negligible. We handwave that $A\times B$ falls off roughly as the inverse fifth power of $R$, while the area of $S_R$ only grows as the second power, and say that the term goes to zero.

So now we have a similar expression as last time for a magnetic energy density:

$\displaystyle u_B=\frac{1}{2\mu_0}\lvert B\rvert^2$

Again, we can check the units; the magnetic field has units of force per unit charge per unit velocity:

$\displaystyle\frac{\mathrm{kg}}{\mathrm{C}\cdot\mathrm{s}}$

while the magnetic constant has units of henries per meter:

$\displaystyle\frac{\mathrm{m}\cdot\mathrm{kg}}{\mathrm{C}^2}$

Putting together an inverse factor of the magnetic constant and two of the magnetic field and we get:

$\displaystyle\frac{\mathrm{C}^2}{\mathrm{m}\cdot\mathrm{kg}}\frac{\mathrm{kg}}{\mathrm{C}\cdot\mathrm{s}}\frac{\mathrm{kg}}{\mathrm{C}\cdot\mathrm{s}}=\frac{\mathrm{kg}\cdot\mathrm{m}^2}{\mathrm{m}^3\cdot\mathrm{s}^2}=\frac{\mathrm{J}}{\mathrm{m}^3}$

or, units of energy per unit volume, just like we expect for an energy density.

February 14, 2012

## Energy and the Electric Field

Okay, now let’s consider the electric field from the perspective of energy. We have an idea that this might be interesting because we know that the field produces a force, and forces and energies interact in interesting ways.

So recall that if we have a “test charge” $q$ at a point $p$ in an electric field $E$ it experiences a force $F=qE(p)$. As we saw when discussing Faraday’s law, for a static electric field we can write $E=-\nabla\phi$ for some “electric potential” function $\phi$. Thus we can also write $F=-\nabla U$ for the potential energy function $U=q\phi$.

Now, say the field is generated by a charge distribution $\rho$; how much potential energy is contained in the force the field exerts on the little bit of charge at $p$? We count $U=\rho(p)\phi(p)$, but this is too much — half of it is due to the rest of the distribution acting on the bit of charge at $r$ and half of it comes from $r$ acting back. We can thus find the total potential energy by integrating

$\displaystyle U=\frac{1}{2}\int\limits_{\mathbb{R}^3}\rho(p)\phi(p)\,d^3p$

Now, Gauss’ law tells us that $\rho=\epsilon_0\nabla\cdot E$, so we substitute:

$\displaystyle U=\frac{1}{2}\int\limits_{\mathbb{R}^3}\epsilon_0(\nabla\cdot E)\phi\,dV$

Next we use a form of the product rule — $\nabla\cdot(fV)=(\nabla f)\cdot V+f(\nabla\cdot V)$ — and run it backwards to write:

\displaystyle\begin{aligned}U&=\frac{\epsilon_0}{2}\int\limits_{\mathbb{R}^3}\nabla\cdot(\phi E)-(\nabla\phi)\cdot E\,dV\\&=\frac{\epsilon_0}{2}\int\limits_{\mathbb{R}^3}\nabla\cdot(\phi E)\,dV+\frac{\epsilon_0}{2}\int\limits_{\mathbb{R}^3}(-\nabla\phi)\cdot E\,dV\\&=\frac{\epsilon_0}{2}\lim\limits_{R\to\infty}\int\limits_{B_R}\nabla\cdot(\phi E)+\frac{\epsilon_0}{2}\int\limits_{\mathbb{R}^3}E\cdot E\,dV\end{aligned}

where we evaluate the first integral over space by evaluating it over the solid ball of radius $R$ and taking the limit as $R$ goes off to infinity. The divergence theorem says we can write:

\displaystyle\begin{aligned}U&=\frac{\epsilon_0}{2}\lim\limits_{R\to\infty}\int\limits_{S_R}\phi E\cdot dA+\frac{\epsilon_0}{2}\int\limits_{\mathbb{R}^3}E\cdot E\,dV\\&=\frac{\epsilon_0}{2}\int\limits_{\mathbb{R}^3}E\cdot E\,dV\end{aligned}

where, as usual, we have taken the charge distribution to be compactly supported, so as our sphere gets large enough, the potential energy $\phi$ goes to zero. Yes, this is very hand-wavy, but this is how the physicists do it.

Anyway, what does this tell us? It means that a static electric field contains energy with a density

$\displaystyle u_E=\frac{1}{2}\epsilon_0\lvert E\rvert^2$

which we can integrate over any region of space to find the electrostatic potential energy contained in the field.

We can also check the units here; the electric field has units of force per unit charge:

$\displaystyle\frac{\mathrm{kg}\cdot\mathrm{m}}{\mathrm{C}\cdot\mathrm{s}^2}$

while the electric constant has units of farads per meter:

$\displaystyle\frac{\mathrm{s}^2\cdot\mathrm{C}^2}{\mathrm{m}^3\cdot\mathrm{kg}}$

Putting these together — two factors of $E$ and one of $\epsilon_0$ we find the units:

$\displaystyle\frac{\mathrm{s}^2\cdot\mathrm{C}^2}{\mathrm{m}^3\cdot\mathrm{kg}}\frac{\mathrm{kg}\cdot\mathrm{m}}{\mathrm{C}\cdot\mathrm{s}^2}\frac{\mathrm{kg}\cdot\mathrm{m}}{\mathrm{C}\cdot\mathrm{s}^2}=\frac{\mathrm{kg}\cdot\mathrm{m}^2}{\mathrm{m}^3\cdot\mathrm{s}^2}=\frac{\mathrm{J}}{\mathrm{m}^3}$

Joules per cubic meter — energy per unit of volume, just as we’d expect for an energy density.

February 14, 2012