When an archer pulls the string in a bow, he saves the work done in the form of elastic potential energy. When he releases the string, the potential energy is released as kinetic energy of the arrow. A capacitor works on the same principle in which the work done is saved as electric potential energy. The potential energy (UC) could be calculated by measuring the work done (W) to charge the capacitor.
Let us consider the case of a parallel plate capacitor. When the capacitor is connected to a battery, the plate attached to the battery's negative side gets more electrons, repelling more electrons in the other plate. Hence the second plate gets an equal positive charge. At any instant of time when the capacitor is getting charged, if q and V are the charge and potential difference across the plates, respectively, then they are related by the following equation:
In equation (2), C is the capacitance of the parallel plate capacitor. As the capacitor is being charged, the charge gradually builds upon its plates, and after some time, it reaches the final value Q. The amount of work done (dW) to move a charge element dq is Vdq. We get the potential energy stored in the capacitor using the equations (1) and (2). Thus,
We can now find the energy density stored in vacuum between the plates of a charged parallel-plate capacitor from the potential energy stored in a capacitor. The energy density is then defined as the potential energy per unit volume. If A and d are the area and distance between the plates, then from the expressions for electric field and capacitance, that is E = σ/εo and C = εoA/d, the energy density is obtained as: