Work done in transferring small amount of charge 'dq' is given by
\(dw = P.D.\times \,charge\, moved\)
\(dw = V\times dq \)
\(dw = (q / C)\times dq\)
Total work done in charging the capacitor to its full capacity of holding charge Q is given by,
By definition, \(W=U\) (energy)
\(U=\frac{Q^2}{2C}=\frac{1}{2}CV^2\,\,\,\,[Q=CV]\)
\(U=\frac{1}{2}CV^2\,\,\,\,\,or\,\,U=\frac{1}{2}\frac{Q^2}{C}=\frac{1}{2}QV\)