Detailed explanation of the working principle of capacitor