Skip to main content
Chemistry LibreTexts

The Hamiltonian formulation of classical mechanics

The Lagrangian formulation of mechanics will be useful later when we study the Feynman path integral. For our purposes now, the Lagrangian formulation is an important springboard from which to develop another useful formulation of classical mechanics known as the Hamiltonian formulation. The Hamiltonian of a system is defined to be the sum of the kinetic and potential energies expressed as a function of positions and their conjugate momenta. What are conjugate momenta?

Recall from elementary physics that momentum of a particle, \(P_i\), is defined in terms of its velocity \(\dot {r}_i\) by

\[ p_i = m_i \dot {r} _i\]

In fact, the more general definition of conjugate momentum, valid for any set of coordinates, is given in terms of the Lagrangian:

\[ p_i = \frac {\partial L}{\partial \dot {r} _i } \]

Note that these two definitions are equivalent for Cartesian variables. In terms of Cartesian momenta, the kinetic energy is given by

\[ K = \sum _{i=1}^N  \frac {P^2_i}{2 m_i} \]

Then, the Hamiltonian, which is defined to be the sum, \(K + U \), expressed as a function of positions and momenta, will be given by

\[ H (p, r) = \sum _{i=1}^N \frac {P^2_i}{2m_i} + U ( r_1, \cdots , r_N) = H (p, r)\]

where \(p \equiv p_1, \cdots , p_N \) . In terms of the Hamiltonian, the equations of motion of a system are given by Hamilton's equations:

\[ \dot {r} _i = \frac {\partial H}{\partial p_i}                                 \dot {p}_i = - \frac {\partial H}{\partial r_i} \]

The solution of Hamilton's equations of motion will yield a trajectory in terms of positions and momenta as functions of time. Again, Hamilton's equations can be easily shown to be equivalent to Newton's equations, and, like the Lagrangian formulation, Hamilton's equations can be used to determine the equations of motion of a system in any set of coordinates.

The Hamiltonian and Lagrangian formulations possess an interesting connection. The Hamiltonian can be directly obtained from the Lagrangian by a transformation known as a Legendre transform. We will say more about Legendre transforms in a later lecture. For now, note that the connection is given by

\[ H (p, r) = \sum _{i=1}^N  p_i \cdot  \dot {r}_i - L (r , \dot {r} ) \]

which, when the fact that \(\dot {r}_i = \frac {p_i}{m_i} \) is used, becomes

\[H (p, r)= \sum _{i=1}^N p_i \cdot \frac {p_i}{m_i} - \sum _{i=1}^N \frac {1}{2} m_i \left (\frac {p_i}{m_i} \right )^2 + U (r_1, \cdots , r_N )\]

\[= \sum _{i=1}^N \frac {P_i^2}{2m_i}  +  U(r_1, \cdots , r_N ) \]

Because a system described by conservative forces conserves the total energy, it follows that Hamilton's equations of motion conserve the total Hamiltonian. Hamilton's equations of motion conserve the Hamiltonian

\[ H (p (t), r (t) ) = H (p(0), r (0) ) = E \]

\(H = \text {const} \Rightarrow \frac {dH}{dt} = 0 \) 

\[\frac {dH}{dt}= \sum _{i=1}^N \left ( \frac {\partial H}{\partial r_i} \cdot \dot {r} _i + \frac {\partial H}{\partial p_i} \cdot \dot {p} _i \right ) \]

\[=\sum _{i=1}^N \left ( \frac {\partial H}{\partial r_i} \cdot \frac {\partial H}{\partial p_i} - \frac {\partial H}{\partial p_i} \cdot \frac {\partial H}{\partial r_i} \right ) = 0 \]

QED. This, then, provides another expression of the law of conservation of energy.