Canonical Transformations and Generating Functions
Statement
A change of phase-space variables (q,p) → (Q,P) preserves the form of Hamilton's equations if and only if there exists a generating function F such that p q̇ − H = P Q̇ − K + dF/dt. Choosing F to depend on one old and one new variable yields exactly four types — F1(q,Q,t), F2(q,P,t), F3(p,Q,t), F4(p,P,t) — whose partial derivatives supply the transformation equations and the new Hamiltonian K = H + ∂F/∂t.
Why it matters
Canonical transformations are the natural symmetry group of Hamiltonian mechanics: they treat coordinates and momenta on an equal footing and let us choose whichever variables make a problem trivial. The generating function is the practical engine — a single scalar potential from which the entire nonlinear map between old and new phase-space variables is read off by differentiation.
They are the doorway to the deepest structural results of classical mechanics. The search for a generator that makes K = 0 is precisely the Hamilton–Jacobi equation; a generator that reduces K to depend only on new momenta produces action–angle variables and exposes conserved quantities. This is the shared machinery behind both the symmetry and energy threads.
Assumptions
Derivation
Result
F3(p,Q): q=−∂pF3, P=−∂QF3 • F4(p,P): q=−∂pF4, Q=∂PF4
and in all four cases K = H + ∂F/∂t
Reading. Pick any one old variable and any one new variable as the two independent arguments of a single scalar F. Its partial derivatives then define the remaining two variables and thereby the whole map; the transformation is guaranteed canonical by construction. When F has no explicit time dependence the Hamiltonian is simply carried over, K = H expressed in the new variables.
Units check. The integrand pq̇ has units (kg·m·s⁻¹)(m·s⁻¹) = kg·m²·s⁻² = J, matching H. Hence dF/dt is in J and F carries units of action, J·s. Check F2 = qP: (m)(kg·m·s⁻¹) = kg·m²·s⁻¹ = J·s ✓; and p = ∂F2/∂q has units J·s/m = kg·m·s⁻¹ ✓.
Limiting cases
- Identity. F2 = qP gives p = P, Q = q — the identity transformation, so F2 is the natural type for maps near the identity.
- Exchange of roles. F1 = qQ gives p = Q, P = −q: the new coordinate is the old momentum. Coordinates and momenta are interchangeable up to sign.
- Point transformations. F2 = f(q,t)P gives Q = f(q,t), p = P ∂f/∂q — every configuration-space coordinate change lifts to a canonical transformation.
- Time-independent generator. ∂F/∂t = 0 ⇒ K = H: energy value is preserved and a conserved H stays conserved.
Breaks when
- Singular variable pairing. When the chosen old/new pair is not independent (e.g. ∂Q/∂p = 0 forbids F1), the Hessian ∂²F/∂q∂Q vanishes or blows up and that type fails; a different type must be used. No single one of the four types generates every canonical transformation (e.g. the identity has no F1).
- Extended / rescaling transformations. If the two integrands differ by a scale λ ≠ 1 (a pure dilation of phase space), the map is only extended-canonical: Poisson brackets scale by λ and the plain K = H + ∂F/∂t relation acquires λ factors.
- Non-Hamiltonian or dissipative flows. The whole construction presupposes a Hamiltonian structure; with friction or other non-conservative forces there is no variational integrand of the form pq̇ − H and generating functions do not apply.
- Broken boundary term. If endpoint variations do not vanish (e.g. periodic or free-endpoint problems handled naively), ∫ dF/dt contributes to the variation and the two systems no longer share trajectories.
Failure modes
- Sign slips. Forgetting the minus sign in P = −∂F1/∂Q (or the sign pattern differing between types) — the four types have genuinely different sign conventions.
- Wrong derivative variable. Differentiating F2(q,P) with respect to q to get Q instead of ∂/∂P; each type pairs a specific derivative with a specific output variable.
- Mixing variables inside F. Writing F1 in terms of p or P — a generating function must be expressed only in its two declared independent variables before differentiating.
- Dropping ∂F/∂t. Assuming K = H for an explicitly time-dependent generator; the explicit-time term is exactly what powers Hamilton–Jacobi.
- Assuming K = H(Q,P) by substitution alone. Students substitute old→new in H but forget that a time-dependent transformation genuinely changes the Hamiltonian.
Discussion
The single equation pq̇ − H = PQ̇ − K + dF/dt is the whole content of the theory. Everything else — four types, all the sign conventions — is bookkeeping about which two variables we hold independent, resolved by Legendre transformations. This is the same Legendre structure that relates Lagrangian and Hamiltonian pictures, now applied to swap old-versus-new variables instead of velocity-versus-momentum.
Canonical transformations form a group, and the generating function is the finite-transformation object whose infinitesimal limit is a phase-space function acting through Poisson brackets. A near-identity F2 = qP + ε G(q,P) generates δq = ε ∂G/∂p, δp = −ε ∂G/∂q — precisely the flow generated by G under the Poisson bracket. Thus every conserved quantity is the generator of the symmetry that conserves it, the classical shadow of Noether's theorem and the direct link to the symmetry thread.
Because canonicity is equivalent to preserving the fundamental Poisson brackets {Q,P} = 1, {Q,Q} = {P,P} = 0 — equivalently the symplectic condition MᵀJM = J on the Jacobian — the generating-function construction is one concrete way to guarantee that structure without checking brackets by hand. Any F of the four types automatically produces a bracket-preserving map.
The deepest use is inverse: rather than picking F and finding the map, we demand a property of the new variables and solve for F. Requiring K = 0 gives the Hamilton–Jacobi equation H(q, ∂S/∂q, t) + ∂S/∂t = 0 for Hamilton's principal function S = F2, whose solution makes the new variables all constant — a complete integration of the motion. Requiring K = K(P) alone yields action–angle variables, the setting of the KAM theorem and of semiclassical (Bohr–Sommerfeld) quantization. Common misconceptions: a canonical transformation is not just any smooth invertible phase-space map (it must preserve the symplectic two-form); "canonical" does not mean "leaves H unchanged" (only time-independent generators do); and F is not a physical energy despite carrying units of action.
Worked examples
Example 1 — Harmonic oscillator to action–angle variables. Take H = p²/2m + ½mω²q² and the type-1 generator F1(q,Q) = ½ mω q² cot Q.
Reading. The generator trades the oscillating (q,p) for a constant action P = E/ω and a uniformly advancing angle Q; the motion is solved completely. Units check. P = J/(rad·s⁻¹) = J·s (action) ✓; amplitude √(J·s/(kg·s⁻¹)) = √(kg·m²·s⁻¹/(kg·s⁻¹)) = m ✓.
Example 2 — Numerical check of a scaling point transformation. Use F2(q,P) = a q P with a = 2.0, on H = p²/2m, m = 0.25 kg.
Reading. A coordinate stretch is canonical only when the momentum is compressed by the reciprocal factor; the phase-space area element dq dp = dQ dP is preserved. Units check. {Q,P} is dimensionless (product QP has units of action, matching qp) ✓; K in J matches H ✓.
Problems
- (A) For F1 = qQ, find the transformation and verify it is canonical via Poisson brackets.
Solution
p = ∂F1/∂q = Q and P = −∂F1/∂Q = −q. So Q = p, P = −q. Then {Q,P} = ∂Q/∂q·∂P/∂p − ∂Q/∂p·∂P/∂q = (0)(0) − (1)(−1) = 1. Canonical; it swaps coordinate and momentum with a sign. - (A) Show F2 = qP generates the identity, and that F2 = qP + bq (constant b) generates a momentum shift.
Solution
For F2 = qP: p = ∂qF2 = P, Q = ∂PF2 = q ⇒ identity. For F2 = qP + bq: p = P + b ⇒ P = p − b, and Q = ∂PF2 = q. The coordinate is unchanged and the momentum is shifted by −b. - (B) Find the transformation from F2(q,P,t) = qP − vPt (constant v) and its new Hamiltonian for a free particle H = p²/2m. Interpret.
Solution
p = ∂qF2 = P; Q = ∂PF2 = q − vt. So P = p, and Q is the position in a frame moving at speed v. New Hamiltonian: K = H + ∂F2/∂t = P²/2m − vP. Check: Q̇ = ∂K/∂P = P/m − v = p/m − v (velocity relative to moving frame) ✓; Ṗ = −∂K/∂Q = 0. This is a Galilean boost realized as a time-dependent canonical transformation; the ∂F/∂t term supplies the frame-velocity correction. - (B) Using the action–angle result of Example 1 with m = 1.0 kg, ω = 2.0 rad·s⁻¹, and total energy E = 1.0 J, compute the action P, the oscillation amplitude, and the maximum momentum.
Solution
P = E/ω = 1.0/2.0 = 0.50 J·s. Amplitude A = √(2P/mω) = √(2·0.50/(1.0·2.0)) = √0.50 = 0.71 m (equivalently √(2E/mω²) = √(2/4) ✓). Max momentum pmax = √(2P mω) = √(2·0.50·1.0·2.0) = √2 = 1.41 kg·m·s⁻¹ (equivalently √(2mE) = √2 ✓). Angle advances as Q = 2.0t + φ. - (C) Prove that a generating function of type F2(q,P) always yields a transformation preserving the fundamental Poisson bracket {Q,P} = 1 (one degree of freedom).
Solution
Let Q = ∂F2/∂P ≡ F2,P and p = ∂F2/∂q ≡ F2,q. Treat (q,p) as independent; then P = P(q,p) is defined implicitly by p = F2,q(q,P). Differentiate: holding q, ∂p/∂p = 1 = F2,qP ∂P/∂p ⇒ ∂P/∂p = 1/F2,qP. Holding p, 0 = F2,qq + F2,qP ∂P/∂q ⇒ ∂P/∂q = −F2,qq/F2,qP. Also Q = F2,P(q,P(q,p)) gives ∂Q/∂q = F2,Pq + F2,PP ∂P/∂q and ∂Q/∂p = F2,PP ∂P/∂p. Then {Q,P} = ∂Q/∂q·∂P/∂p − ∂Q/∂p·∂P/∂q = [F2,Pq + F2,PP(−F2,qq/F2,qP)](1/F2,qP) − [F2,PP/F2,qP](−F2,qq/F2,qP). The two F2,PPF2,qq terms cancel, leaving F2,Pq/F2,qP = 1 by equality of mixed partials. Hence {Q,P} = 1 for any smooth F2 with F2,qP ≠ 0.