The potential difference between the plates decreases K times
The change in energy stored is 1/2CV²(1-1/K)
The energy stored in the capacitor decreases K times
The charge on the capacitor is not conserved
Cf=KCi
Qi=CiV
Ui=1/2CiV²
Uf=1/2Qf²/Cf
After the capacitor is disconnected from the battery, charge on the capacitor cannot change.
∴Qf=Qi
∴Uf=1/2Qf²/Cf=1/2Ci²V²/KCi
ΔU=Uf-Ui=1/2Ci²V²/KCi-1/2CiV²=1/2CiV²(1/K-1)=-1/2CiV²(1-1/K)=-1/2CV²(1-1/K)
since Ci=C as given