We choose the reference point, infinity, where the total energy of the system is zero.
So, initial energy of the system = 0
Final energy =12m1v21+12m2v22−Gm1m2d
From conservation of energy,Initial energy = Final energy
∴0=12m1v21+12m1v22=Gm1m2d...(1)
By conservation of linear momentum
m1v1+m1v2=0
or v1v2=m2m1⇒v2=m1m2v1
Putting value of v2 in equation , we get
m1v2+m2(−m1v1m2)2=2Gm1m2d
m1m2v21+m21v21m2=2Gm1m2d
v1=√2Gm22d(m1+m2)=m2√2Gd(m1+m2)
Similarly v2=m1√2Gd(m1+m2)