2.1.16 · D2Analytical Mechanics

Visual walkthrough — Canonical transformations — generating functions

2,257 words10 min readBack to topic

We assume you know almost nothing. Let's earn every symbol.


Step 0 — The stage: what is "phase space"?

Look at the figure. The horizontal axis is , the vertical axis is . One dot = the whole state right now. The curve = its future and past.

Figure — Canonical transformations — generating functions

A canonical transformation is a relabelling of this plane: new axes (new position) and (new momentum), chosen so the physics stays clean.


Step 1 — The rule the motion obeys (Hamilton's equations)

The dot in means "rate of change with time" — how fast that quantity moves right now. Hamilton's equations say:

\underbrace{\dot p}_{\text{how momentum drifts}}=-\underbrace{\frac{\partial H}{\partial q}}_{\text{slope of energy in the }q\text{ direction}}.$$ > [!intuition] Read it as a flow > $H$ is like a *hill* over the $(q,p)$ plane. Hamilton's equations say the state doesn't roll *downhill* — it flows *along* the contour lines of $H$ (perpendicular to the slope, with that crucial minus sign making it circulate). The figure shows the energy contours as loops and the flow arrows running **around** them. ![[deepdives/dd-physics-2.1.16-d2-s02.png]] **Our goal:** find new coordinates $(Q,P)$ in which this flow is *boringly simple* — ideally straight lines. But we may only use relabellings that keep the flow rule looking identical: $$\dot Q=\frac{\partial K}{\partial P},\qquad \dot P=-\frac{\partial K}{\partial Q},$$ for *some* new energy function $K(Q,P)$. That "keeps the form" requirement is what the word ==canonical== means. --- ## Step 2 — Where the rule comes from: the action principle > [!definition] The action $S$ > Nature picks the actual trajectory as the one that makes a certain running total — the ==action== > $$S=\int\big(p\,\dot q-H\big)\,dt$$ > **stationary**: nudge the path a little (keeping endpoints fixed) and $S$ doesn't change to first order. That "no first-order change" is written $\delta S=0$. Let's decode the integrand $p\dot q - H$ symbol by symbol: - $p\dot q$ — momentum times velocity, a piece of "how the motion accrues". - $-H$ — subtract the energy. - $\int\,dt$ — add it all up over time. > [!intuition] The picture (a stretched-elastic path) > Imagine the true path drawn on the $q$-vs-time graph as a taut elastic band. Any wiggle you add *lengthens the action* — so the taut, un-wiggled band is the real motion. The figure shows the true path in coral and a wiggled competitor in dashed lavender; only the wiggle-free one is "stationary". ![[deepdives/dd-physics-2.1.16-d2-s03.png]] The key fact: **whatever integrand gives you this stationary path also gives Hamilton's equations.** So if two integrands lead to the *same* stationary paths, they describe the same physics. --- ## Step 3 — The one move: two integrands, one physics We want the *new* variables to obey their *own* action principle, $$\delta\!\int\big(P\dot Q-K\big)\,dt=0,$$ with the **same** trajectories (same physics!). When do two integrands give identical stationary paths? > [!definition] Total time derivative > $\dfrac{dF}{dt}$ is the ==rate of change of a function $F$== along the motion. Its integral is just $F(\text{end})-F(\text{start})$ — it depends *only on the endpoints*, not on the path between them. > [!intuition] Why this is the magic key > If you add $\dfrac{dF}{dt}$ to an integrand, the extra bit integrates to $F_\text{end}-F_\text{start}$. But we hold the endpoints **fixed** while wiggling — so this extra bit is a *constant*, and its variation $\delta$ is **zero**. It cannot change which path is stationary! > > In the figure: the shaded endpoint disks are pinned. The dashed detour and solid path enclose extra area, but $dF/dt$ only cares about the pinned ends — so it contributes the same number to *every* competing path. ![[deepdives/dd-physics-2.1.16-d2-s04.png]] Therefore the two integrands may differ by *at most* a total time derivative: $$\underbrace{p\dot q - H}_{\text{old world}}=\underbrace{P\dot Q - K}_{\text{new world}}+\underbrace{\frac{dF}{dt}}_{\text{harmless endpoint term}}.$$ > [!formula] The master relation (everything below is squeezed out of this) > $$\boxed{\;p\,\dot q - H \;=\; P\,\dot Q - K \;+\;\frac{dF}{dt}\;}$$ > $F$ is the ==generating function==. Choose $F$, and the entire transformation $(q,p)\to(Q,P)$ falls out. --- ## Step 4 — Squeeze out the rules: match the differentials ($F_1$) Multiply the master relation by $dt$ so the dots become clean differentials ($\dot q\,dt=dq$): $$p\,dq - H\,dt = P\,dQ - K\,dt + dF.$$ Now suppose $F$ depends on the **old position $q$ and the new position $Q$**: write $F=F_1(q,Q,t)$. Then by the chain rule, $$dF_1=\underbrace{\frac{\partial F_1}{\partial q}}_{\text{how }F_1\text{ changes with }q}\,dq+\underbrace{\frac{\partial F_1}{\partial Q}}_{\text{...with }Q}\,dQ+\underbrace{\frac{\partial F_1}{\partial t}}_{\text{...with }t}\,dt.$$ Substitute and **collect terms with the same differential**: $$\Big(p-\tfrac{\partial F_1}{\partial q}\Big)dq \;=\; \Big(P+\tfrac{\partial F_1}{\partial Q}\Big)dQ \;+\;\Big(K-H+\tfrac{\partial F_1}{\partial t}\Big)dt.$$ > [!intuition] Why the coefficients must match separately (the picture) > $q$, $Q$, and $t$ are **independent knobs** — you can turn one while freezing the others. The figure shows three sliders. If the equation must hold no matter how you jiggle *just* the $dq$ slider (with $dQ,dt$ frozen), then the $dq$ coefficient alone must vanish. Same for each slider. Three independent directions ⟹ three separate equations. ![[deepdives/dd-physics-2.1.16-d2-s05.png]] Setting each coefficient to zero: > [!formula] Type-1 relations (derived, not memorised) > $$p=\frac{\partial F_1}{\partial q}\quad\text{(old momentum)},\qquad > P=-\frac{\partial F_1}{\partial Q}\quad\text{(new momentum, note the }{-}),\qquad > K=H+\frac{\partial F_1}{\partial t}.$$ > [!mistake] Where does the minus sign come from? > **Not** a convention pulled from a hat: $dQ$ sat on the **right-hand side** of the master relation, so moving it left flips its sign. The variable ($Q$) that lives *only inside $F$* — not as a "$p$-partner" on the left — inherits the minus. That's the mnemonic *"lonely-new gets the minus."* --- ## Step 5 — Trade one variable for its partner (Legendre → $F_2$) Type 1 uses new *position* $Q$. What if we'd rather control the new *momentum* $P$? We can't just rename — we must **legitimately swap** $Q$ for $P$ inside $F$. The tool for swapping a variable for its slope-partner is the [[Legendre transformation]]. > [!definition] Legendre swap in one line > The product rule gives $P\,dQ = d(PQ) - Q\,dP$. So $P\,dQ$ (which "uses $dQ$") becomes $-Q\,dP$ (which "uses $dP$") *plus a total differential* $d(PQ)$ — and total differentials are harmless (Step 3!). Define $F_2(q,P,t)=F_1+PQ$. The picture shows the trade: the tangent-line construction that turns a curve's *height at a point* into its *slope*, i.e. converts a $Q$-description into a $P$-description without losing information. ![[deepdives/dd-physics-2.1.16-d2-s06.png]] Running the same "match the differentials" move (now with independent knobs $q,P,t$) gives: > [!formula] Type-2 relations > $$p=\frac{\partial F_2}{\partial q},\qquad Q=\frac{\partial F_2}{\partial P}\quad(\text{no minus now!}),\qquad K=H+\frac{\partial F_2}{\partial t}.$$ > [!intuition] Why the minus vanished here > After the Legendre swap, $P$ appears as a genuine *differential partner* $-Q\,dP$; matching $dP$ coefficients gives $Q=+\partial_P F_2$. The sign is not arbitrary — it is bookkeeping from which side each differential started on. The same swap on the other pair gives $F_3(p,Q)$ and $F_4(p,P)$; each minus/plus is traceable to which differential got Legendre-flipped. --- ## Step 6 — Edge & degenerate cases (never leave the reader stranded) > [!example] Case A — Time-independent $F$ > If $F$ has no explicit $t$, then $\partial F/\partial t=0$, so $\boxed{K=H}$. The **new energy equals the old energy** — the transformation just relabels axes without reshaping the hill. > [!example] Case B — The "do-nothing" generator $F_2=qP$ > Plug into Type-2 rules: > $p=\partial_q(qP)=P$ and $Q=\partial_P(qP)=q$. So $Q=q,\;P=p$ — the ==identity==. A generator *can* be trivial; small tweaks to $qP$ produce infinitesimal flows. > [!example] Case C — Degenerate choice $F_1=qQ$ (swap) > $p=\partial_q(qQ)=Q\Rightarrow Q=p$, and $P=-\partial_Q(qQ)=-q$. Coordinates and momenta **swap** (with a sign): $Q=p,\;P=-q$. This proves $q$ and $p$ are on equal footing — nothing is "intrinsically" a position. > [!mistake] When a type *fails*: forbidden generators > If $F_1$ depends on $q$ and $Q$ but the map $Q\leftrightarrow p$ is not invertible (e.g. $F_1$ linear so $p=\partial_q F_1$ can't be solved back for $Q$), Type 1 breaks — you must switch to a type ($F_2$, $F_3$, $F_4$) whose variables *are* independent. The identity $Q=q$ literally **cannot** be written as an $F_1(q,Q)$ for this reason (you'd need $q$ and $Q$ dependent). That's *why* four types exist — no single one covers every canonical map. --- ## Step 7 — The payoff in a picture: straightening the flow > [!example] Harmonic oscillator, seen geometrically > With $F_1=\tfrac12 m\omega q^2\cot Q$ the parent note found $K=\omega P$. Watch what that means for the flow: > - $\dot P=-\partial_Q K=0$ ⟹ $P$ is **constant** (energy/$\omega$). > - $\dot Q=\partial_P K=\omega$ ⟹ $Q=\omega t+\phi$ ticks at a **steady rate**. > > In old $(q,p)$ coordinates the state runs around an ellipse (Step 2's loops). In new $(Q,P)$ coordinates that same motion is a point sliding along a **horizontal line** at constant speed. The figure shows both side by side — the curved flow *unbent* into a straight one. This is the seed of [[Action–angle variables]]. ![[deepdives/dd-physics-2.1.16-d2-s07.png]] --- ## The one-picture summary ![[deepdives/dd-physics-2.1.16-d2-s08.png]] The whole derivation on one canvas: **action principle** → two integrands may differ only by $dF/dt$ (harmless at pinned endpoints) → **master relation** → match independent differentials → **four type-rules** → a smart $F$ **straightens the phase-space flow**. ```mermaid graph TD A["Action principle: delta S = 0"] --> B["Two worlds, same physics"] B --> C["Integrands differ by dF over dt"] C --> D["Master relation p qdot minus H = P Qdot minus K plus dF/dt"] D --> E["Match dq dQ dt coefficients"] E --> F["Type 1 rules with minus on lonely new"] E --> G["Legendre swap gives Types 2 3 4"] F --> H["Pick clever F to straighten the flow"] G --> H ``` > [!recall]- Feynman retelling (explain the whole walkthrough plainly) > The motion of a system is like a ball flowing around energy hills in a 2D map of "where it is and how it's moving." I want to redraw the map's grid so that flow becomes a boring straight line. But I'm only allowed grids that keep the flow-rule looking the same — those are "canonical." The trick: nature's motion is the one that makes a running total (the action) stop changing when you wiggle the path. If I add a term that only depends on the *start and end* of the path — a total time derivative $dF/dt$ — the wiggle doesn't notice it, because the ends are pinned. So the old recipe and the new recipe are allowed to differ by exactly $dF/dt$ and *nothing else*. Writing that down and asking "which piece multiplies each independent little change $dq$, $dQ$, $dt$?" forces out the rules connecting old and new variables. The single function $F$ *is* the recipe for the new grid. Choose $F$ well — like the oscillator's $\cot$ generator — and the once-curly flow becomes a straight boring line, which is exactly what "solving the problem" means. > [!recall]- Quick self-test > Why can we add $dF/dt$ freely to the integrand? ::: Its integral depends only on the fixed endpoints, so its variation vanishes. > Why do $q$, $Q$, $t$ coefficients match separately? ::: They are independent knobs; the equation must hold for any independent jiggle of each. > Where does the minus in $P=-\partial_Q F_1$ come from? ::: $dQ$ started on the right side of the master relation; moving it left flips the sign. > What geometric thing does a good $F$ do to the flow? ::: It straightens the curved phase-space flow into constant-speed motion along a line. ## Connections - [[Hamilton's equations]] — the form we preserve. - [[Legendre transformation]] — the swap turning Type 1 into Types 2–4. - [[Poisson brackets]] — the algebraic canonicity test. - [[Hamilton–Jacobi equation]] — pushing $K\to 0$ with a time-dependent $F$. - [[Action–angle variables]] — where Step 7 leads. - [[Symplectic geometry]] / [[Liouville's theorem]] — the area-preserving structure behind it all.