Hamiltonian Mechanics
Hamiltonian Mechanics
One more reformulation, and it is the one quantum mechanics actually quantizes. Trading velocity for momentum turns second-order equations into first-order ones, makes "the state of the system" a single point in phase space — and equips observables with an algebraic operation, the Poisson bracket, which is precisely the commutator of Term 1 wearing classical fur.
Learning Objectives
After this lesson you will be able to:
- Compute Legendre transforms and construct the Hamiltonian from a Lagrangian.
- Derive and apply Hamilton's equations, and judge when and when equals the energy.
- Analyze motion in phase space: flow, non-crossing trajectories, oscillator ellipses, and the pendulum separatrix.
- Compute Poisson brackets, exploit their algebraic properties, and evaluate the fundamental brackets.
- Write time evolution as and detect conserved quantities via .
- State Dirac's canonical quantization rule and map to .
Intuition
The Lagrangian lives on positions and velocities; to know where the system goes you still must solve second-order equations. Hamilton's move is to promote the momentum to an independent variable. The payoff is conceptual as much as computational: the complete state of the system becomes a single point in phase space, and dynamics becomes a flow — every point knows exactly where it is going next. On top of this geometry sits an algebra: the Poisson bracket combines any two observables into a third, and time evolution, conservation laws, and symmetries are all statements about brackets. Quantum mechanics keeps the entire structure and changes one thing: the bracket becomes a commutator, with setting the exchange rate.
Theory
The Legendre transform
For a convex function (i.e. ), the Legendre transform is
Since is strictly increasing, is well defined. Geometric meaning: the tangent to at has slope and -intercept , so re-encodes the curve by its family of tangent lines — slope in, intercept out, no information lost. It is involutive: , so transforming returns . Worked scalar example: gives , , and — the shape of every kinetic term to come.
Canonical momentum and the Hamiltonian
Define the canonical momentum conjugate to by (for this is , but not always — recall the magnetic Lagrangian from P.1.2). The Hamiltonian is the Legendre transform of in its velocity slots:
with every eliminated in favor of by inverting .
Hamilton's equations
Take the differential of as defined above:
The terms cancel by the definition of — this is what the Legendre transform is for. Along an actual motion, Euler–Lagrange gives , so . Comparing coefficients with :
Hamilton's equations: first-order equations replacing second-order ones. Oscillator check: gives , — Newton again.
When is ? When is the energy?
Two independent facts. (i) If the map from Cartesian to generalized coordinates has no explicit time dependence, is a homogeneous quadratic ; Euler's theorem for homogeneous functions then gives . With velocity-independent, , so and . (ii) Independently, (proved below), so is conserved exactly when it has no explicit time dependence. All four combinations occur: the bead on a rotating wire (Worked Example 2) has conserved yet , because the rotating constraint makes the coordinate map time-dependent.
Caution. whenever constraints (or the coordinates) are time-dependent — do not read "the Hamiltonian" reflexively as "the energy". And beware a notational ambush ahead: in this program is the Hamiltonian here, but the Hadamard gate in quantum-circuit contexts — Appendix C flags the clash. Context decides.
Phase space
The state of the system is the point — phase space. Hamilton's equations attach a velocity vector to every point, defining a flow; by uniqueness of ODE solutions, exactly one trajectory passes through each point, so trajectories never cross. For the oscillator, traces an ellipse with semi-axes and , of area
Phase-space area carries units of action (J·s). The old quantum theory (P.2.3) will quantize exactly this area in units of Planck's constant — nature slices phase space into cells of size .
Poisson brackets
For two observables , define the Poisson bracket
Its algebra: antisymmetry (swap the two terms) and bilinearity in each slot (derivatives are linear) are immediate. The Leibniz/product rule follows by direct computation: since (same for ),
Finally the Jacobi identity holds (a patient expansion of second derivatives; you verify an instance in E4). The fundamental brackets follow from etc.:
Time evolution is a bracket
Let be any observable, evaluated along a trajectory. Chain rule plus Hamilton's equations:
The Hamiltonian generates time evolution. Special cases: and reproduce Hamilton's equations; $dH/dt = {H, H} + \partial H/\partial t = \partial H/\partial t{H,H}$), proving the conservation claim above. And for any time-independent observable,
The angular momentum algebra
With : , , . Compute by summing over ; the only nonvanishing partials of are , , , , and of : , , , . Term by term (-, -, -slots):
Cyclically, and (E5). This closed algebra — computed here with nothing but calculus — will single-handedly determine the quantum theory of angular momentum in P.6.1.
Dirac's rule: the classical shadow of the commutator
Here is the headline. In 1925 Dirac observed that the Poisson bracket's algebra — antisymmetry, bilinearity, Leibniz rule, Jacobi identity — is exactly the algebra of the operator commutator . Canonical quantization promotes phase-space functions to operators and postulates the correspondence
The consequences land one for one. The fundamental bracket becomes the canonical commutation relation — the single equation from which position–momentum uncertainty follows via the Robertson relation (1.3.2). The evolution law becomes , equivalently — the Evolution Postulate (1.1.3), with the Hamiltonian still the generator of time translation. And becomes , fixing the entire quantum angular momentum spectrum before any differential equation is solved. The Poisson bracket is the classical shadow of the commutator: everything you computed in this lesson survives quantization with , and classical mechanics is recovered as the limit of the commutator algebra.
Worked Examples
Example 1 — The oscillator in phase space, with numbers
A mass kg on a spring N/m: rad/s. Legendre: , so (here : time-independent everything). At J the trajectory is the ellipse with m and kg·m/s, traversed clockwise once per period s. Enclosed area: J·s ✓ — energy and enclosed action are proportional, with the conversion factor.
Example 2 — conserved, yet not the energy
The bead on a wire rotating at constant (P.1.2, Example 2): , so and
No explicit , so is conserved. But the energy is $E = T = \tfrac12 m(\dot r^2 + \Omega^2r^2) = H + m\Omega^2r^2$, which grows as the bead flies outward — the motor does work. The culprit: the time-dependent constraint makes non-homogeneous in (it has a velocity-independent piece ), so the Euler's-theorem step fails and . Conserved Hamiltonian, non-conserved energy — the two notions genuinely split.
Hands-on (Python)
import numpy as np
import matplotlib.pyplot as plt
# --- Phase portraits: oscillator ellipses and the pendulum separatrix ---
m, ell, g = 1.0, 1.0, 9.81
w = np.sqrt(g/ell)
fig, ax = plt.subplots(1, 2, figsize=(11, 4))
q, p = np.meshgrid(np.linspace(-2, 2, 300), np.linspace(-2, 2, 300))
ax[0].contour(q, p, p**2/(2*m) + 0.5*m*w**2*q**2, levels=10)
ax[0].set(title="Oscillator: H contours are ellipses", xlabel="q", ylabel="p")
th, pth = np.meshgrid(np.linspace(-2*np.pi, 2*np.pi, 600), np.linspace(-8, 8, 400))
H_pen = pth**2/(2*m*ell**2) - m*g*ell*np.cos(th)
ax[1].contour(th, pth, H_pen, levels=20)
ax[1].contour(th, pth, H_pen, levels=[m*g*ell], colors="r", linewidths=2)
ax[1].set(title="Pendulum: red = separatrix (E = mgl)", xlabel="theta", ylabel="p")
plt.tight_layout(); plt.show()
# Expected: nested ellipses (left). Right: closed curves (libration) inside the
# red separatrix through (+-pi, 0), open wavy curves (full rotation) outside --
# the separatrix is the trajectory that takes infinite time to reach the top.import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp
# --- Energy drift over 100 periods: explicit vs symplectic Euler vs RK45 ---
# Oscillator with m = w = 1, (q0, p0) = (1, 0), E0 = 1/2.
dt = 0.05
steps = int(100*2*np.pi/dt)
E = lambda q, p: 0.5*(p**2 + q**2)
q_e = np.empty(steps + 1); p_e = q_e.copy(); q_e[0], p_e[0] = 1.0, 0.0
q_s = q_e.copy(); p_s = p_e.copy()
for i in range(steps):
# explicit Euler: both updates from the OLD state
q_e[i+1] = q_e[i] + dt*p_e[i]; p_e[i+1] = p_e[i] - dt*q_e[i]
# symplectic Euler: momentum first, then position with the NEW momentum
p_s[i+1] = p_s[i] - dt*q_s[i]; q_s[i+1] = q_s[i] + dt*p_s[i+1]
t = np.arange(steps + 1)*dt
sol = solve_ivp(lambda t, y: [y[1], -y[0]], (0, t[-1]), [1.0, 0.0],
t_eval=t, rtol=1e-8, atol=1e-10) # RK45 by default
for qq, pp, lab in [(q_e, p_e, "explicit Euler"), (q_s, p_s, "symplectic Euler"),
(sol.y[0], sol.y[1], "RK45")]:
plt.semilogy(t, np.abs(E(qq, pp)/0.5 - 1) + 1e-16, label=lab)
plt.xlabel("t"); plt.ylabel("|E/E0 - 1|"); plt.legend(); plt.show()
# Expected: explicit Euler's energy error grows EXPONENTIALLY (each step
# multiplies E by 1 + dt^2); symplectic Euler's stays bounded ~ dt forever;
# RK45 is tiny but drifts secularly. The symplectic update respects the
# phase-space (bracket) structure -- geometry beats raw accuracy.Exercises
E1 (easy). Compute the Legendre transform of (, ).
Solution
. Then $g(p) = pv - f = p(p/4a)^{1/3} - a(p/4a)^{4/3} = \big(p - \tfrac{p}{4}\big)(p/4a)^{1/3} = \tfrac{3p}{4}\big(\tfrac{p}{4a}\big)^{1/3} \propto p^{4/3}g'(p) = (p/4a)^{1/3} = v$ ✓ (the involution property).
E2 (easy). Construct for a projectile, , write Hamilton's equations, and identify the conserved momentum.
Solution
, , so . Equations: , , , . Since is absent from , is conserved — equivalently .
E3 (medium). For a central potential, . Show and interpret.
Solution
${p_\theta, H} = \sum_{i\in{r,\theta}}\big(\partial_{q_i}p_\theta,\partial_{p_i}H - \partial_{p_i}p_\theta,\partial_{q_i}H\big)p_\theta$ vanish except , leaving since is absent from . Angular momentum is conserved because the Hamiltonian is rotationally symmetric — the bracket version of the cyclic-coordinate argument, and the classical seed of in P.6.1.
E4 (medium). Verify the Jacobi identity for , , (one particle, 1D).
Solution
Inner brackets: ; ; . Then ; ; . Sum: ✓.
E5 (hard). Show and , then prove for . What does this mean physically?
Solution
The theory computation gave ; the relabeling maps 's components into each other and leaves the bracket's structure invariant, so and (or repeat the six-term computation). Compactly, . By Leibniz and antisymmetry: , , and ; the sum vanishes. So is invariant under the rotations any generates: the magnitude of angular momentum is compatible with any one component. Quantum translation: , which is why states carry the simultaneous quantum numbers and (P.6.1).
Checkpoint
- Define the Legendre transform and give its geometric meaning.
- Derive Hamilton's equations from : which terms cancel by construction, and where is Euler–Lagrange used?
- State the separate conditions for and for conserved, with an example where they come apart.
- List the four algebraic properties of the Poisson bracket and the fundamental brackets.
- State Dirac's quantization rule. What do and become?
Answers
- with ; it describes the convex curve by its tangent lines (slope intercept), losing no information, and is involutive.
- In the terms cancel because ; Euler–Lagrange converts to ; matching coefficients of gives , .
- needs a time-independent coordinate map (so is homogeneous quadratic) and velocity-independent ; is conserved iff . Bead on a rotating wire: conserved but .
- Antisymmetry, bilinearity, Leibniz product rule, Jacobi identity; , .
- . Then , and — quantum time evolution, equivalently (1.1.3).
Further Reading
- [Gold] Goldstein, Poole & Safko, Ch. 8 and §9.5 — Hamilton's equations; Poisson brackets and canonical invariants.
- [Sha] Shankar, Ch. 2 — the Hamiltonian formulation, compact and aimed squarely at quantization.
- [Sak] Sakurai & Napolitano, §1.6 — canonical commutation relations and Dirac's analogy, up close.
← Prev: Lagrangian Mechanics · Up: Pre-Term · Next: Blackbody Radiation & Planck's Law →