A capacitor is connected to a battery of potential difference
The capacitor get charged and after that battery is removed and charged capacitor is connected to another uncharged capacitor
of capacitance
The charge on
in equilibrium condition is

When switch is closed and
remain open, charging of
is take place.
When battery is removed means is open and
is closed. Then at equilibrium let voltage across both
and
is
Using equilibrium of charge -