# Derive hamiltonian from equations of motion

Is there a method for deriving the hamiltonian given that you know the equations of motion? For example given the equation (equation 5 in paper linked) they simply the derive the Hamiltonian in equations 6-8. What is the method behind this? Paper link: https://arxiv.org/abs/1902.01344

• Given the Hamiltonian need not exist or be unique, there cannot be a completely general method. – Buzz Mar 22 at 0:23
• @Buzz thanks for that Buzz, but how then do they obtain the Hamiltonian? – Warrenmovic Mar 22 at 0:35
• They assume right at the beginning of section 2 that there is a gravitational interaction between the two masses, plus a slowly-spatially-varying background gravitational potential $\Phi$. Then, as each particle is moving in a potential, the Hamiltonian is trivially $H=T+V$. What follows is just the usual process of writing that in terms of the relative coordinate for the binary and using the approximation of a slowly varying $\Phi$ to approximate the background potential by a quadratic. They derive the equations of motion from $H$, not vice versa, but simply state $H$ later in the text. – Buzz Mar 22 at 0:43

if you have this kind of differential equations:

$$\vec{\ddot{r}}=-\vec{F}(\vec{r})\tag 1$$

you can get the Hamiltonian.

multiply equation (1) from the left with $$\vec{\dot{r}}$$

$$\vec{\dot{r}}\cdot \vec{\ddot{r}}=-\vec{\dot{r}}\cdot\vec{F}(\vec{r})$$

thus: $$\frac{1}{2}\frac{d}{dt}(\vec{\dot{r}}\cdot \vec{\dot{r}})= -\vec{\dot{r}}\cdot\vec{F}(\vec{r})$$ or $$\frac{1}{2}\int d(\vec{\dot{r}}\cdot \vec{\dot{r}})= -\int\vec{F}(\vec{r})\cdot d\vec{r}$$ $$\Rightarrow$$ $$\underbrace{\frac{1}{2}\vec{\dot{r}}\cdot \vec{\dot{r}}}_{T}=\underbrace{-\int\vec{F}(\vec{r})\cdot d\vec{r}}_{U}$$

with the Lagrangian $$L=T-U$$ you can obtain the Hamiltonian

Example:

$$\ddot{r}=\underbrace{-\frac{M}{r^2}}_{F(r)}$$

$$\Rightarrow$$

$$T=\frac{1}{2}\dot{r}^2\quad,U=-\frac{M}{r}$$

with $$L=T-U$$ you get the Hamiltonian

$$H=\frac{1}{2}\,p^2-\frac{M}{r}=T+U$$

where $$p=\frac{dL}{d(\dot{r})}=\dot{r}$$