Given:
Initial charge on first capacitor = Q
Let q be the charge on the second capacitor after time t.
According to the principle of conservation of charge, charge on the first capacitor after time t = Q - q.
Let V1 be the potential difference across the first capacitor and V2 be the potential difference across the second capacitor after time t. Then,
The current through the circuit after time t,
Integrating both sides within the limits time =0 to t and charge on the second capacitor varying from q=0 to q, we get: