Home / Learn / Exam prep / GATE Physics / Lesson 2.2
All lessons

Module 2: Classical mechanics · Lesson 2.2 · about 50 min

Hamiltonian mechanics and phase space

The Legendre transform from L to H, Hamilton's equations, when H is the energy and when it is conserved, phase space and phase portraits, the pendulum's separatrix, Liouville's theorem, the Routhian, action variables and adiabatic invariants.

Key points, meanings and formulas on one page: choose "Save as PDF" in the print box.

Module 2 · about 50 minutes. By the end you will be able to build a Hamiltonian from a Lagrangian, write and solve Hamilton’s equations, tell when H is conserved and when it is the energy, sketch and read phase portraits, use Liouville’s theorem, and use adiabatic invariants for slowly changing systems.

This lesson builds on lesson 2.1, Lagrangian mechanics.

Trade n second-order equations in q for 2n first-order equations in q and p. The motion becomes a flow in phase space, and that flow has a geometry (it keeps volumes) that Newton's form hides.

1. The Legendre transform

The Lagrangian is a function of q and q˙. To use the momentum p=∂L/∂q˙ as a variable instead of q˙, take the Legendre transform:

H(q,p,t)=∑jpjq˙j−L(q,q˙,t),with every q˙j written in terms of q,p

The last step matters: H must be a function of q and p only. Leaving a q˙ in it is the commonest mistake. The transform works when p=∂L/∂q˙ can be solved for q˙ (the matrix ∂2L/∂q˙j∂q˙k is invertible).

Worked example: polar coordinates. L=12m(r˙2+r2θ˙2)−U(r) gives pr=mr˙ and pθ=mr2θ˙. Then r˙=pr/m, θ˙=pθ/(mr2), and

H=pr22m+pθ22mr2+U(r)

Worked example: a charge. From L=12mv2+qv→⋅A→−qϕ, p→=mv→+qA→, so H=(p→−qA→)22m+qϕ. The rule p→→p→−qA→ (minimal coupling) carries over directly into quantum mechanics.

2. Hamilton’s equations

Take the differential of H and use the Euler-Lagrange equation p˙j=∂L/∂qj:

q˙j=∂H∂pj,p˙j=−∂H∂qj,dHdt=∂H∂t=−∂L∂t
(q, p)
a point in phase space: 2n numbers that fix the state completely, so the future follows from them alone
q̇ = ∂H/∂p
the velocity follows from the momentum (for H = p²/2m + V it is just p/m)
ṗ = −∂H/∂q
the force: momentum changes as H falls with q
dH/dt = ∂H/∂t
H is conserved whenever it has no explicit time dependence
Physical meaning
H is the generator of time evolution. Knowing one function of (q, p) tells you how every point of phase space moves in the next instant.

A cyclic coordinate is even more useful here: if qk is missing from H, then pk is a constant number α and can be put straight into H, which then has one fewer degree of freedom. In the central-force H above, pθ=ℓ and the radial problem is H=pr2/2m+Ueff(r).

Worked example. H=p22m+12mω2q2. Hamilton’s equations give q˙=p/m and p˙=−mω2q, so q¨=−ω2q. In phase space the orbits are ellipses p2/(2mE)+q2/(2E/mω2)=1 with area π2mE2E/(mω2)=2πE/ω.

The same equations follow from a variational principle in phase space, δ∫(∑pjq˙j−H)dt=0, with q and p varied independently. That form is the starting point for canonical transformations in lesson 2.3.

3. Is H the energy? Is it conserved?

These are two separate questions, and exams test both.

Situation H conserved? H = T + V?
fixed constraints, V(q) only yes yes
coordinates have explicit t (spinning hoop, rotating frame) but L has no explicit t yes no
explicit t in L (a driven oscillator, V = −qE₀x cos ωt) no yes, if coordinates are fixed

Worked example: a rotating frame. In a frame turning at constant ω→, a free particle in potential V has L=12m(r→˙+ω→×r→)2−V. Then p→=m(r→˙+ω→×r→), the inertial momentum, and

H=p22m+V−ω→⋅(r→×p→)

It is conserved (no explicit t) but is the inertial energy minus ω→⋅L→. In celestial mechanics this is the Jacobi integral of the restricted three-body problem, and it fixes where the Lagrange points are.

4. Phase portraits and the pendulum

For one degree of freedom with ∂H/∂t=0, each orbit lies on a curve H(q,p)=E, so the whole motion can be drawn as a phase portrait without solving anything. Fixed points are where ∂H/∂q=∂H/∂p=0: a minimum of H is a centre (closed orbits around it, stable), a saddle is a hyperbolic point (unstable).

The pendulum has H=p22ml2−mglcos⁡θ:

E just above −mgl. Small ellipses round θ = 0: simple harmonic motion with period 2π√(l/g).

Larger E < mgl. Closed but squashed orbits: the pendulum still swings back and forth (libration), and the period grows with amplitude.

E = mgl, the separatrix. The orbit runs into the inverted position θ = ±π, taking infinite time to get there. It separates swinging from spinning.

E > mgl. Open wavy curves: the pendulum goes over the top and keeps turning (rotation), with p never zero.

Phase portrait of a pendulum (units m = l = g = 1). Move the energy slider: the point follows its orbit by Hamilton's equations, and the period, from the exact elliptic integral, grows without limit as the energy reaches the separatrix at 1.

The exact period for amplitude θ0 is T=4l/gK(sin2⁡(θ0/2)), with K the complete elliptic integral. For small amplitudes, T≈2πl/g(1+θ02/16). At 30° the correction is about 1.7%.

5. Liouville’s theorem

Think of many copies of the same system, started at slightly different points: a cloud of points in phase space. Hamilton’s equations make the cloud flow like a fluid, and that fluid is incompressible:

∇⋅(q˙,p˙)=∑j(∂2H∂qj∂pj−∂2H∂pj∂qj)=0⟹dρdt=∂ρ∂t+{ρ,H}=0

The density of points along any flow line stays fixed, so phase-space volume is conserved. Consequences:

  • There are no attractors in Hamiltonian systems: friction (which does shrink phase volume) cannot be described by an ordinary time-independent H.
  • A beam of particles cannot be focused in position without spreading in momentum. Beam “emittance” is a phase-space area, and reducing it needs a non-Hamiltonian process such as cooling.
  • In statistical mechanics, a density that depends only on H is unchanged by the motion. This is why the microcanonical and canonical ensembles are equilibrium states.

Worked example. Particles in free fall, H=p2/2m+mgq, start in the square 0<q<a, 0<p<b. After time t, p→p−mgt and q→q+pt/m−12gt2. The square becomes a parallelogram sheared by t/m: same base b, same height a, so the area ab is unchanged.

6. The Routhian

Sometimes it pays to Legendre-transform only the cyclic coordinates. The Routhian R=L−∑cyclicpkq˙k, written in terms of the conserved pk, acts as a Lagrangian for the remaining coordinates. For a central force, R(r,r˙)=12mr˙2−ℓ2/(2mr2)−U(r), and the Euler-Lagrange equation for r follows at once with the centrifugal term built in. Note the sign: the centrifugal energy enters R with a minus sign, as part of an effective potential.

7. Action variables and adiabatic invariants

For a periodic motion in one degree of freedom, the action

J=∮pdq

is the area enclosed by the orbit in phase space. Its use is that it survives slow change: if a parameter (the length of a pendulum, the stiffness of a spring, a magnetic field) changes over many periods, J stays very nearly constant even though the energy does not. It is an adiabatic invariant.

Worked example. For an oscillator J=2πE/ω. Stiffen the spring slowly until ω doubles: E doubles too. Because E=12mω2A2, the amplitude falls as A∝ω−1/2, so it drops by 2. The same rule in old quantum theory, J=nh, gave E=nℏω, which is why quantum numbers do not jump when a potential is changed slowly.

Other examples: a gas compressed slowly in a box (the action of each bouncing molecule 2mvL is fixed, which gives the adiabatic law TV2/3 = constant for a monatomic gas), and a charged particle gyrating in a slowly changing magnetic field, whose magnetic moment μ=mv⟂2/2B stays fixed. That is what makes magnetic mirrors and the Van Allen belts trap particles.

“Slow changes keep the energy fixed.” They keep the action fixed, not the energy. A slowly shortened pendulum gains energy (the hand pulling the string up does work against the tension, which is larger than average while the bob swings fast at the bottom). The energy goes up as ω does, keeping E/ω constant.

Writing H as a function of action alone, H(J), gives the frequency at once: ν=∂H/∂J. For the oscillator H=Jω/2π, so ν=ω/2π, as it should be. The angle variable conjugate to J then grows uniformly in time; this action-angle picture is the language of perturbation theory and of the KAM theorem on which orbits survive a small perturbation.

  • H=∑pjq˙j−L, written in q,p only; pj=∂L/∂q˙j.
  • Hamilton’s equations: q˙=∂H/∂p, p˙=−∂H/∂q; dH/dt=∂H/∂t.
  • H is conserved when it has no explicit t; it is T+V when the coordinates have no explicit t. A rotating frame gives H=E−ω→⋅L→.
  • Charge: H=(p→−qA→)2/2m+qϕ.
  • Phase portraits: minima of H are centres, saddles are unstable; the pendulum’s separatrix E=mgl divides swinging from spinning.
  • Liouville: phase-space volume is conserved; no attractors without dissipation.
  • Action J=∮pdq is an adiabatic invariant; for an oscillator E/ω is fixed and A∝ω−1/2; ν=∂H/∂J.

Practise: exam questions on this lesson

They start easy and climb to top-rank level. More on the Hamiltonian mechanics practice page.

Before this: lesson 2.1, Lagrangian mechanics. Next: lesson 2.3, Poisson brackets and canonical transformations. Basics: the JAM lesson on simple harmonic motion.

Going on to CSIR NET? Phase space, fixed points and stability reads Hamilton’s equations as a flow in phase space.

Check yourself

1For a particle in a rotating frame, H = p²/2m + V(r) − ω·L, with ω constant. Which statement is true?
2Liouville's theorem says that, for a Hamiltonian system, a cloud of phase points
3A pendulum's length is shortened very slowly. Which quantity stays (almost) constant?

Sources

  • H. Goldstein, C. Poole and J. Safko, Classical Mechanics, 3rd ed. (2002), chapters 8 and 10
  • L. D. Landau and E. M. Lifshitz, Mechanics, 3rd ed. (1976), chapter 7
  • V. I. Arnold, Mathematical Methods of Classical Mechanics, 2nd ed. (1989), chapters 3 and 9
  • GATE Physics syllabus (Classical Mechanics), IIT organising institute; CSIR-UGC NET Physical Sciences syllabus, Part A Classical Mechanics

Your ticks stay in this browser. Save them as a file on the course home.

Updated 2026-11-22. Not affiliated with the IITs, IISc or the GATE organising institute. The general aptitude part of GATE is not covered here. Check the official GATE website for the current pattern. All questions are original.