While studying energy inside capacitors, I came up with something: If we can calculate the energy inside it as:
$$U=\frac{1}{2}QV=\frac{1}{2}CV^2=\frac{1}{2}\frac{Q^2}{C}$$
Then, why in some cases it appears that the energy depends directly or inversely proportional to the capacity mathematically (second and third form of the equation)
I know it have to do with the dependency of the energy about the charge Q, the potential V and the capacity C, but how could I understand it in a formal way?