Consider the Lagrangian for a simple harmonic oscillator \begin{equation} L (x,\dot{x}) = \frac{1}{2}m\dot{x}^2 - \frac{1}{2}kx^2 \end{equation} Obviously we have \begin{align} \frac{\partial L}{\partial x} & = -kx\\ \frac{\partial L}{\partial \dot{x}} & = m\dot{x}\\ \frac{d}{dt} \left(\frac{\partial L}{\partial \dot{x}}\right) & = m\ddot{x} \end{align} So this satisfies the Euler-Lagrange in that we know a $F = ma$ and therefore the force of a spring should follow this law as well, giving us \begin{align} \frac{d}{dt} \left(\frac{\partial L}{\partial \dot{x}}\right) -\frac{\partial L}{\partial x} & =0 \\ m\ddot{x} + kx &= 0 \end{align} Now let's do the Hamiltonian version. Here's where I'm having a problem. We obtain the Hamiltonian via the Legendre transformation and get
\begin{equation} H(x,p) = \frac{1}{2}\frac{p^2}{m} + \frac{1}{2}kx^2 \end{equation} Now, according to what I understand, the equations of motion should be \begin{align} -\frac{\partial H}{\partial x} & = -kx = \dot{p}\\ \frac{\partial H}{\partial p} & = \frac{p}{m} = \dot{x} \end{align} But I don't see what this tells me about the relationship between Newton's law and Hooke's law. For the Lagrangian, when I plug in the relevant information, I get a relationship that explicitly shows for the action \begin{equation} S[x] = \int_a^bL(t,x,\dot{x})dt \end{equation} that it satisfies the EL equation as a necessary condition for $S[x]$ to have an extremum for the given function $x(t)$.

My Question:

How do Hamilton's equations do this? When I look at the "equations of motion" for the Hamiltonian, I don't see how they tell me anything about the action. But they should! That's what their purpose is, just like their Lagrangian analogs do.

The only way I see to do it is to do something like \begin{align} \frac{d}{dt}\left(m\frac{\partial H}{\partial p}\right) & = m\frac{d}{dt}\dot{x}\\ &=m\ddot{x}\\ \end{align} and then organize them something like \begin{align} \frac{d}{dt} \left(m\frac{\partial H}{\partial p}\right) + \frac{\partial H}{\partial x} & =0 \\ m\ddot{x} + kx &= 0 \end{align} But I've never seen anyone do this in the introductory books, so I feel like I must be misunderstanding what the Hamiltonian signifies relative to the action.

  • 1
    $\begingroup$ Hm... well, why would you expect that Hamilton's equations have anything to do with the action? (Not that I'm saying they don't) $\endgroup$
    – David Z
    Mar 3 '15 at 5:56
  • $\begingroup$ @DavidZ I thought the purpose of the action was to, in effect, allow us to identify the shortest path between two points by showing the action is stationary, ie doesn't change with small variation. As I understand it, that was why we have the Lagrangian in the first place. If the system satisfies the EL equation, then it passes one of the necessary conditions for the action to have an extremum. In many cases, this seems to be the equations of motion themselves. So I presumed the Hamiltonian was related to the action since the action seems so important to the Lagrangian formalism. $\endgroup$ Mar 3 '15 at 6:02
  • $\begingroup$ @DavidZ The answer I received would have answered my question. But now I am unsure what the Hamiltonian signifies for the action. So I guess I will wait and see if anyone else replies and answers that question directly. I would like a formal statement of what the Hamiltonian signifies for the action. I have a nice one in my book Calculus of Variations by I. M. Gelfand, ‎S. V. Fomin for the Lagrangian. $\endgroup$ Mar 3 '15 at 6:32

I know I'm late to the party, but let me show that Lagrangian and Hamiltonian mechanics are compatible by direct substitution of the Lagrangian into Hamilton's equations.

The Hamiltonian is, in terms of the Lagrangian, $$H(p,q)=p\dot q(p,q)-L(q,\dot q(p,q))$$ Now we take the first Hamilton equation and plug in $$\dot q=\frac{\partial H}{\partial p}=\dot q+p\frac{\partial\dot q}{\partial p}-\frac{\partial L}{\partial\dot q}\frac{\partial \dot q}{\partial p}$$ Which implies $$p=\frac{\partial L}{\partial \dot q}$$ Now we take the second Hamiltonian equation and plug in $$-\dot p=\frac{\partial H}{\partial q}=p\frac{\partial \dot q}{\partial q}-\frac{\partial L}{\partial q}-\frac{\partial L}{\partial\dot q}\frac{\partial \dot q}{\partial q}$$ Using the first Hamiltonian equation, we see that the last term cancels the first one. We then get $$\dot p=\frac{\partial L}{\partial q}$$ We can then combine the two equations and obtain $$\frac{\partial L}{\partial q}-\frac{d}{dt}\frac{\partial L}{\partial \dot q}=0$$ which is just the Euler-Lagrange equation.

Thus Hamiltonian and Lagrangian mechanics are equivalent.


OP asks in the title (v1) for help understanding what the Hamiltonian signifies for the action compared with the Euler-Lagrange equations for the Lagrangian.

It seems relevant in this context to point out that there is an action principle for both the Lagrangian and Hamiltonian formalism.

  1. On one hand, the stationary action principle for the Lagrangian action $$\tag{L1} S[q]~:=~\int \! dt ~ L(q,\dot{q},t)$$ in the Lagrangian formalism leads to Lagrange's equations of motion (eom)$^1$ $$\tag{L2} \frac{d}{dt}\frac{\partial L}{\partial \dot{q}^i} ~\approx~ \frac{\partial L}{\partial q^i}. $$

  2. On the other hand, the stationary action principle for the Hamiltonian action $$ S_H[q,p] ~:=~ \int \! dt ~ L_H(q,\dot{q},p,t), $$ $$ \tag{H1} L_H(q,\dot{q},p,t) ~:=~ p_i \dot{q}^i - H(q,p,t), $$ in the Hamiltonian formalism leads to Hamilton's eom $$\tag{H2} \dot{q}^i ~\approx~ \frac{\partial H}{\partial p_i}, \qquad -\dot{p}_i ~\approx~ \frac{\partial H}{\partial q^i}. $$


$^1$ Here the $\approx$ symbol means equality modulo eom.

  • $\begingroup$ thanks for addressing this particular issue. So, let me see if I understand: to find the Hamiltonian action, I take the Legendre transform of the Hamiltonian. But I thought this was an involution. So like if $T$ is the Legendre transform yielding $H$ from $L$, then $T \circ T$ should yield $L$ again. But that's not what you have. You have $L_H(q,\dot{q},p,t)$. Why? I would have thought it would be $L(q,\dot{q},t)$ again. Isn't that the definition of an involution? Also, why does the Hamiltonian action then depend on $q,p$ but not the other two variables? $\endgroup$ Mar 3 '15 at 21:57
  • $\begingroup$ 1. If we have derived the condition $\dot{q}^i=f^i(q,p,t)$ from the Legendre transformation, then the Hamiltonian Lagrangian and the Lagrangian take the same value $$L_H(q,f(q,p,t),p,t)~=~ L(q,f(q,p,t),t)$$ on this condition. The Legendre transformation is addressed in more detail in e.g. this Phys.SE post. 2. An action does never depend on dot variables, see e.g. this Phys.SE post. $\endgroup$
    – Qmechanic
    Mar 3 '15 at 22:19

Beginning with

$\begin{align} -\frac{\partial H}{\partial x} & = -kx = \dot{p}\\ \frac{\partial H}{\partial p} & = \frac{p}{m} = \dot{x} \end{align}$

One takes the time derivative of both sides of the second equation

$\frac{d}{dt}(\frac{p}{m}) = \frac{d}{dt}\dot{x}$


$\frac{\dot{p}}{m} = \ddot{x}$

Substituting from Hamilton's first equation

$\frac{-kx}{m} = \ddot{x}$

giving finally

$-kx = m\ddot{x}$


Observe that from the second equation you get $p=m\dot x$, so that substituting into the first gives you $-kx=m\ddot x$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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