# What happens to the energy of a capacitor after a dielectric is inserted?

Consider a parallel plate capacitor having capacitance $C$ and charge $Q$. then the energy of the capacitor will be $\frac{Q^2}{2C}$. Now if a dielectric is inserted, then $C$ increases and thus the energy decreases.

My question is - where does the energy go? If it gets used up to polarise the dielectric, thne if we remove the dielectric, how does it regain the energy from the dielectric?