I am aware of the fact that for two point masses in space, the time that it will take for them to collide is, T=$\pi \sqrt{\frac{r_i^3}{8GM}}$, where M is the sum of the 2 bodies' masses, $r_i$ is the distance between them and I'm assuming that the 2 objects were initially at rest and nothing else is affecting the system. However I would like to know the distance travelled by the objects. I'm assuming a 1D line where the first object, $m_1$ is on the origin initially and the second object, $m_2$ is $r_i$ units to the left of the first object (initially).
If I denote $x_1$ as the distance travelled by the first object with reference to the origin, and $x_2$ as the distance travelled by the second object to the left (so $x_2$ is negative), then I get these equations:
$$x_1'' (t) = G\frac{m_2}{(r_i-x_1+x_2)^2}$$ $$x_2'' (t) = -G\frac{m_1}{(r_i-x_1+x_2)^2}$$ $$x_1 (0) = 0$$ $$x_2 (0) = 0$$ $$x_1 (T) = r_i + x_2 (T)$$ Note that the distance between the 2 objects, $r=r_i-x_1+x_2$
I don't know how to solve those by themselves but of course I can get to the point: \begin{align*} r''(t) = - \frac{GM}{r^2} \end{align*} Defining v (t)=r' (t): \begin{align*} \frac{dv}{dt} & = - \frac{GM}{r^2} \\ \frac{dv}{dr} \frac{dr}{dt} & = - \frac{GM}{r^2} \\ v \frac{dv}{dr} & = - \frac{GM}{r^2} \\ \int_{0}^{v}v dv & = -GM \int_{r_i}^{r} \frac{1}{r^2} dr \\ \frac{v^2}{2} & = GM ( \frac{r_i-r}{rr_i}) \\ v & = \pm \sqrt{2GM}\sqrt{ \frac{r_i-r}{rr_i}} \\ \sqrt{ \frac{rr_i}{r_i-r}} \frac{dr}{dt} & = \pm \sqrt{2GM} \end{align*}
I don't know what to do from here. I also thought of the law of the conservation of energy so I came up with this: \begin{align*} x_1\sum F_1 & = x_2 \sum F_2 \end{align*}
Essentially I just want to know what $x_1 (T)$ is.