(a) Let two capacitors of capacities C1, C2 and potentials V1 and V2 touch each other. If their common potential is V, then the sum of charges
Before sharing = C1V1 + C2V2
And after sharing = C1V + C2V
= V (C1 + C2)
Since charges are conserved, therefore
V(C1 + C2) = C1V1 + C2V2
or V = \(\frac{C_1V_1 + C_2V_2}{C_1 + C_2}\)
(b) Sum of energies before sharing is
E1 = \(\frac{1}{2}C_1V_1^2 + \frac{1}{2}C_2V_2^2\)
and sum of energies after sharing is

E1 - E2 = \(\frac{C_1C_2(V_1^2+V_2^2-2V_1V_2)}{2(C_1 +C_2)}\)
= \(\frac{C_1C_2(V_1-V_2)^2}{2(C_1 +C_2)}\)
= a positive quantity.
Hence there is always a loss of energy when two capcaitors share the charges.