Energy in a Magnetic Field

In an RC circuit the capacitor stores energy. When we discharge the capacitor the energy generally gets dissipated in a resistor. A similar thing happens in an RL circuit where the inductor stores energy.
For an inductor U =
LI2
2

This is similar to the equation for the energy stored in a capacitor:
U =
C DV2
2

Whenever there is an electric field or a magnetic field the field stores energy. This can be viewed in terms of the energy density, the energy per unit volume.
Energy density in a magnetic field: uB =
B2
2 mo
Energy density in an electric field: uE =
eo E2
2

Note the similar forms, and that the stored energy is proportional to the square of the magnitude of the field.