Menu
Lesson 1.4 · Foundations

Hamiltonian Mechanics

Lagrangian mechanics uses position and velocity: $(q, \dot{q})$. Hamiltonian mechanics uses position and momentum: $(q, p)$. This seemingly small change opens up a completely different view of physics — one that leads directly to quantum mechanics.

From Lagrangian to Hamiltonian

The Legendre Transform

We want to switch from $\dot{q}$ to $p$ as our variable. This is done via the Legendre transform.

The conjugate momentum is defined as:

$$ p = \frac{\partial L}{\partial \dot{q}} $$

For $L = \frac{1}{2}m\dot{q}^2 - V(q)$, this gives $p = m\dot{q}$, the familiar momentum.

The Hamiltonian is defined as:

$$ H(q, p) = p\dot{q} - L(q, \dot{q}) $$

where we express $\dot{q}$ in terms of $p$ (by inverting $p = \frac{\partial L}{\partial \dot{q}}$).

Example: Free Particle

For $L = \frac{1}{2}m\dot{q}^2$:

For a particle in a potential:

$$ H = \frac{p^2}{2m} + V(q) = T + V = E $$

The Hamiltonian is the total energy (when there's no explicit time dependence).

Hamilton's Equations

The Euler-Lagrange equation (one second-order equation) becomes two first-order equations:

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

These are Hamilton's equations — the equations of motion in Hamiltonian form.

Derivation:

Start from $H = p\dot{q} - L$. Take the total differential:

$$ dH = \dot{q}\,dp + p\,d\dot{q} - \frac{\partial L}{\partial q}dq - \frac{\partial L}{\partial \dot{q}}d\dot{q} $$

Since $p = \frac{\partial L}{\partial \dot{q}}$, the $d\dot{q}$ terms cancel:

$$ dH = \dot{q}\,dp - \frac{\partial L}{\partial q}dq $$

But also, since $H = H(q, p)$:

$$ dH = \frac{\partial H}{\partial q}dq + \frac{\partial H}{\partial p}dp $$

Comparing coefficients:

$$ \frac{\partial H}{\partial p} = \dot{q} \qquad \frac{\partial H}{\partial q} = -\frac{\partial L}{\partial q} = -\dot{p} $$

(using Euler-Lagrange: $\dot{p} = \frac{d}{dt}\frac{\partial L}{\partial \dot{q}} = \frac{\partial L}{\partial q}$)

Phase Space

In Lagrangian mechanics, the state of a system is a point in configuration space: the space of all positions $q$.

In Hamiltonian mechanics, the state is a point in phase space: the space of all $(q, p)$ pairs.

q p Harmonic oscillator in phase space
A harmonic oscillator traces an ellipse in phase space. Energy determines the size of the ellipse.

Why Phase Space Matters

Phase space is where physics really lives. Every point represents a complete state — enough to determine the entire future (and past) of the system. Trajectories never cross (determinism). The "flow" of points through phase space encodes all dynamics.

Poisson Brackets

Hamilton's equations have an elegant algebraic structure. Define the Poisson bracket of two functions $f(q,p)$ and $g(q,p)$:

$$ \{f, g\} = \frac{\partial f}{\partial q}\frac{\partial g}{\partial p} - \frac{\partial f}{\partial p}\frac{\partial g}{\partial q} $$

Then Hamilton's equations become:

$$ \dot{q} = \{q, H\} \qquad \dot{p} = \{p, H\} $$

In fact, for any function $f(q, p, t)$:

$$ \frac{df}{dt} = \{f, H\} + \frac{\partial f}{\partial t} $$

Fundamental Poisson Brackets

$$ \{q, q\} = 0 \qquad \{p, p\} = 0 \qquad \{q, p\} = 1 $$

These are the canonical commutation relations in classical mechanics.

Connection: The Road to Quantum Mechanics

In quantum mechanics, Poisson brackets become commutators:

$$ \{q, p\} = 1 \quad \longrightarrow \quad [\hat{q}, \hat{p}] = i\hbar $$

This is the canonical quantization procedure. The entire structure of quantum mechanics follows from replacing $\{,\} \to \frac{1}{i\hbar}[,]$.

Conservation Laws Revisited

A quantity $f(q, p)$ is conserved if $\frac{df}{dt} = 0$. Using our formula:

$$ \frac{df}{dt} = \{f, H\} + \frac{\partial f}{\partial t} = 0 $$

If $f$ has no explicit time dependence, conservation means $\{f, H\} = 0$.

This is Noether's theorem in Hamiltonian language: conserved quantities are those that Poisson-commute with the Hamiltonian.

Liouville's Theorem

Consider a cloud of initial conditions in phase space — an ensemble of systems. As time evolves, each point moves according to Hamilton's equations.

Liouville's Theorem

The phase space volume occupied by an ensemble is constant in time. The cloud can stretch and twist, but its volume is preserved.

Mathematically, the phase space "fluid" is incompressible:

$$ \frac{\partial \dot{q}}{\partial q} + \frac{\partial \dot{p}}{\partial p} = \frac{\partial^2 H}{\partial q \partial p} - \frac{\partial^2 H}{\partial p \partial q} = 0 $$
t = 0 t > 0 (same area)
Phase space volume is preserved. The shape changes, but the area remains constant.

This has profound consequences:

Canonical Transformations

In Lagrangian mechanics, we can change coordinates freely. In Hamiltonian mechanics, we can do even more: we can mix positions and momenta.

A canonical transformation is a change of variables $(q, p) \to (Q, P)$ that preserves the form of Hamilton's equations.

The key requirement: the new variables must satisfy the same Poisson brackets:

$$ \{Q, P\} = 1, \quad \{Q, Q\} = 0, \quad \{P, P\} = 0 $$

This is a much larger group of transformations than just coordinate changes — it's the symplectic group.

Hamilton-Jacobi Theory (Preview)

The deepest formulation of classical mechanics. The idea: find a canonical transformation that makes the new Hamiltonian zero (or trivially simple).

This leads to the Hamilton-Jacobi equation:

$$ H\left(q, \frac{\partial S}{\partial q}\right) + \frac{\partial S}{\partial t} = 0 $$

where $S(q, t)$ is Hamilton's principal function.

Connection: Hamilton-Jacobi and Quantum Mechanics

The Hamilton-Jacobi equation is the classical limit of the Schrödinger equation. If $\psi = e^{iS/\hbar}$, then in the limit $\hbar \to 0$, the Schrödinger equation becomes Hamilton-Jacobi. This is the deepest link between classical and quantum mechanics.

Comparison: Lagrangian vs Hamiltonian

Lagrangian Hamiltonian
Variables: $(q, \dot{q})$ Variables: $(q, p)$
One 2nd-order equation Two 1st-order equations
Configuration space Phase space
Action principle Symplectic geometry
Natural for relativity Natural for quantum mechanics

Exercises

  1. Harmonic oscillator: For $H = \frac{p^2}{2m} + \frac{1}{2}kq^2$, write Hamilton's equations and verify they give $m\ddot{q} = -kq$.
  2. Poisson brackets: Show that $\{L_x, L_y\} = L_z$ for angular momentum components $L_i = \epsilon_{ijk} q_j p_k$.
  3. Canonical transformation: Show that the transformation $Q = p$, $P = -q$ is canonical (preserves Poisson brackets).
  4. Phase portrait: Sketch the phase space trajectories for a pendulum: $H = \frac{p^2}{2mL^2} - mgL\cos\theta$. Identify the equilibria and separatrix.

Key Takeaways