For the wave equation Hamiltonian density is $2H=\phi_t^2+\phi_x^2$ while the Lagrangian density is $2L=\phi_t^2-\phi_x^2$. I can easily compute the pde from the Lagrangian density but how does one do it from Hamiltonian density?

  • $\begingroup$ By using Hamilton's equations. $\endgroup$
    – Qmechanic
    Jul 17, 2019 at 5:20

1 Answer 1


You need to write the Hamiltonian as a function of $\phi,\,\phi_x,\,\pi:=\frac{\partial L}{\partial\phi_t}=\phi_t$ but not $\phi_t$ before you can obtain Hamilton's equations. Since $H=\frac12\left(\pi^2+\phi_x^2\right)$, $\phi_t=\frac{\partial H}{\partial\pi}=\pi$ while $\pi_t=-\frac{\partial H}{\partial\phi}+\partial_x\frac{\partial H}{\partial\phi_x}=\phi_{xx}$. We can combine these to give $\phi_{tt}=\phi_{xx}$, the same equation obtainable from the Lagrangian.

  • $\begingroup$ But this required knowledge of the Lagrangian beforehand is there some other way that involves converting the halmiltonian into Lagrangian and then applying EL e.g in this case I recognize phi_x^2 as potential density so for the Lagrangian density I simply had to put a negative sign and then apply EL but I am not sure how the method generalizes $\endgroup$ Jul 17, 2019 at 5:41
  • $\begingroup$ @bentenyson You can only use a Hamiltonian once you've written it in terms of $\pi$ instead of $\phi_t$ (although $\phi_x$ is allowed), so you do need to know enough about the Lagrangian to write your Hamiltonian in terms of $\pi$. You do not, however, have to obtain the Euler-Lagrange equation from the Lagrangian; you can use the Hamiltonian instead, but they will agree. $\endgroup$
    – J.G.
    Jul 17, 2019 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.