(a) From Eq. (6.19), the magnetic energy is
`U_(B)=1/2LI^(2)`
`=1/2L(B/(mu_(0)n))^(2)` (since B=`mu_(0)ni,` for a solenoid)
`1/2(mu_(0)n^(2)Al)(B/(mu_(0)n))^(2)` [From Eq. (6.17)]
`=1/(2mu_(0))B^(2)Al`
(b) The magnetic energy per unit volume is,
`u_(b)=U_(B)/V` (where V is volume that contains flux)
`=U_(B)/(Al)`
`=B^(2)/(2mu_(0)`
We have already obtained the relation for the electrostatic energy stored per unit volume in a parallel plate capacitor (refer to Chapter 2, Eq. 2.77),
`u_(E)=1/2epsi_(0)E^(2)`
In both the cases energy is proportional to the square of the field strength. Equations (6.20) and (2.77) have been derived for special cases: a solenoid and a parallel plate capacitor, respectively. But they are general and valid for any region of space in which a magnetic field or/and an electric field exist.