Let a capacitor be connected to a battery in a circuit. The battery does work worth $CV^2$ but the capacitor stores only half that amount... We say the other half went away as heat, but how do we mathematically show where the other half went?
2 Answers
This is not true. If there is no resistor, no energy is lost by heating (in reality there is alway a little bit of energy being dissipated by resistance BUT the factor of two is not because of that). If there's no signiificant resistance loss, the battery puts in the same amount of energy that is stored at the end.
The confusion arises because you are not considering that if you start with a discharged capacitor, the voltage is building across the capacitor, and so every diferential of charge, $\delta q$, you put into it will need a different amount of energy to go in $\delta W = V_C(q) \delta q$.
This way its easy to see (considering that $V_C(q) = q/C$) that: $W_{total} = \int_0^Q \frac{q}{C}dq = \frac{Q^2}{2C} = \frac{1}{2} V^2 C $
Note: Notice that if the voltage across the capacitor was always zero, until you reached the final charge. Then the battery would "elevate" every $\delta q$ a voltage of $V$, and so $W_{total} = \int_0^Q V dq = VQ = V^2 C$. Which is where the confusion comes from.
So yeah, the factor of two comes from considering that the voltage of the capacitor changes as you charge it.
Heat dissapation in the charging of a capacitor is due to the non ideal connecting wires which dissapate energy in form of heat when a current is passed on through them(according to joule's heating effect of electric current). Mathematically we can analyse the situation by establishing the current in the circuit and using that along with joule's law establish $ H = \int _{0}^{∞} i²R dt $ and evaluate the integral to find the amount of heat dissapated. Hope it helped! If you want the entire mathematical relation and evaluation of the integral please leave a comment regarding the same. 😀Happy learning!