TITLE: Ordinary Differential Equations used in Cosmology
QUESTION [5 upvotes]: I'm just reading over some Cosmology notes and there is a little ODE solve that I am not quite understanding.
I have an equation of the form:
$$
\ddot{R}=-\frac{GM}{R^{2}}
$$
Integrating gives:
$$
\dot{R}^{2}=+\frac{2GM}{R}+C
$$
The notes are essentially saying that this can be solved with a parameter $\theta$:

Could anyone run through the method for solving ODE's such as this.
In terms of density this can be written as:
$$
\dot{R}^{2}=\frac{4\pi{G}}{3}\rho_{0}R
$$

REPLY [5 votes]: (This integral also comes up in the brachistochrone problem, by the way.)
Rearranging it into an integrable form gives
$$ \frac{\sqrt{R}}{\sqrt{-2GM/C-R}} \dot{R} = \sqrt{-C}, $$
so set $K=-2GM/C$. Integrating both sides,
$$ \int_0^R \frac{\sqrt{r}}{\sqrt{K-r}} \, dr = \sqrt{-C}t. $$
Doing the substitution $r=K(1-u^2)$, so $dr=-2Ku\, du$ the integral simplifies to
$$ \int_{\sqrt{1+r/K}}^1 \frac{\sqrt{K}\sqrt{1-u^2}}{\sqrt{Ku^2}} 2u K \, du = 2K \int_{\sqrt{1+r/K}}^1 \sqrt{1-u^2} \, du, $$
where I have chosen the sign for $\sqrt{1+r/K}$ that gives a positive $t$, for obvious reasons. But this is the area under the circle of radius $K$, between the vertical lines $u=0$ and $u=\sqrt{1+r/K}=:U$; some simple geometry shows that we can find this as
$$ \sqrt{-C}t = K \left(- U\sqrt{1-U^2}+\arccos{U} \right), $$
i.e. the difference of a sector and a triangle, and if we then make the substitution $\theta=2\arccos{U}$ (i.e. twice the angle from the horizontal axis to the radius through $(U,\sqrt{1-U^2})$), this simplifies to 
$$ t=\frac{K}{2\sqrt{-C}}(\theta-\sin{\theta}); $$
inverting the equation for $r$ then gives
$$ r=\frac{K}{2}(1-\cos{\theta}), $$
and you can then check that the relationships between $K,A,B,C,GM$ all work out. There's probably a nicer way to derive this with the $A$ and $B$, but this is basically how the actual calculation works.