# How to solve the differential equation for the motion equation of a body in a gravitational field from one fixed source

I want to develop the motion equation of a body in a classic gravitational field ($F=\frac{Gm_1m_2}{r^2}$).

Starting by creating the lagrangian of a body under gravitational force, in polar coordinates. The speed in direction $\hat{r}$ is $\dot{r}$ and the speed in direction $\hat{\theta}$ is $r\dot{\theta}$. So the kinetic energy of the body is $K=\frac{m}{2}\left(\dot{r}^2+r^2\dot{\theta}^2\right)$ and the potential energy is $U=-\frac{GMm}{r}$.

$M$ is the mass of the source generating the gravitational field (a star), and $m$ is the mass of the body (a planet).

Creating the lagrangian we get:

$$\mathcal{L}=K-U=\frac{m}{2}\left(\dot{r}^2+r^2\dot{\theta}^2\right)+\frac{GMm}{r}$$

Writing down the Euler–Lagrange equation ($\frac{{\partial}\mathcal{L}}{{\partial}q}=\frac{d}{dt}\left(\frac{{\partial}\mathcal{L}}{{\partial}\dot{q}}\right)$)we get $$mr^2\ddot{\theta}=0$$ $$\dot{\theta}=\frac{p_{\theta}}{mr^2}$$ $p_\theta$ is the angular momentum which is conserved $$\theta=\frac{p_{\theta}}{mr^2}t+\theta_0$$

$$m\ddot{r}=mr\dot{\theta}^2-\frac{GMm}{r^2}$$

$$\ddot{r}=\frac{p_{\theta}^2}{m^2}r^{-3}-GMr^{-2}$$

How do I solve the differential equation?

-

If you multiply your last equation by $\dot{r}$ you can integrate once (noting that $\dot{r}\ddot{r} = \frac{\mathrm{d}}{\mathrm{d}t} \frac{\dot{r}^2}{2}$ and $r^{-n}\dot{r}=\frac{\mathrm{d}}{\mathrm{d}t} \frac{r^{-n+1}}{-n+1}$). This leaves you with a first order equation which on which you can separate variables and integrate up.
+1 for the trick. But...then you have to solve a more nonlinear equation $r' = \sqrt{a r^{-2} + b r^{-1} + c}$..... –  Shuhao Cao Jun 13 '13 at 3:30
@ShuhaoCao That's what Michael refers to with separation: rewrite it as $dr / \sqrt{ar^{-2}+br^{-1}+c} = dt$ and all you need is integration - let alpha do it –  Tobias Kienzler Jun 14 '13 at 14:59