= Solution
For an ideal <inductor> of constant <self-inductance> $L$, the passive-sign <electric potential difference> is $V_L=L\,dI/dt$. The supplied <power> is $V_LI$, so increasing the <electric current> quasistatically from zero stores
$$
U=\int V_LI\,dt=\int_0^I LI'\,dI'=\boxed{\frac12LI^2}.
$$
Any <electrical resistance> would additionally dissipate <energy> as heat; it is not included in this stored magnetic <energy>.
For a long vacuum <solenoid> with $N$ turns, axial length $\ell$ and cross-sectional area $A$, <Ampère's law> gives $B=\mu_0(N/\ell)I$. Its <flux> linkage is $N\Phi=N BA$, so
$$
L=\frac{N\Phi}{I}=\frac{\mu_0N^2A}{\ell}.
$$
The nearly uniform field occupies volume $A\ell$, with negligible external-field <energy> in the long-solenoid approximation. Dividing its stored <energy> by this volume yields
$$
\boxed{u_B=\frac{U}{A\ell}=\frac12\mu_0\left(\frac N\ell\right)^2I^2=\frac{B^2}{2\mu_0}}.
$$
The vacuum and linear-inductance assumptions matter; a nonlinear magnetic material requires the appropriate field-energy integral rather than simply substituting a varying <inductance> into $LI^2/2$.
Back to article page