A body falls freely toward the Earth from rest
A body falls freely toward the Earth from rest at distance $r_0$ from the Earth's center, in vacuum, taking into account that gravitational force varies with distance ($F=GMm/r^2$). Find the velocity $v$ as a function of the current distance $r$, and the time $t$ elapsed as a function of $r$.
Explanation of Method
With variable gravity, Newton's second law $m\,dv/dt=-GMm/r^2$ is first turned into a separable equation in $v$ and $r$ using the identity $dv/dt=v\,dv/dr$; integrating that gives $v(r)$. Then $v=dr/dt$ is separated again and integrated (via a trigonometric substitution) to give $t(r)$.
Step 1: Acceleration as a function of position
\[a=\frac{dv}{dt}=v\frac{dv}{dr}=-\frac{GM}{r^2}.\]
Step 2: Integrate for $v(r)$
\[\int v\,dv=-GM\int\frac{dr}{r^2}\quad\Longrightarrow\quad \frac{v^2}{2}=\frac{GM}{r}+C_1.\]
Since the body starts from rest ($v=0$) at $r=r_0$: $C_1=-GM/r_0$. Hence
\[v^2=2GM\left(\frac{1}{r}-\frac{1}{r_0}\right),\qquad\boxed{v=\sqrt{2GM\left(\frac{1}{r}-\frac{1}{r_0}\right)}}\]
(taking the magnitude of the falling speed; $r$ decreases as $t$ increases). In terms of surface gravity $g_0=GM/R_E^2$, this is $v=\sqrt{2g_0R_E^2(1/r-1/r_0)}$, and for $h=r_0-r\ll R_E$ it reduces to the familiar $v\approx\sqrt{2g_0h}$.
Step 3: Set up the time integral
Since $r$ decreases as $t$ increases, $dr/dt=-v$, so $dt=-dr/v$ and
\[t(r)=\int_{r_0}^{r}\left(-\frac{dr'}{v(r')}\right)=\int_r^{r_0}\frac{dr'}{\sqrt{2GM\left(\frac1{r'}-\frac1{r_0}\right)}}=\sqrt{\frac{r_0}{2GM}}\int_r^{r_0}\sqrt{\frac{r'}{r_0-r'}}\,dr'.\]
Step 4: Trigonometric substitution
Substituting $r'=r_0\sin^2\theta$ (so $r_0-r'=r_0\cos^2\theta$, $dr'=2r_0\sin\theta\cos\theta\,d\theta$) turns the integrand into an elementary one in $\theta$, and carrying out the integration (then converting back to $r$ via $\theta=\arccos\sqrt{r/r_0}$) yields
\[\boxed{t=\sqrt{\frac{r_0^3}{2GM}}\left[\arccos\sqrt{\frac{r}{r_0}}+\sqrt{\frac{r}{r_0}\left(1-\frac{r}{r_0}\right)}\right]}\]
Step 5: Verification
Differentiating this closed form with respect to $r$ and simplifying reproduces exactly $dt/dr=-1/v(r)$ from Step 3, confirming the antiderivative; and it correctly gives $t=0$ at $r=r_0$ (the moment of release).
Step 6: Small-height limit
For $h=r_0-r\ll R_E$, $\dfrac1r-\dfrac1{r_0}\approx\dfrac{h}{R_E^2}$, so $v\approx\sqrt{2g_0h}$ — the ordinary constant-gravity result, as expected when the variation of gravity over the fall is negligible.
Result
Final answer:
\[\boxed{v=\sqrt{2GM\left(\frac{1}{r}-\frac{1}{r_0}\right)},\qquad t=\sqrt{\frac{r_0^3}{2GM}}\left[\arccos\sqrt{\frac{r}{r_0}}+\sqrt{\frac{r}{r_0}\left(1-\frac{r}{r_0}\right)}\right]}\]