physics2u
Depth
PU-201 / L19 · lecture

Hamilton's Canonical Equations

~7 min read · Tier toggle changes depth (T1 plain · T2 standard · T3 rigour)

BEFORE YOU START

You should be comfortable with the Legendre transform and the definition of the Hamiltonian \( H(q, p, t) = p \dot{q} - L(q, \dot{q}, t) \), as established in the previous lecture.

Why this matters

Hamilton's equations replace second-order acceleration equations with a symmetric pair of first-order velocity equations.

This symmetry is not merely aesthetic; it reveals the deep geometric structure of phase space. By treating position and momentum as independent coordinates, we unlock the language of symplectic geometry, which is the prerequisite for understanding canonical transformations, Poisson brackets, and ultimately the transition to quantum mechanics. This formalism allows us to handle constraints and non-Cartesian coordinates with far greater elegance than Newton's vector-based approach.

The Geometric Shift

Newtonian mechanics focuses on forces causing acceleration. It asks, "What pushes the particle?" Hamiltonian mechanics asks, "How does the state evolve?" In the Newtonian view, position and velocity are linked; you cannot specify one without the other in the equation of motion. In the Hamiltonian view, we treat position \( q \) and momentum \( p \) as independent variables defining a point in a new space called phase space. The evolution of the system is then described by how this point moves through that space. The key insight is that the time derivative of position is determined by the slope of the Hamiltonian with respect to momentum, while the time derivative of momentum is determined by the negative slope of the Hamiltonian with respect to position. This creates a perfect duality between the two variables.

Deriving the Canonical Equations

We begin with the Hamiltonian defined via the Legendre transform: \( H(q, p, t) = p \dot{q} - L(q, \dot{q}, t) \). To find the equations of motion, we examine the total differential of \( H \). Treating \( q \), \( p \), and \( t \) as independent variables, we have:

\[ dH = \frac{\partial H}{\partial q} dq + \frac{\partial H}{\partial p} dp + \frac{\partial H}{\partial t} dt \]

However, we can also compute \( dH \) by differentiating the definition \( H = p \dot{q} - L \). Using the product rule and the chain rule for \( L \):

\[ dH = dp \, \dot{q} + p \, d\dot{q} - \left( \frac{\partial L}{\partial q} dq + \frac{\partial L}{\partial \dot{q}} d\dot{q} + \frac{\partial L}{\partial t} dt \right) \]

Recall the definition of conjugate momentum \( p = \frac{\partial L}{\partial \dot{q}} \). The terms involving \( d\dot{q} \) cancel out exactly (\( p \, d\dot{q} - p \, d\dot{q} = 0 \)). We are left with:

\[ dH = \dot{q} \, dp - \frac{\partial L}{\partial q} dq - \frac{\partial L}{\partial t} dt \]

By comparing the coefficients of \( dq \), \( dp \), and \( dt \) in the two expressions for \( dH \), we identify the partial derivatives of the Hamiltonian. This yields the fundamental relations:

\[ \frac{\partial H}{\partial q} = - \frac{\partial L}{\partial q} \qquad \frac{\partial H}{\partial p} = \dot{q} \qquad \frac{\partial H}{\partial t} = - \frac{\partial L}{\partial t} \]

From the Euler-Lagrange equation, we know that \( \frac{d}{dt} \left( \frac{\partial L}{\partial \dot{q}} \right) = \frac{\partial L}{\partial q} \). Since \( p = \frac{\partial L}{\partial \dot{q}} \), this implies \( \dot{p} = \frac{\partial L}{\partial q} \). Substituting this into the first relation above gives \( \dot{p} = - \frac{\partial H}{\partial q} \). Combining this with the second relation, we arrive at Hamilton's canonical equations.

The Symmetric Pair

The result is a set of two first-order differential equations that are structurally identical but with a sign difference. They are:

\[ \dot{q} = \frac{\partial H}{\partial p} \qquad \dot{p} = - \frac{\partial H}{\partial q} \]

This symmetry is profound. It treats \( q \) and \( p \) as partners. If you swap \( q \) and \( p \), and change the sign of time, the equations remain invariant. (Time reversal proper is \( t \to -t \) with \( p \to -p \), which leaves an ordinary Hamiltonian unchanged.) Furthermore, these equations are first-order, meaning that if you know the initial position \( q_0 \) and initial momentum \( p_0 \), you can integrate forward in time uniquely. In Newtonian mechanics, you needed initial position and velocity. Here, you need position and momentum. Since momentum is mass times velocity, the information content is identical, but the mathematical structure is more robust for complex systems.

Conservation and Energy

A critical feature of Hamilton's equations is their relationship to energy conservation. If the Hamiltonian does not depend explicitly on time, i.e., \( \frac{\partial H}{\partial t} = 0 \), then the total time derivative of \( H \) is:

\[ \frac{dH}{dt} = \frac{\partial H}{\partial q} \dot{q} + \frac{\partial H}{\partial p} \dot{p} \]

Substituting the canonical equations into this expression:

\[ \frac{dH}{dt} = \left( - \dot{p} \right) \dot{q} + \left( \dot{q} \right) \dot{p} = 0 \]

Thus, \( H \) is a constant of motion. For standard mechanical systems where the potential energy depends only on position and the kinetic energy is quadratic in velocity, the Hamiltonian \( H \) is exactly equal to the total mechanical energy \( E = T + V \). Therefore, Hamilton's equations automatically encode the conservation of energy when the system is time-translation invariant. This is a direct consequence of the variational principle, not an additional assumption.

The derivation

◆ DERIVATION EMBED · D-133 · not re-derived here

Hamilton's Canonical Equations

Given a non-singular Lagrangian L(q, q̇, t) with conjugate momentum p = ∂L/∂q̇ and Hamiltonian H(q, p, t) = p q̇ − L obtained by Legendre transform, the dynamics of the system are governed by the pair of symmetric first-order equations q̇ = ∂H/∂p and ṗ = − ∂H/∂q, together with ∂H/∂t = − ∂L/∂t. These are Hamilton's canonical equations, equivalent to the single second-order Euler–Lagrange equation.

q̇ = ∂H/∂p      ṗ = − ∂H/∂q
Open full derivation →
Tier 3 · watch out

Do not assume \( H \) is always the total energy. If the Lagrangian contains terms linear in velocity (such as in magnetic fields) or if the transformation to generalized coordinates is time-dependent, \( H \) may differ from \( T + V \). In such cases, \( H \) is still conserved if \( \partial H / \partial t = 0 \), but it is not necessarily the physical energy. Always verify the form of \( H \) before interpreting it as energy. C

Worked example

Problem. Consider a particle of mass \( m \) moving in one dimension under a potential \( V(x) = \frac{1}{2} k x^2 \). Write down the Lagrangian, find the Hamiltonian, and derive the equations of motion. Show that they reproduce the simple harmonic oscillator equation.

  1. Write the Lagrangian \( L = T - V \). Here \( T = \frac{1}{2} m \dot{x}^2 \) and \( V = \frac{1}{2} k x^2 \). So, \( L = \frac{1}{2} m \dot{x}^2 - \frac{1}{2} k x^2 \).
  2. Find the conjugate momentum \( p = \frac{\partial L}{\partial \dot{x}} = m \dot{x} \). Solve for \( \dot{x} \): \( \dot{x} = \frac{p}{m} \).
  3. Construct the Hamiltonian \( H = p \dot{x} - L \). Substitute \( \dot{x} = p/m \): \( H = p \left( \frac{p}{m} \right) - \left( \frac{1}{2} m \left( \frac{p}{m} \right)^2 - \frac{1}{2} k x^2 \right) = \frac{p^2}{m} - \frac{p^2}{2m} + \frac{1}{2} k x^2 = \frac{p^2}{2m} + \frac{1}{2} k x^2 \).
  4. Apply Hamilton's equations. First: \( \dot{x} = \frac{\partial H}{\partial p} = \frac{p}{m} \). Second: \( \dot{p} = - \frac{\partial H}{\partial x} = - k x \).
  5. Combine to find the second-order equation. Differentiate \( \dot{x} = p/m \) with respect to time: \( \ddot{x} = \dot{p}/m \). Substitute \( \dot{p} = -kx \): \( \ddot{x} = - \frac{k}{m} x \). This is the standard SHM equation \( \ddot{x} + \omega^2 x = 0 \) with \( \omega^2 = k/m \).
\[ \ddot{x} + \frac{k}{m} x = 0 \]

Units check. \( k \) has units \( \mathrm{N/m} = \mathrm{kg/s^2} \). \( k/m \) has units \( \mathrm{s^{-2}} \). \( x \) has units \( \mathrm{m} \). \( \ddot{x} \) has units \( \mathrm{m/s^2} \). The term \( (k/m)x \) has units \( \mathrm{s^{-2}} \cdot \mathrm{m} = \mathrm{m/s^2} \). The units are consistent.

CHECK YOURSELF

Three quick tests

  1. If \( H \) is independent of a coordinate \( q_i \), what is conserved?
    AnswerThe conjugate momentum \( p_i \) is conserved because \( \dot{p}_i = - \partial H / \partial q_i = 0 \).
  2. Why are Hamilton's equations first-order?
    AnswerBecause they describe the rate of change of \( q \) and \( p \) directly, rather than the second derivative of \( q \).
  3. What is the physical interpretation of \( \partial H / \partial p \)?
    AnswerIt is the generalized velocity \( \dot{q} \).
PROBLEMS

Problem set for PU-201 →

Each derivation in this unit ends with five graded problems with full solutions.

NOTES

Lecture notes drafted with a local model and checked line by line by the editor; every number in the worked example was recomputed.

Derivations cited: D-133 · Threads: force, energy, symmetry