When can we make a change of variables $f'$ for $f$? In my applied math class, my instructor introduced the example of two point masses, both with mass $m$, with positions $x_1(t)$ and $x_2(t)$. Newton's law gives us the differential equation
$$r'' + (2Gm)r^{-2} = 0,$$
where $r(t) : = |x_1(t) - x_2(t)|$.
My instructor told us that we can solve this diff EQ by changing variables and noting that 
$$r'' = \frac{d}{dt} \frac{dr}{dt} =\frac{dv}{dt} = \frac{dv}{dr}\frac{dr}{dt},$$
so
$$v\,dv =2Gm \frac{dr}{r^2}$$
and we can integrate.
My Question:
I'm troubled by this change of variables. We are assuming that there is a function $v(r)$. Am I correct that this is a physical assumption and not a mathematical one? (For instance, if two things were oscillating with some irregularity, there would not be a well-defined $v(r)$, right?) What allows us to make that assumption here? (It seems clear that the particles will simply come toward each other and then collide, but I'm trying to be precise.) 
 A: Note that $$r'' + (2Gm)r^{-2} = 0,$$
can be written as $$r'r''=-2Gm\frac{r'}{r^2}$$
Integration gives $$\frac 1 2r'^2=2Gm r^{-1}$$ so $$rr'^2=4Gm$$ I wouldn't know what was intended after this.
A: [I'm assuming that your problem is 1-D, i.e., that the particles move towards/away from each other on a straight line. Please comment if this is not the case. I also assume WLOG that $r_0 = x_2(0) - x_1(0) > 0$. I define $v = \dot{x}_2-\dot{x}_1$ - i.e., without the absolute values - since I am only interested in the time interval up to collision. That such an interval $[0,\bar{t}]$ exists follows from the initial conditions & continuity of the solutions.]
The question is legitimate, because it can very well happen that the same $r$ will be achieved at different times $t_2 > t_1 \ge 0$; it must hence hold that $v(t_2)=v(t_1)$, for $v$ to be a well-defined function. Think, in particular, of the two masses shot at speeds $\dot{x}_2(0)>\dot{x}_1(0)>0$ (both along the line joining them, of course). In that case, the distance $x_2(t)-x_1(t)$ will initially increase (because $\dot{x}_2(0)-\dot{x}_1(0) > 0$); if the velocity difference is less than the escape velocity, the distance will then decrease until it hits zero (collision).
Note, now, that your two-body system conserves energy and momentum (that's physics, but it's of course also supported by the math). Hence,
$$
\frac{1}{2} m \left(\dot{x}_1^2+\dot{x}_2^2\right) - \frac{Gm^2}{r^2} = E = const.
\quad\mbox{and}\quad
\left(\dot{x}_1+\dot{x}_2\right) = \frac{P}{m} =: V = const.
$$
I can write the energy conservation relation as
$$
\frac{1}{2} m \left(\dot{x}_1-\dot{x}_2\right)^2 + m \dot{x}_1 (V - \dot{x}_1) - \frac{Gm^2}{r^2} = E
$$
that is,
$$
\frac{1}{2} m v^2 = E + \frac{Gm^2}{r^2} - m \dot{x}_1 (V - \dot{x}_1) .
$$
For $v(r)$ to be well-defined (up to a sign - but we had already imagined that), we need that the third and final term in the RHS is the same at times $t_1$ and $t_2$. Can you examine whether this is true :)?
