I'm stuck in this exercise and I don't know how to proceed.
A system $$x'=f(x,y) \\ y'=g(x,y)$$
is a Hamiltonian if there is a function $H(x,y)$ such that $$f=H_y,\\ g=-H_x$$
The $H$ function is called Hamiltonian.
I need to prove that any conservative equation $x''=f(x)$ implies a Hamiltonian System, and I need to prove that the Hamiltonian function $H$ coincides to the total energy.
How I prove these two facts?
Quick note, a Hamiltonian $H(x,y)$ for $x,y$ is a function such that \begin{align} \frac{dx}{dt} &= -\frac{\partial H}{\partial y}\\ \frac{dy}{dt} &= \frac{\partial H}{\partial x}\\ \end{align} For the system $x''(t)=f(x)$ consider the function $y(t)=x'(t)$. It follows then that \begin{align} \frac{dx}{dt} &= y(t)\\ \frac{dy}{dt} &= x''(t)=f(x)\\ \end{align} Thus your Hamiltonian function $H(x,x')$ must satisfy \begin{align} \frac{\partial H}{\partial y} &= -y\\ \frac{\partial H}{\partial x} &= f(x) \end{align} Well the function $H(x,y)= -\frac{y^2}{2} + \int_0^x f(t)dt$ satisfies the PDE constraints above. Hope that helps!