Generating Functions and the Four Types

The symplectic condition and the Poisson-bracket tests are referees: hand them a map (q,p)→(Q,P)(q,p)\to(Q,P) and they will rule on whether it is canonical. But a referee never scores a goal. The production problem — manufacture for me a transformation that is guaranteed canonical, preferably one that makes my Hamiltonian trivial — needs a different tool entirely. That tool is a single scalar function of mixed old and new variables whose partial derivatives spit out the entire transformation, canonicity included, with no check required afterwards. The mechanism is a loophole you have met before. Two action integrands that differ by a total time derivative dF/dt\mathrm{d}F/\mathrm{d}t produce identical stationary paths, because the difference integrates to endpoint values the variation never touches. Demanding that the old integrand pq˙−Hp\dot q-H and the new one PQ˙−KP\dot Q-K exploit exactly this loophole forces FF's partial derivatives to encode the map. And because FF must mix one old variable with one new one — (q or p)×(Q or P)(q\ \text{or}\ p)\times(Q\ \text{or}\ P) — there are exactly four basic types, F1F_1 through F4F_4, connected to each other by the same Legendre machinery that built the Hamiltonian out of the Lagrangian. This article owns the taxonomy: where the four types come from, the master table of their derivative relations, the Legendre ladder between them, and the existence question — why the identity transformation stubbornly refuses an F1F_1 while the coordinate–momentum exchange refuses an F2F_2. The three companion articles then put each type to work on full transformations. Master the grammar here and Hamilton–Jacobi theory, one article downstream, becomes a single sentence: choose F2F_2 so that K=0K=0.

Key takeaways
  • A generating function is a scalar FF of one old and one new phase-space variable whose partial derivatives produce a canonical transformation automatically — construction, not verification.
  • The freedom comes from the modified Hamilton's principle: pq˙−Hp\dot q-H and PQ˙−KP\dot Q-K may differ by a total derivative dF/dt\mathrm{d}F/\mathrm{d}t without changing the stationary paths.
  • The independent-pair choice (q or p)×(Q or P)(q\ \text{or}\ p)\times(Q\ \text{or}\ P) gives exactly four basic types: F1(q,Q,t)F_1(q,Q,t), F2(q,P,t)F_2(q,P,t), F3(p,Q,t)F_3(p,Q,t), F4(p,P,t)F_4(p,P,t).
  • The types are Legendre transforms of one another — F2=F1+QPF_2=F_1+QP, F3=F1−qpF_3=F_1-qp, F4=F1−qp+QPF_4=F_1-qp+QP — and every type obeys K=H+∂F/∂tK=H+\partial F/\partial t.
  • Existence is not guaranteed type by type: the identity has an F2=∑qiPiF_2=\sum q_iP_i but no F1F_1; the exchange has F1=∑qiQiF_1=\sum q_iQ_i but no F2F_2. A type lives only where its variable pair is independent.
  • Key idea: Demanding that the old and new phase-space Lagrangians differ by a total derivative dF\mathrm{d}F forces FF's partials to encode a canonical map; which two variables FF depends on selects one of four interchangeable (Legendre-related) types.

Where this lives today

Canonical perturbation theory still runs on near-identity type-2 generators. To absorb a perturbation ϵH1\epsilon H_1 one posits F2=∑iqiPi+ϵ χ(q,P)F_2=\sum_i q_iP_i+\epsilon\,\chi(q,P) and chooses χ\chi order by order to cancel unwanted terms — the modern Lie-series formulations repackage the same move algebraically. Every KAM-type stability argument for the solar system, and every accelerator-physics computation of resonance widths, opens with exactly this generator. Computation leans on the taxonomy just as hard. Symplectic integrators can be built by discretizing the generating function rather than the equations of motion: any F2(q,P)F_2(q,P) equal to qP+O(Δt)qP+\mathcal{O}(\Delta t) produces a map that is exactly canonical whatever its truncation error, which is why such schemes conserve phase-space volume to machine precision over billions of steps — the standard technology for Gyr-scale planetary ephemerides. In accelerator and beam optics, transfer maps through magnet lattices are stored and composed as mixed-variable generators for the same reason: canonicity survives truncation. Even machine learning has arrived: "generating function neural networks" parametrize an F2F_2 with a network and inherit exact symplecticity by construction, the master table acting as the network's output layer.

The physical picture

Think of a canonical transformation as a relabelling of phase space that keeps the symplectic area dq∧dp\mathrm{d}q\wedge\mathrm{d}p intact, and think of a generating function as a potential for the relabelling: one scalar landscape whose slopes in two directions dictate how both axes move at once. A vector field built from the slopes of a single potential cannot curl arbitrarily — and that hidden integrability constraint is precisely canonicity. You never impose the symplectic condition; the existence of the potential is the condition, pre-solved. Why four potentials and not one? For the slopes to determine the map, the two variables FF depends on must together pin down a phase-space point — one label from the old chart, one from the new. Two choices on each side give a 2×22\times2 grid, and the four corners are bridged by Legendre transformations, exactly the moves that connect the thermodynamic potentials:

Figure
The four generating-function types as corners of a Legendre square, each corner listing its natural variables and derivative rules
F₁(q, Q, t) p = +∂F₁/∂q   P = −∂F₁/∂Q anchor: F₁ = qQ → the exchange identity impossible here F₂(q, P, t) p = +∂F₂/∂q   Q = +∂F₂/∂P anchor: F₂ = qP → the identity workhorse of Hamilton–Jacobi F₃(p, Q, t) q = −∂F₃/∂p   P = −∂F₃/∂Q anchor: F₃ = pQ → both signs flip natural when p is easy to keep F₄(p, P, t) q = −∂F₄/∂p   Q = +∂F₄/∂P anchor: F₄ = pP → exchange, other way rarest in practice + QP + QP − qp − qp K = H + ∂F/∂t same rule at every corner horizontal moves swap Q for P; vertical moves swap q for p — one Legendre step per edge

The engine underneath is the boundary-term freedom. Hamilton's principle only ever compares the interior of paths; anything a total derivative contributes lives entirely at the endpoints, where variations are frozen. Two descriptions can therefore disagree by a whole function FF and still agree on every equation of motion — and that disagreement, far from being waste, is the room in which the transformation hides:

Figure
The boundary loophole — two integrands whose difference is a total derivative share every stationary path
t t₁ (fixed) t₂ (fixed) old integrand: p q̇ − H new integrand: P Q̇ − K gap = dF/dt ∫ (gap) dt = F(t₂) − F(t₁) — pure endpoint bookkeeping variations vanish at the endpoints, so both integrands crown the same stationary paths the whole generating-function formalism lives inside this gap

One more orientation point before the algebra. The choice of which mixed pair is independent is not cosmetic — it is where existence lives. Near the identity transformation, Q≈qQ\approx q, so the pair (q,Q)(q,Q) collapses onto a single label and F1F_1 has nothing to grip; the pair (q,P)(q,P) stays honest, which is why perturbation theory runs on F2F_2. The taxonomy earns its keep the moment you ask it to do real work.

The master relation and the type-1 rules

Everything descends from one identity. The old chart satisfies the modified Hamilton's principle with integrand pq˙−Hp\dot q-H; the new chart, by the definition of canonicity established in Definition of Canonical Transformations, satisfies it with PQ˙−KP\dot Q-K. Stationary paths coincide precisely when the integrands differ by a total time derivative:

p q˙−H(q,p,t)=P Q˙−K(Q,P,t)+dFdt(1)p\,\dot q-H(q,p,t)=P\,\dot Q-K(Q,P,t)+\frac{\mathrm{d}F}{\mathrm{d}t} \qquad (1)

where: q,pq,p — the old canonical pair; Q,PQ,P — the new pair; H,KH,K — old and new Hamiltonians; FF — the generating function, a scalar whose only job is to absorb the mismatch. Read it as an exchange rate posted at the border between two charts: the descriptions may disagree, but only by something that integrates to endpoint values. Multiplying by dt\mathrm{d}t turns (1) into the differential statement that carries all the information:

dF=p dq−P dQ+(K−H) dt(2)\mathrm{d}F=p\,\mathrm{d}q-P\,\mathrm{d}Q+(K-H)\,\mathrm{d}t \qquad (2)

where: the right-hand side is manifestly built from the differentials dq\mathrm{d}q, dQ\mathrm{d}Q, dt\mathrm{d}t — announcing that the natural variables of this FF are (q,Q,t)(q,Q,t). That observation is the definition of the first type, F1(q,Q,t)F_1(q,Q,t), and reading off its consequences is the first derivation.

Derivation AThe type-1 derivative relations from the boundary freedom

We are deriving the three equations that make F1(q,Q,t)F_1(q,Q,t) a machine for producing canonical transformations: p=∂F1/∂qp=\partial F_1/\partial q, P=−∂F1/∂QP=-\partial F_1/\partial Q, and K=H+∂F1/∂tK=H+\partial F_1/\partial t. The strategy is coefficient matching — write dF1\mathrm{d}F_1 twice, once from the boundary identity (2) and once from the chain rule, and equate what multiplies each independent differential. The step to watch is the licence for the matching: it requires (q,Q,t)(q,Q,t) to be usable as independent coordinates, an assumption that will fail for perfectly good transformations and thereby spawn the other three types.

Step 1. Assume the transformation is such that qq and QQ together label phase-space points — knowing both singles out one state. Then F1F_1 may be regarded as a function of (q,Q,t)(q,Q,t), and the chain rule gives

dF1=∂F1∂q dq+∂F1∂Q dQ+∂F1∂t dt\mathrm{d}F_1=\frac{\partial F_1}{\partial q}\,\mathrm{d}q+\frac{\partial F_1}{\partial Q}\,\mathrm{d}Q+\frac{\partial F_1}{\partial t}\,\mathrm{d}t

Why the assumption is real: for the identity map Q=qQ=q, the pair (q,Q)(q,Q) carries the information of one variable, not two — the assumption collapses, and with it the whole type. Existence is settled in Derivation C.

Step 2. Equate this with the boundary form dF1=p dq−P dQ+(K−H) dt\mathrm{d}F_1=p\,\mathrm{d}q-P\,\mathrm{d}Q+(K-H)\,\mathrm{d}t from (2). Because dq\mathrm{d}q, dQ\mathrm{d}Q, dt\mathrm{d}t are independent, their coefficients must match one by one:

p=∂F1∂q,P=−∂F1∂Q,K=H+∂F1∂t(3)p=\frac{\partial F_1}{\partial q},\qquad P=-\frac{\partial F_1}{\partial Q},\qquad K=H+\frac{\partial F_1}{\partial t} \qquad (3)

Why the minus sign on PP: in (2) the new momentum enters through −P dQ-P\,\mathrm{d}Q — the new chart sits on the other side of the identity, so its p dqp\,\mathrm{d}q-type term crossed the equals sign. Every sign in the master table below descends from this single one.

Step 3. Confirm that the relations really define a transformation. The first equation, p=∂F1(q,Q,t)/∂qp=\partial F_1(q,Q,t)/\partial q, is an implicit equation for Q(q,p,t)Q(q,p,t); solving it and inserting into the second yields P(q,p,t)P(q,p,t). The map so produced is canonical by construction — it inherited the boundary identity, which is the definition of canonicity, so no symplectic check is owed afterwards. Why nothing more is needed: canonicity was the input, not a property to verify. The tests of the symplectic condition and the fundamental Poisson brackets remain useful for maps proposed without a generator. *As a check: for the exchange generator F1=qQF_1=qQ, the relations give p=Qp=Q and P=−qP=-q — the coordinate–momentum swap — and {Q,P}q,p={p,−q}=1\{Q,P\}_{q,p}=\{p,-q\}=1 confirms canonicity.*

For n degrees of freedom every statement runs in parallel per index: pi=∂F1/∂qip_i=\partial F_1/\partial q_i, Pi=−∂F1/∂QiP_i=-\partial F_1/\partial Q_i, with F1(q1,…,qn,Q1,…,Qn,t)F_1(q_1,\dots,q_n,Q_1,\dots,Q_n,t). Nothing new appears except richer options for which variables to mix — the "mixed types" of the FAQ.

The Legendre ladder and the master table

The type-1 rules privilege (q,Q)(q,Q). But suppose your transformation is most naturally described by the old coordinate and the new momentum — as the identity and everything near it insists. You already own the tool for trading a variable for its conjugate slope without losing information: the Legendre transformation, used exactly as it was to build HH from LL (we lean on that article rather than re-derive it). One Legendre step per edge of the square walks you to all four types.

Go deeper · Derivation B · 1 minThe Legendre ladder from type 1 to the other three
Derivation BThe Legendre ladder from type 1 to the other three

The goal is the complete set of generators F2F_2, F3F_3, F4F_4 with their derivative rules, each obtained from F1F_1 by a Legendre step that swaps one natural variable for its conjugate, and the observation that the time rule K=H+∂F/∂tK=H+\partial F/\partial t survives every step. The strategy: add or subtract the appropriate conjugate product, recompute the differential, and read off the new natural variables. Watch how each added product term kills one differential and births its partner — the same cancellation that powered the Lagrangian-to-Hamiltonian passage.

Step 1. To trade QQ for PP, define F2=F1+QPF_2=F_1+QP. Then, using (2),

dF2=dF1+P dQ+Q dP=p dq+Q dP+(K−H) dt\mathrm{d}F_2=\mathrm{d}F_1+P\,\mathrm{d}Q+Q\,\mathrm{d}P=p\,\mathrm{d}q+Q\,\mathrm{d}P+(K-H)\,\mathrm{d}t

The −P dQ-P\,\mathrm{d}Q from dF1\mathrm{d}F_1 is annihilated by the +P dQ+P\,\mathrm{d}Q of the product rule, and a +Q dP+Q\,\mathrm{d}P appears in its place: the natural variables are now (q,P,t)(q,P,t), and coefficient matching gives p=∂F2/∂qp=\partial F_2/\partial q, Q=+∂F2/∂PQ=+\partial F_2/\partial P. Why +QP+QP and not −QP-QP: the term to cancel is −P dQ-P\,\mathrm{d}Q, so the product added must carry +P dQ+P\,\mathrm{d}Q. The sign conventions of the table are forced, not chosen.

Step 2. To trade qq for pp, define F3=F1−qpF_3=F_1-qp. Now the product rule removes p dqp\,\mathrm{d}q:

dF3=dF1−p dq−q dp=−q dp−P dQ+(K−H) dt\mathrm{d}F_3=\mathrm{d}F_1-p\,\mathrm{d}q-q\,\mathrm{d}p=-q\,\mathrm{d}p-P\,\mathrm{d}Q+(K-H)\,\mathrm{d}t

Natural variables (p,Q,t)(p,Q,t); matching gives q=−∂F3/∂pq=-\partial F_3/\partial p and P=−∂F3/∂QP=-\partial F_3/\partial Q.

Step 3. Do both swaps: F4=F1−qp+QPF_4=F_1-qp+QP, so

dF4=−q dp+Q dP+(K−H) dt\mathrm{d}F_4=-q\,\mathrm{d}p+Q\,\mathrm{d}P+(K-H)\,\mathrm{d}t

with natural variables (p,P,t)(p,P,t) and rules q=−∂F4/∂pq=-\partial F_4/\partial p, Q=+∂F4/∂PQ=+\partial F_4/\partial P. Why no fifth type: the products added never involve tt, so no step can trade time away — and the four corners exhaust the 2×22\times2 choices of one-old-times-one-new. Pairs like (q,p)(q,p) or (Q,P)(Q,P) are excluded because two labels from the same chart cannot pin down the other chart at all.

Step 4. In every line above the term (K−H) dt(K-H)\,\mathrm{d}t passed through untouched, because each Legendre product was tt-free. Matching the dt\mathrm{d}t coefficient therefore gives, for every type,

K=H+∂F∂t(4)K=H+\frac{\partial F}{\partial t} \qquad (4)

As a consistency check: applying the ladder to the exchange F1=qQF_1=qQ gives F4=F1−qp+QP=qQ−qp+QPF_4=F_1-qp+QP=qQ-qp+QP; substituting Q=pQ=p, P=−qP=-q collapses it to F4=pPF_4=pP with rules q=−Pq=-P, Q=pQ=p — the same exchange, re-expressed in type-4 language. The ladder is self-consistent.

The results deserve their centerpiece. This table is the article — everything else is commentary:

typenatural variablesLegendre link to F1F_1derivative rulesclassic anchor
F1F_1(q,Q,t)(q,Q,t)—p=+∂F1∂qp=+\dfrac{\partial F_1}{\partial q},   P=−∂F1∂Q\;P=-\dfrac{\partial F_1}{\partial Q}F1=qQF_1=qQ: exchange Q=pQ=p, P=−qP=-q
F2F_2(q,P,t)(q,P,t)F2=F1+QPF_2=F_1+QPp=+∂F2∂qp=+\dfrac{\partial F_2}{\partial q},   Q=+∂F2∂P\;Q=+\dfrac{\partial F_2}{\partial P}F2=qPF_2=qP: the identity
F3F_3(p,Q,t)(p,Q,t)F3=F1−qpF_3=F_1-qpq=−∂F3∂pq=-\dfrac{\partial F_3}{\partial p},   P=−∂F3∂Q\;P=-\dfrac{\partial F_3}{\partial Q}F3=pQF_3=pQ: Q=−qQ=-q, P=−pP=-p
F4F_4(p,P,t)(p,P,t)F4=F1−qp+QPF_4=F_1-qp+QPq=−∂F4∂pq=-\dfrac{\partial F_4}{\partial p},   Q=+∂F4∂P\;Q=+\dfrac{\partial F_4}{\partial P}F4=pPF_4=pP: exchange Q=pQ=p, P=−qP=-q

with K=H+∂F/∂tK=H+\partial F/\partial t across all four rows. The sign pattern compresses to one sentence you can reconstruct at a blackboard: differentiating in an old variable returns its own conjugate partner with sign ++ for coordinates and −- for momenta; differentiating in a new variable returns the partner with the opposite convention (−- for QQ, ++ for PP) — and if even that is too much, remember only the single differential dF1=p dq−P dQ+(K−H) dt\mathrm{d}F_1=p\,\mathrm{d}q-P\,\mathrm{d}Q+(K-H)\,\mathrm{d}t and Legendre-shift on demand. One object, not four boxes.

Existence — which transformations admit which type

The ladder suggests the four types are interchangeable dressings of one object. Locally, where they exist, they are. But existence itself is the fine print, and it bites immediately: the most important transformation in perturbation theory — the identity — lives in only half the table.

Go deeper · Derivation C · 2 minWhy a type can fail and why the identity has no type-1 generator
Derivation CWhy a type can fail and why the identity has no type-1 generator

We are pinning down when the type-1 description exists, deriving the nonsingularity condition on the mixed second derivatives of F1F_1, and applying it to the identity and exchange maps. The strategy is to treat the generator's first relation as an implicit equation and ask when it can be solved — the inverse function theorem does the rest. This is the derivation that explains why all four types must be kept on the shelf even though any one of them, where defined, carries complete information.

Step 1. Given F1(q,Q,t)F_1(q,Q,t), the relation p=∂F1(q,Q,t)/∂qp=\partial F_1(q,Q,t)/\partial q must be solved for Q(q,p,t)Q(q,p,t) to produce an explicit map. By the inverse function theorem, local solvability requires the derivative of the right side with respect to the unknown to be nonsingular:

det⁡ ⁣(∂2F1∂qi ∂Qj)≠0(5)\det\!\left(\frac{\partial^2 F_1}{\partial q_i\,\partial Q_j}\right)\neq 0 \qquad (5)

where: the matrix is the mixed Hessian of the generator — for one degree of freedom, simply ∂2F1/∂q ∂Q≠0\partial^2F_1/\partial q\,\partial Q\neq0. The same logic applied to each corner of the square demands det⁡(∂2F2/∂q ∂P)≠0\det(\partial^2F_2/\partial q\,\partial P)\neq0, det⁡(∂2F3/∂p ∂Q)≠0\det(\partial^2F_3/\partial p\,\partial Q)\neq0, det⁡(∂2F4/∂p ∂P)≠0\det(\partial^2F_4/\partial p\,\partial P)\neq0 respectively.

Step 2. Translate the condition into a statement about the transformation rather than the generator: type 1 exists near a point exactly when (q,Q)(q,Q) are independent there — equivalently, when QQ genuinely responds to pp at fixed qq, i.e. ∂Q/∂p≠0\partial Q/\partial p\neq0. If QQ is a function of qq and tt alone, no F1F_1 can exist. Why this is the same condition: ∂Q/∂p\partial Q/\partial p is, by the implicit function theorem applied to p=∂F1/∂qp=\partial F_1/\partial q, the inverse of ∂2F1/∂q ∂Q\partial^2F_1/\partial q\,\partial Q — one vanishes exactly when the other blows up.

Step 3. Apply to the identity, Q=qQ=q, P=pP=p. Here ∂Q/∂p=0\partial Q/\partial p=0: the pair (q,Q)=(q,q)(q,Q)=(q,q) fails to coordinatize phase space, and type 1 is stillborn. The pair (q,P)=(q,p)(q,P)=(q,p) works perfectly, and indeed F2=∑iqiPiF_2=\sum_i q_iP_i generates the identity: pi=∂F2/∂qi=Pip_i=\partial F_2/\partial q_i=P_i and Qi=∂F2/∂Pi=qiQ_i=\partial F_2/\partial P_i=q_i.

Step 4. Apply to the exchange, Q=pQ=p, P=−qP=-q. Now (q,Q)=(q,p)(q,Q)=(q,p) is a perfect chart and F1=∑iqiQiF_1=\sum_i q_iQ_i delivers the map — but (q,P)=(q,−q)(q,P)=(q,-q) is degenerate, so no F2F_2 exists for the exchange. The failures are complementary: each type covers part of the space of canonical transformations, and the four together (plus mixed types for several degrees of freedom) cover it all. Why physicists keep all four rather than crowning one: perturbation theory lives near the identity (type 2 country), while quantum-mechanical momentum representations and scattering formalisms often want momenta as inputs (type 3 and 4 country). The taxonomy is a map of coverage, not a menu of equivalent flavours. *As a check: for F2=qPF_2=qP, the mixed Hessian is ∂2F2/∂q ∂P=1≠0\partial^2F_2/\partial q\,\partial P=1\neq0, consistent with the identity existing as type 2; for the exchange, attempting F2(q,P)F_2(q,P) with P=−qP=-q would require ∂2F2/∂q ∂P\partial^2F_2/\partial q\,\partial P to be singular, consistent with Step 4.*

A closing structural remark: for nn degrees of freedom you need not choose the same type for every index. A generator like F(q1,P1,p2,Q2,t)F(q_1,P_1,p_2,Q_2,t) — type 2 in the first degree of freedom, type 3 in the second — is perfectly legitimate, with each index obeying its own row of the master table. "Four types" really means four types per canonical pair; the basic quartet generates a whole lattice of mixed possibilities.

Limiting cases

CaseResultMeaning
identityF2=∑iqiPiF_2=\sum_i q_iP_i; no F1F_1 existsthe reference point of type 2; perturbation theory's home base
exchangeF1=∑iqiQiF_1=\sum_i q_iQ_i (also F4=∑ipiPiF_4=\sum_i p_iP_i); no F2F_2coordinates and momenta swap roles up to a sign — phase space has no preferred axes
point transformationF2=∑ifi(q,t) PiF_2=\sum_i f_i(q,t)\,P_i gives Qi=fi(q,t)Q_i=f_i(q,t), pj=∑i(∂fi/∂qj)Pip_j=\sum_i(\partial f_i/\partial q_j)P_ievery Lagrangian change of coordinates lifts canonically; momenta transform contragradiently
sign-flip mapF3=∑ipiQiF_3=\sum_i p_iQ_i gives Q=−qQ=-q, P=−pP=-pthe type-3 anchor: a parity flip of phase space
time-independent generator∂F/∂t=0⇒K=H∘(old vars)\partial F/\partial t=0\Rightarrow K=H\circ(\text{old vars})the Hamiltonian's value carries over; only labels change
time-dependent generatorK=H+∂F/∂t≠HK=H+\partial F/\partial t\neq Hmoving-frame and perturbative transformations shift the energy bookkeeping
near-identityF2=∑iqiPi+ϵ G(q,P,t)F_2=\sum_i q_iP_i+\epsilon\,G(q,P,t)generates the infinitesimal canonical transformations that open the Poisson-bracket chapters

Worked examples

1 · Lifting a point transformation with a type-2 generator (confidence builder)

Take the coordinate stretch Q=q2Q=q^2 on the half-line q>0q>0 (a 1-dof point transformation). Build its type-2 generator, then verify every derivative rule and canonicity numerically at the phase-space point q=0.50 mq=0.50\ \mathrm{m}, p=2.0 kg m/sp=2.0\ \mathrm{kg\,m/s}.

Step 1. The point-transformation recipe from the limiting-cases table: F2=f(q) PF_2=f(q)\,P with f(q)=q2f(q)=q^2, so F2(q,P)=q2PF_2(q,P)=q^2P. The mixed Hessian is ∂2F2/∂q ∂P=2q=1.0≠0\partial^2F_2/\partial q\,\partial P=2q=1.0\neq0 at our point — type 2 exists here.

Step 2. Read off the map. Q=∂F2/∂P=q2=(0.50)2=0.25 m2Q=\partial F_2/\partial P=q^2=(0.50)^2=0.25\ \mathrm{m^2}, and p=∂F2/∂q=2qPp=\partial F_2/\partial q=2qP, which inverts to P=p/(2q)=2.0/(2×0.50)=2.0 kg m/s / mP=p/(2q)=2.0/(2\times0.50)=2.0\ \mathrm{kg\,m/s\,\big/\,m}. Note the new momentum carries different units — canonical conjugacy cares only that the product QPQP has the dimensions of action: QP=0.25×2.0=0.50 J sQP=0.25\times2.0=0.50\ \mathrm{J\,s}, matching qp=0.50×2.0=1.0 J sqp=0.50\times2.0=1.0\ \mathrm{J\,s} in order of magnitude, as bookkeeping (not equality) requires.

Step 3. Verify the first rule numerically: 2qP=2×0.50×2.0=2.0 kg m/s=p2qP=2\times0.50\times2.0=2.0\ \mathrm{kg\,m/s}=p ✓.

Step 4. Verify canonicity through the fundamental bracket, computed in the old variables. With Q=q2Q=q^2 and P=p/(2q)P=p/(2q): ∂Q/∂q=2q=1.0\partial Q/\partial q=2q=1.0, ∂P/∂p=1/(2q)=1.0\partial P/\partial p=1/(2q)=1.0, ∂Q/∂p=0\partial Q/\partial p=0, ∂P/∂q=−p/(2q2)=−4.0\partial P/\partial q=-p/(2q^2)=-4.0. Then {Q,P}=(1.0)(1.0)−(0)(−4.0)=1\{Q,P\}=(1.0)(1.0)-(0)(-4.0)=\boxed{1} ✓ — area is preserved even though each axis individually stretched.

Step 5. Check the Hamiltonian bookkeeping. For a free particle of mass m=1.0 kgm=1.0\ \mathrm{kg}, H=p2/2m=2.0 JH=p^2/2m=2.0\ \mathrm{J}. Since ∂F2/∂t=0\partial F_2/\partial t=0, we need K(Q,P)=HK(Q,P)=H: substituting p=2qP=2Q Pp=2qP=2\sqrt{Q}\,P gives K=2QP2=2×0.25×(2.0)2=2.0 JK=2QP^2=2\times0.25\times(2.0)^2=\boxed{2.0\ \mathrm{J}} ✓. Same number, new labels — exactly what a time-independent generator promises.

2 · The Galilean boost — deciding which types exist, then verifying K (exam level)

Transform to a frame moving at constant velocity vv: Q=q−vtQ=q-vt, P=p−mvP=p-mv. (a) Determine which of types 1 and 2 exist. (b) Construct a generator and choose its arbitrary time function so that a free particle's new Hamiltonian is K=P2/2mK=P^2/2m. (c) Verify everything numerically for m=2.0 kgm=2.0\ \mathrm{kg}, v=3.0 m/sv=3.0\ \mathrm{m/s} at t=1.0 st=1.0\ \mathrm{s}, q=5.0 mq=5.0\ \mathrm{m}, p=10.0 kg m/sp=10.0\ \mathrm{kg\,m/s}.

Step 1. Existence audit. ∂Q/∂p=0\partial Q/\partial p=0 — the new coordinate ignores the old momentum — so (q,Q)(q,Q) are dependent and no F1F_1 exists, exactly as for the identity (a boost is the identity at t=0t=0). The pair (q,P)(q,P): P=p−mvP=p-mv responds fully to pp at fixed qq, so type 2 is available.

Step 2. Build F2(q,P,t)F_2(q,P,t). Demand Q=∂F2/∂P=q−vtQ=\partial F_2/\partial P=q-vt, which integrates to F2=(q−vt)P+g(q,t)F_2=(q-vt)P+g(q,t). Demand p=∂F2/∂q=P+∂g/∂qp=\partial F_2/\partial q=P+\partial g/\partial q; since p=P+mvp=P+mv, we need ∂g/∂q=mv\partial g/\partial q=mv, so g=mvq+h(t)g=mvq+h(t) with hh arbitrary. Thus

F2(q,P,t)=(q−vt) P+mvq+h(t)F_2(q,P,t)=(q-vt)\,P+mvq+h(t)

Step 3. Fix hh by the Hamiltonian condition. K=H+∂F2/∂t=H−vP+h′(t)K=H+\partial F_2/\partial t=H-vP+h'(t). For the free particle, express HH in new variables: H=p2/2m=(P+mv)2/2m=P2/2m+vP+12mv2H=p^2/2m=(P+mv)^2/2m=P^2/2m+vP+\tfrac12mv^2. Then K=P2/2m+12mv2+h′(t)K=P^2/2m+\tfrac12mv^2+h'(t), and the choice h(t)=−12mv2th(t)=-\tfrac12mv^2t lands the clean K=P2/2mK=P^2/2m. The boost's famous "extra 12mv2\tfrac12mv^2" is a generator's time function — pure gauge in the bookkeeping.

Step 4. Numbers. Q=5.0−3.0×1.0=2.0 mQ=5.0-3.0\times1.0=2.0\ \mathrm{m}; P=10.0−2.0×3.0=4.0 kg m/sP=10.0-2.0\times3.0=4.0\ \mathrm{kg\,m/s}. Old energy: H=(10.0)2/(2×2.0)=25.0 JH=(10.0)^2/(2\times2.0)=25.0\ \mathrm{J}. Generator's clock term: ∂F2/∂t=−vP+h′=−3.0×4.0−12×2.0×(3.0)2=−12.0−9.0=−21.0 J\partial F_2/\partial t=-vP+h'=-3.0\times4.0-\tfrac12\times2.0\times(3.0)^2=-12.0-9.0=-21.0\ \mathrm{J}.

Step 5. Verify both routes to KK. Route one, the type-2 rule: K=H+∂F2/∂t=25.0−21.0=4.0 JK=H+\partial F_2/\partial t=25.0-21.0=\boxed{4.0\ \mathrm{J}}. Route two, the target form: K=P2/2m=(4.0)2/(2×2.0)=16.0/4.0=4.0 JK=P^2/2m=(4.0)^2/(2\times2.0)=16.0/4.0=\boxed{4.0\ \mathrm{J}} ✓. The two computations meet, the moving-frame kinetic energy is honest, and every step traced back to one scalar function and the master table.

Origins · 1 minWilliam Rowan Hamilton and how this was discovered
WR
William Rowan Hamilton
1805–1865 · Dublin, Trinity College

Hamilton found the germ of generating functions not in mechanics but in optics. His Theory of Systems of Rays (1828) showed that an entire optical instrument — every lens, mirror, and path through it — is encoded in a single "characteristic function" whose partial derivatives at the endpoints deliver the ray directions: one scalar generating a whole family of input–output maps. When he turned to dynamics in 1834–35, he carried the idea across wholesale: the motion of a mechanical system is itself a canonical transformation, generated by what we now call Hamilton's principal function. Contemporaries found the papers forbidding — Jacobi had to re-engineer them into usable algorithms — but the architecture stuck: the modern F1F_1 through F4F_4, the master table, and Hamilton–Jacobi theory are all footnotes to the observation that maps this rigid can be stored in one function. Hamilton spent his late years on quaternions, convinced they were his great legacy; posterity voted for the characteristic function.

History
1788
— Lagrange's Mécanique analytique systematizes analytical mechanics, the raw material for phase-space methods
1828
— Hamilton's Theory of Systems of Rays: one characteristic function encodes an optical instrument's entire ray map
1834
— Hamilton's two dynamics essays transplant the characteristic function into mechanics
1837
— Jacobi reworks Hamilton's formalism into transformation theory; his Vorlesungen über Dynamik (published 1866) fix the generating-function toolkit
1890
— Poincaré's Méthodes nouvelles builds celestial perturbation theory on near-identity canonical transformations
1990
— Channell and Scovel construct symplectic integrators directly from generating functions, closing the loop from formalism to computation

Going further

References. Goldstein, Poole & Safko, Classical Mechanics, 3rd ed., §9.1–9.2 · Landau & Lifshitz, Mechanics, 3rd ed., §45 · Arnold, Mathematical Methods of Classical Mechanics, §48 · Sussman & Wisdom, Structure and Interpretation of Classical Mechanics, Ch. 5 The harmonic-oscillator type-1 generator F1=12ωq2cot⁡QF_1=\tfrac{1}{2}\omega q^2\cot Q yields K=ωPK=\omega P and Q˙=ω\dot{Q}=\omega, with the inversion q=2P/ωsin⁡Qq=\sqrt{2P/\omega}\sin Q confirming H=ωPH=\omega P identically. The Legendre relations F2=F1+QPF_2=F_1+QP etc. and the universal K=H+∂F/∂tK=H+\partial F/\partial t hold throughout. The numerical results on this page — stretch map: {Q,P}=1\{Q,P\}=1, K=2QP2=2.0 JK=2QP^2=2.0\ \mathrm{J}; boost: Q=2.0 mQ=2.0\ \mathrm{m}, P=4.0 kg m/sP=4.0\ \mathrm{kg\,m/s}, K=4.0 JK=4.0\ \mathrm{J} by both routes — follow directly from the boxed formulas.

Builds on: Definition of Canonical Transformations · Symplectic Condition · Fundamental Poisson Brackets Leads to: Type-1 Generating Function F1(q,Q,t) · Type-2 Generating Function F2(q,P,t) · Type-3 and Type-4 Generating Functions · Poisson Brackets as a Test for Canonicity

Why must the generating function mix old and new variables — why can't F(q,p) work?

Because a function of the old chart alone knows nothing about where points go. The generator's job is to couple the two descriptions: its derivative in the old variable must produce old-chart data (pp), and its derivative in the new variable must produce new-chart data (PP or QQ). A function F(q,p)F(q,p) has no new-variable slot to differentiate, so it can constrain nothing about (Q,P)(Q,P). Formally, the boundary identity (2) writes dF\mathrm{d}F in terms of dq\mathrm{d}q and dQ\mathrm{d}Q — one differential from each side of the border. That mixed dependence is not a convention; it is the mechanism.

Is there a way to remember the signs without memorizing four boxes?

Remember one line, not four: dF1=p dq−P dQ+(K−H) dt\mathrm{d}F_1=p\,\mathrm{d}q-P\,\mathrm{d}Q+(K-H)\,\mathrm{d}t. Every other row of the master table is a Legendre step away — add +QP+QP to swap −P dQ-P\,\mathrm{d}Q for +Q dP+Q\,\mathrm{d}P, subtract qpqp to swap +p dq+p\,\mathrm{d}q for −q dp-q\,\mathrm{d}p — and the signs update themselves through the product rule. If you prefer a slogan: old coordinates differentiate to ++momenta, old momenta to −-coordinates; on the new side both signs flip (QQ gives −P-P, PP gives +Q+Q). But the differential is safer than the slogan under exam pressure, because you can rebuild it from Hamilton's principle in two lines.

Are there really only four types?

Four per canonical pair. The count 2×22\times2 comes from choosing one variable from the old pair and one from the new pair for a single degree of freedom. With nn degrees of freedom you may mix: a generator F(q1,P1,p2,Q2,t)F(q_1,P_1,p_2,Q_2,t) is type 2 in the first index and type 3 in the second, and each index obeys its own row of the table. What you cannot do is use two variables from the same side — F(q,p)F(q,p) or F(Q,P)F(Q,P) — because they fail to couple the charts (see the first FAQ). So the honest count is: four basic types, 4n4^n mixed combinations, one underlying object.

What does it mean physically when the mixed Hessian vanishes and a type fails?

It means the two variables you asked the generator to treat as independent knobs have become locked together by the transformation itself. For the identity, Q=qQ=q: specifying qq and QQ is specifying one number twice, so no function of (q,Q)(q,Q) can encode where the momentum goes — information is missing, not merely awkward. The vanishing of ∂2F/∂(old) ∂(new)\partial^2F/\partial(\text{old})\,\partial(\text{new}) is the algebraic shadow of that lock-up: the first derivative relation can no longer be inverted to extract the map. Nothing is wrong with the transformation — it is perfectly canonical — you have simply pointed the wrong type at it. Slide along the Legendre square until the variable pair decouples.

Does the generating function itself have a physical meaning, or is it pure bookkeeping?

It can be deeply physical. The premier example: let the dynamics itself be the transformation, mapping the state at time t1t_1 to the state at time t2t_2. The type-1 generator of that map is the classical action evaluated along the actual trajectory between the two configurations — Hamilton's principal function. Its type-2 cousin, chosen to kill the new Hamiltonian entirely, is the S(q,P,t)S(q,P,t) of Hamilton–Jacobi theory, whose quantum limit is the phase of the wavefunction (ψ∼eiS/ℏ\psi\sim e^{iS/\hbar}). So the "bookkeeping device" is, in the most important cases, the action — arguably the most physical scalar in mechanics.

Why does K pick up the partial time derivative of F rather than staying equal to H?

Because a time-dependent generator moves the chart while the system evolves, and energy bookkeeping must charge for the motion of the reference frame. The term is ∂F/∂t\partial F/\partial t at fixed natural variables — the rate at which the relabelling itself shifts, not anything dynamical. The boost example makes it concrete: the moving-frame kinetic energy P2/2mP^2/2m differs from the rest-frame p2/2mp^2/2m by vP+12mv2vP+\tfrac12mv^2, and the generator's clock term −vP−12mv2-vP-\tfrac12mv^2 supplies exactly that correction. Freeze the generator (∂F/∂t=0\partial F/\partial t=0) and KK is just HH wearing new labels — the value of the Hamiltonian survives relabelling at a frozen instant.

If the identity has no F1, how does perturbation theory manage — doesn't it live right at the identity?

Precisely why perturbation theory is written in type 2. The near-identity generator F2=∑iqiPi+ϵ χ(q,P,t)F_2=\sum_i q_iP_i+\epsilon\,\chi(q,P,t) is the identity's qPqP plus a small dressing, and the master table converts it into Q=q+ϵ ∂χ/∂P+O(ϵ2)Q=q+\epsilon\,\partial\chi/\partial P+\mathcal{O}(\epsilon^2), p=P+ϵ ∂χ/∂qp=P+\epsilon\,\partial\chi/\partial q — a controlled small deformation. Had nature forced us to use F1F_1 we would be stuck: there is no "F1F_1 of the identity" to perturb around. This is the practical payoff of the existence discussion, and the reason every perturbation chapter — Poincaré's celestial mechanics, KAM theory, accelerator resonance analysis — opens with a type-2 ansatz.

Do I still need the symplectic condition if generators guarantee canonicity?

Yes, for the converse direction. A generating function manufactures canonical maps — anything it produces is certified at birth, no check needed. But if someone hands you a transformation without its pedigree — a clever substitution from a paper, a numerical map from a code — you must verify it, and that is the business of the symplectic condition and the fundamental Poisson brackets. The two formalisms are the two directions of one theorem: every generator yields a canonical map, and every canonical map admits (locally, in at least one type) a generator. Construction and verification are different jobs; keep both tools.

Before this

Where this leads