Ans: Let us suppose a capacitor is connected to a battery and it supplies a small amount of change dq at constant potential , then a small amount of work done by the battery is given by
Total work done where capacitor is fully changed to .
This work done is stored in the capacitor in the form of electrostatic potential energy.