# Magnetic Energy (Energy Stored in Magnetic Fields)

Since an inductor in a circuit serves to oppose any change in the current through it, work must be done by an external source such as a battery in order to establish a current in the inductor. From the workâ€“energy theorem, we conclude that energy can be stored in an inductor. The role played by an inductor in the magnetic case is analogous to that of a capacitor in the electric case.

The power or rate at which an external emf

The power or rate at which an external emf

*Îµ*_{ext}works to overcome the self-induced emf*Îµ**and pass a current*_{L }*I*in the inductor is,â€‹

If only the external emf and the inductor are present then

*Îµ*, which implies_{ext}= Îµ_{L}If the current is increasing with then P > 0 which means that the external source is doing positive work to transfer energy to the inductor. Thus, the internal energy of the inductor is increased. On the other hand, if the current is decreasing with , we then have

*P*< 0. In this case, the external source takes energy away from the inductor, causing its internal energy to go down.The total work done by the external source to increase the current form zero to I is then,

This is equal to the

*energy stored in the magnetic field (W*_{m}).**Note:**The above expression is analogous to the electric energy stored in a capacitor, .

In order to evaluate the density of the stored energy in terms of the field quantities, we consider a long solenoid. The magnetic flux density within the solenoid is,

where,

*N*is the number of turns,*I*is the current flowing and*l*is the length.