physics2u
Tier
⌕ Search ⌘K
Derivation

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
Both old and new variables obey Hamilton's equations (canonical target).If we only demand that the equations of motion be reproduced without the Hamiltonian structure, the map may be a point/contact transformation but need not preserve Poisson brackets, and no generating function of these four types need exist.
The transformation is invertible and the relevant variable pair is independent.If, say, ∂Q/∂p = 0 so that q and Q are not independent, the F1 form is singular and one must switch (by Legendre transform) to a type built on a variable pair that is independent.
The two variational integrands differ by a total time derivative only, with unit multiplier (λ = 1).Allowing an overall constant scale λ ≠ 1 gives an extended canonical transformation (e.g. a pure rescaling of both q and p); Poisson brackets are then multiplied by λ and the generating-function relations pick up factors of λ.
Endpoint variations vanish, δq = δQ = 0 at the temporal endpoints.If the boundary term ∫ dF/dt = F|ends does not vanish under variation, adding dF/dt would change the stationarity condition and the two systems would not share the same trajectories.
Derivation
1
δ ∫t₁t₂ ( p q̇ − H(q,p,t) ) dt = 0 ,   δ ∫t₁t₂ ( P Q̇ − K(Q,P,t) ) dt = 0
Hamilton's equations in each set of variables are equivalent to the modified Hamilton's principle (stationary action in phase space) for that set. B
2
p q̇ − H = P Q̇ − K + dF/dt
Two integrands whose integrals are simultaneously stationary for the same varied paths (fixed endpoints) can differ only by the total time derivative of an arbitrary function F, since ∫ dF/dt dt = F|ends has vanishing variation. The unit multiplier fixes a canonical (not merely extended) transformation. C
3
F = F1(q,Q,t) ⇒ dF1/dt = (∂F1/∂q) q̇ + (∂F1/∂Q) Q̇ + ∂F1/∂t
Choose the independent pair to be the old coordinate and new coordinate; expand by the chain rule. This is the first of four admissible choices of independent variables. A
4
( p − ∂F1/∂q ) q̇ − ( P + ∂F1/∂Q ) Q̇ − ( HK + ∂F1/∂t ) = 0
Substitute Step 3 into Step 2 and collect terms. Because q and Q are independent, q̇ and Q̇ are arbitrary and unrelated, so each bracketed coefficient must vanish separately. C
5
p = ∂F1/∂q ,   P = − ∂F1/∂Q ,   K = H + ∂F1/∂t
Read off the vanishing coefficients from Step 4. The first two are implicit transformation equations; inverting them gives Q(q,p,t), P(q,p,t). A
6
F = F2(q,P,t) − QPp = ∂F2/∂qQ = ∂F2/∂PK = H + ∂F2/∂t
To make the new momentum independent, Legendre-transform in the (Q,P) pair: F = F2QP. Then dF/dt = dF2/dt − Q̇PQṖ; the −Q̇P cancels the PQ̇ in Step 2, leaving and as the independent rates. Matching their coefficients gives the shown relations. C
7
F = F3 + qpq = −∂F3/∂p, P = −∂F3/∂Q  |   F = F4 + qpQPq = −∂F4/∂p, Q = ∂F4/∂P
The remaining two types follow by the same Legendre-transform trick applied to the old-variable pair (and to both pairs). In every case K = H + ∂F/∂t, since the Legendre terms carry no explicit-time contribution beyond that already present. B
Result
F1(q,Q): p=∂qF1, P=−∂QF1  •   F2(q,P): p=∂qF2, Q=∂PF2
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 = Pf/∂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/∂qQ 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 MJM = 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.

1
p = ∂F1/∂q = mω q cot Q ,   P = −∂F1/∂Q = ½ mω q² csc²Q
Apply the type-1 relations from the Result. A
2
q = √(2P/mω) sin Q ,   p = √(2P mω) cos Q
Invert: from the P relation q² = (2P/mω) sin²Q; substitute into the p relation using cot·sin = cos. B
3
K = H = (2Pmω cos²Q)/2m + ½mω²(2P/mω) sin²Q = ωP
F1 is time-independent so K = H; the sin²+cos² collapse removes Q. B
4
Q̇ = ∂K/∂P = ω ⇒ Q = ωt + φ ;   Ṗ = −∂K/∂Q = 0 ⇒ P = E
Hamilton's equations for K = ωP. With m = 0.50 kg, ω = 4.0 rad·s⁻¹, E = 0.80 J: P = 0.80/4.0 = 0.20 J·s. A
P = E/ω = 0.20 J·s (const),   Q = ωt + φ,   amplitude √(2P/mω) = √(2·0.20/(0.50·4.0)) = 0.45 m

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.

1
p = ∂F2/∂q = aP ,   Q = ∂F2/∂P = aq
Apply the type-2 relations. Hence Q = aq stretches the coordinate and P = p/a compresses the momentum. A
2
{Q,P} = ∂Q/∂q · ∂P/∂p − ∂Q/∂p · ∂P/∂q = a · (1/a) − 0 = 1
Verify the fundamental Poisson bracket is preserved, confirming the map is canonical (the scale cancels). B
3
K = H = p²/2m = (aP)²/2m = a²P²/2m
F2/∂t = 0 so K = H; substitute p = aP. The new "effective mass" is m/a². B
4
take p = 1.0 kg·m·s⁻¹ ⇒ P = p/a = 0.50 J·s·m⁻¹·? ⇒ check K = (2.0)²(0.50)²/(2·0.25) = 1.0/0.5 = 2.0 J = H = (1.0)²/(2·0.25)
Numeric consistency: both give 2.0 J, confirming the energy value is unchanged. A
Q = 2.0q,   P = 0.50p,   {Q,P} = 1,   K = 2.0 J = H

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
  1. (A) For F1 = qQ, find the transformation and verify it is canonical via Poisson brackets.
    Solutionp = ∂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.
  2. (A) Show F2 = qP generates the identity, and that F2 = qP + bq (constant b) generates a momentum shift.
    SolutionFor F2 = qP: p = ∂qF2 = P, Q = ∂PF2 = q ⇒ identity. For F2 = qP + bq: p = P + bP = pb, and Q = ∂PF2 = q. The coordinate is unchanged and the momentum is shifted by −b.
  3. (B) Find the transformation from F2(q,P,t) = qPvPt (constant v) and its new Hamiltonian for a free particle H = p²/2m. Interpret.
    Solutionp = ∂qF2 = P; Q = ∂PF2 = qvt. So P = p, and Q is the position in a frame moving at speed v. New Hamiltonian: K = H + ∂F2/∂t = P²/2mvP. Check: Q̇ = ∂K/∂P = P/mv = p/mv (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.
  4. (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.
    SolutionP = 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 + φ.
  5. (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).
    SolutionLet Q = ∂F2/∂PF2,P and p = ∂F2/∂qF2,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,qPP/∂p ⇒ ∂P/∂p = 1/F2,qP. Holding p, 0 = F2,qq + F2,qPP/∂q ⇒ ∂P/∂q = −F2,qq/F2,qP. Also Q = F2,P(q,P(q,p)) gives ∂Q/∂q = F2,Pq + F2,PPP/∂q and ∂Q/∂p = F2,PPP/∂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.