Dear Student,
Let a capacitor of capacitance C is connected across a battery of emf E volts.
Let the charge stored by the capacitor in time t be q.
Then the voltage developed across the capacitor in time t is
In order to transfer a small amount of charge to the plate of the capacitor after time t, work is to be done against the repulsive force due to the charge q already present in the plate.
Work done to transfer dq charge,
Putting the value of V from eq. (1), we get
Let the total charge stored by the capacitor of capacitance C be Q, then
by integrating eq(3), we get the total work done by the battery in charging the capacitor
The work done by the battery is stored as the potential energy of the capacitor.
Thus, the energy stored in a capacitor connected across a dc battery is
Energy density of a capacitor is defined as the energy stored in the capacitor per unit volume. It is equal to total energy stored by the capacitor divided by the volume of the region between the plates.
Assuming the capacitor to be a parallel plate capacitor. Let the surface area of the plates be A and the separation distance be d, then
Capacitance of a parallel plate capacitor:
Now,
Energy density of the capacitor,
Regards