Exercises — Canonical transformations — generating functions
The one equation everything hangs on:
Here are the old position and momentum, the new ones, the old Hamiltonian, the new one, and the generating function — a single scalar recipe that manufactures the whole change of variables.
Level 1 — Recognition
Exercise 1.1
State, for each generating-function type, which two variables it depends on and which two relations it produces. Fill the blanks: with and .
Recall Solution
: the old momentum and new coordinate . What we did: read off the table row for Type 3. Why the two minus signs: is reached from the master relation by a Legendre swap in (turning into ), which flips the sign in front of ; and sits on the "-only" side, so its conjugate also carries a minus (same reason as Type 1).
Exercise 1.2
Is the map canonical? Which single generating function produces it?
Recall Solution
Yes — it is the identity, trivially preserving Hamilton's equations. It comes from : then and . Why and not : cannot even describe the identity, because for the identity and are the same variable — they are not independent, so is ill-defined. The identity forces a type that mixes with the new momentum .
Exercise 1.3
True or false: "If does not depend on time then ." Justify.
Recall Solution
True. . If (no explicit ), then , so . What this means physically: a time-independent relabelling of phase space cannot inject or remove energy; it only renames points, so the numerical value of the Hamiltonian at a point is unchanged.
Level 2 — Application
Exercise 2.1
Given (one degree of freedom), find the transformation in terms of .
Recall Solution
Type 1: and . Therefore . What it looks like: points in the plane rotate by (see figure below): the old momentum axis becomes the new coordinate axis. Position and momentum are interchangeable.

Exercise 2.2
Take for small . Show that to first order in this generates an infinitesimal canonical transformation, and give , in terms of evaluated at .
Recall Solution
Type 2 relations:
Q=\frac{\partial F_2}{\partial P}=q+\epsilon\frac{\partial g}{\partial P}.$$ From the first, $P=p-\epsilon\,\partial g/\partial q$, so $\delta p=P-p=-\epsilon\,\partial g/\partial q$. From the second, $\delta q=Q-q=+\epsilon\,\partial g/\partial P$. To first order we may replace $P\to p$ inside $g$ (the error is $O(\epsilon^2)$), giving $$\boxed{\;\delta q=\epsilon\frac{\partial g}{\partial p},\qquad \delta p=-\epsilon\frac{\partial g}{\partial q}\;}$$ **Why this is beautiful:** these are exactly Hamilton's equations with $g$ playing the role of the Hamiltonian and $\epsilon$ the time-step. So $g$ is the **generator of a flow** — the seed of [[Hamilton's equations]] as motion. This is the microscopic origin of "$F_2=qP$ is do-nothing, small additions give motion."Exercise 2.3
Use to compute and , then verify .
Recall Solution
. , using . Solve for : , so . ✓ Why and not something else: the oscillator's phase-space orbits are ellipses. is precisely the function whose Type-1 partials turn into the polar-like that straightens those ellipses into circles of radius set by .
Level 3 — Analysis
Exercise 3.1
Test whether (a rotation by fixed angle in phase space) is canonical, using the Poisson-bracket test .
Recall Solution
The Poisson bracket of two functions of is Here , , , . So Since (and trivially ), the map is canonical for every . What it looks like: rotating the whole plane preserves areas — exactly what Liouville's theorem demands. The case reproduces Ex. 2.1 (… up to the sign convention chosen there).
Exercise 3.2
Show the scaling is not canonical unless , and find the scaling that is canonical. Identify its generating function.
Recall Solution
For : unless . Not canonical. For : . Canonical. Generating function (Type 2): we need and . Try : then ✓ and ⟹ ✓. So . Why the momentum must shrink: stretching positions by stretches phase-space area by ; to keep area fixed (canonicity) the momenta must contract by the same factor.
Exercise 3.3
For , derive the transformation and interpret it.
Recall Solution
Type 3: and . So : another route to the identity. Analysis: the identity is reachable through different generator types ( here vs ) because the choice of which variables to hold fixed is ours; the physical map is the same. This is the Legendre-transform freedom in disguise — see Legendre transformation.
Level 4 — Synthesis
Exercise 4.1
Construct a generating function that sends the free-particle Hamiltonian to a new Hamiltonian in which the new coordinate is cyclic. (Hint: you want independent of .)
Recall Solution
The free particle already has independent of , so is cyclic and is conserved. The cleanest synthesis is the Hamilton–Jacobi choice: pick solving so that (with the conserved energy). This gives , i.e. . Then Now is independent of ⟹ is cyclic, (energy conserved), and ⟹ . Interpretation: literally became time, and the energy — the essence of the Hamilton–Jacobi equation and Action–angle variables.
Exercise 4.2
Given the point transformation (one DOF), find the momentum transformation that makes the pair canonical, via a Type-2 generator with .
Recall Solution
We need , so (plus a -independent piece, take it zero). Then , giving (for ). Check : , so Degenerate case: at the map is not invertible (, and both give the same ) and blows up. So the transformation is canonical only on each half-line or separately — a reminder that "canonical" is often a local statement.
Exercise 4.3
Combine two canonical transformations: first with (so ), then with the same rule . Find the net map and identify it.
Recall Solution
: . : . So the net map is — the point reflection through the origin (rotation by ). Why: each step is a rotation of phase space; two of them make . Canonical transformations form a group — the composition of canonical maps is canonical, so we never need a new generator to justify the result.
Level 5 — Mastery
Exercise 5.1
For the harmonic oscillator with , verify directly (not by the parent's algebra) that using the explicit forms , , by instead computing in the variables and demanding it equal .
Recall Solution
The bracket of the old variables computed with respect to the new ones must equal for a canonical map: With and :
\frac{\partial p}{\partial P}=\sqrt{\tfrac{m\omega}{2P}}\cos Q,$$ $$\frac{\partial q}{\partial P}=\sqrt{\tfrac{1}{2Pm\omega}}\sin Q,\quad \frac{\partial p}{\partial Q}=-\sqrt{2Pm\omega}\sin Q.$$ Then $$\{q,p\}=\sqrt{\tfrac{2P}{m\omega}}\sqrt{\tfrac{m\omega}{2P}}\cos^2 Q -\sqrt{\tfrac{1}{2Pm\omega}}\big(-\sqrt{2Pm\omega}\big)\sin^2 Q =\cos^2 Q+\sin^2 Q=1.\ \checkmark$$ **Mastery point:** the $P$-dependent radicals cancel *exactly*, leaving $\cos^2+\sin^2$. This cancellation is the algebraic shadow of area-preservation — the deep reason $Q$ becomes an angle.Exercise 5.2
Show that for the oscillator solution (with the conserved energy) and interpret the loop integral over one period as .
Recall Solution
From and , is constant; and on-shell means , so . Over one period runs while is fixed, so (The cross-terms integrate to a total differential of around a closed loop and vanish.) What this is: identifies as the action variable , and as its conjugate angle — the full content of Action–angle variables. The oscillator's phase-space ellipse encloses area ; see the figure.

Exercise 5.3
Prove that if generates a canonical transformation, then adding any function of time alone, , changes but not the transformation equations.
Recall Solution
The Type-1 relations and involve derivatives with respect to and . Since depends only on , , so and (hence the whole map) are unchanged. Only picks up : . Mastery point: a purely time-dependent shift of the generator is a gauge freedom — it rescales the "energy zero" of without touching physics, mirroring how Hamilton's equations only care about derivatives of . This is why the master relation tolerates "": total derivatives are physically invisible.
Connections
- Hamilton's equations — the canonical form these exercises preserve.
- Poisson brackets — the test used throughout Level 3–5.
- Hamilton–Jacobi equation — Exercise 4.1's engine.
- Action–angle variables — Exercises 5.1–5.2 build straight into it.
- Liouville's theorem — the area-preservation behind every canonicity check.
- Legendre transformation — why the four types exist (Exercise 3.3).