I'm having a hard time finding the differential equation for enregy in a capacitor for an RC basic circuit which contains a resistor and a capacitor + the source .
I have to start using the Kirchhoff’s voltage law.
I know that :
$$E_c = \frac{1}{2}CU_c^2$$
Where $E_c$ is the energy stored in a capcitor and $U_c$ is the voltage across the capacitroe .
I tried to find the same equation for an RL circuits but I couldn't so how should I approach it ?