To
guarantee a valid transformation between and , we may resort to a direct
generating function approach. Both sets of variables must obey
Hamilton's principle. That is the
action integral over the
Lagrangians \mathcal{L}_{qp}=\mathbf{p} \cdot \dot{\mathbf{q}} - H(\mathbf{q}, \mathbf{p}, t) and \mathcal{L}_{QP}=\mathbf{P} \cdot \dot{\mathbf{Q}} - K(\mathbf{Q}, \mathbf{P}, t), obtained from the respective Hamiltonian via an "inverse"
Legendre transformation, must be stationary in both cases (so that one can use the
Euler–Lagrange equations to arrive at Hamiltonian equations of motion of the designated form; as it is shown for example
here): \begin{align} \delta \int_{t_{1}}^{t_{2}} \left[ \mathbf{p} \cdot \dot{\mathbf{q}} - H(\mathbf{q}, \mathbf{p}, t) \right] dt &= 0 \\ \delta \int_{t_{1}}^{t_{2}} \left[ \mathbf{P} \cdot \dot{\mathbf{Q}} - K(\mathbf{Q}, \mathbf{P}, t) \right] dt &= 0 \end{align} One way for both
variational integral equalities to be satisfied is to have \lambda \left[ \mathbf{p} \cdot \dot{\mathbf{q}} - H(\mathbf{q}, \mathbf{p}, t) \right] = \mathbf{P} \cdot \dot{\mathbf{Q}} - K(\mathbf{Q}, \mathbf{P}, t) + \frac{dG}{dt} Lagrangians are not unique: one can always multiply by a constant and add a total time derivative and yield the same equations of motion (as
discussed on Wikibooks). In general, the scaling factor is set equal to one; canonical transformations for which are called
extended canonical transformations. is kept, otherwise the problem would be rendered trivial and there would be not much freedom for the new canonical variables to differ from the old ones. Here is a
generating function of one old
canonical coordinate ( or ), one new
canonical coordinate ( or ) and (possibly) the time . Thus, there are four basic types of generating functions (although mixtures of these four types can exist), depending on the choice of variables. As will be shown below, the generating function will define a transformation from old to new
canonical coordinates, and any such transformation is guaranteed to be canonical. The various generating functions and its properties tabulated below is discussed in detail:
Type 1 generating function The type 1 generating function depends only on the old and new generalized coordinates G \equiv G_{1}(\mathbf{q}, \mathbf{Q}, t). To derive the implicit transformation, we expand the defining equation above \mathbf{p} \cdot \dot{\mathbf{q}} - H(\mathbf{q}, \mathbf{p}, t) = \mathbf{P} \cdot \dot{\mathbf{Q}} - K(\mathbf{Q}, \mathbf{P}, t) + \frac{\partial G_{1}}{\partial t} + \frac{\partial G_{1}}{\partial \mathbf{q}} \cdot \dot{\mathbf{q}} + \frac{\partial G_{1}}{\partial \mathbf{Q}} \cdot \dot{\mathbf{Q}} Since the new and old coordinates are each independent, the following equations must hold \begin{align} \mathbf{p} &= \frac{\partial G_{1}}{\partial \mathbf{q}} \\ \mathbf{P} &= -\frac{\partial G_{1}}{\partial \mathbf{Q}} \\ K &= H + \frac{\partial G_{1}}{\partial t} \end{align} These equations define the transformation as follows: The
first set of equations \ \mathbf{p} = \frac{\ \partial G_{1}\ }{ \partial \mathbf{q} }\ define relations between the new
generalized coordinates and the old
canonical coordinates . Ideally, one can invert these relations to obtain formulae for each as a function of the old canonical coordinates. Substitution of these formulae for the coordinates into the
second set of equations \mathbf{P} = -\frac{\partial G_{1}}{\partial \mathbf{Q}} yields analogous formulae for the new generalized momenta in terms of the old
canonical coordinates . We then invert both sets of formulae to obtain the
old canonical coordinates as functions of the
new canonical coordinates . Substitution of the inverted formulae into the final equation K = H + \frac{\partial G_{1}}{\partial t} yields a formula for as a function of the new
canonical coordinates . In practice, this procedure is easier than it sounds, because the generating function is usually simple. For example, let G_{1} \equiv \mathbf{q} \cdot \mathbf{Q}. This results in swapping the generalized coordinates for the momenta and vice versa \begin{align} \mathbf{p} &= \frac{\partial G_{1}}{\partial \mathbf{q}} = \mathbf{Q} \\ \mathbf{P} &= -\frac{\partial G_{1}}{\partial \mathbf{Q}} = -\mathbf{q} \end{align} and . This example illustrates how independent the coordinates and momenta are in the Hamiltonian formulation; they are equivalent variables.
Type 2 generating function The type 2 generating function G_{2}(\mathbf{q}, \mathbf{P}, t) depends only on the old
generalized coordinates and the new generalized momenta G \equiv G_{2}(\mathbf{q}, \mathbf{P}, t)-\mathbf{Q} \cdot \mathbf{P} where the -\mathbf{Q} \cdot \mathbf{P} terms represent a
Legendre transformation to change the right-hand side of the equation below. To derive the implicit transformation, we expand the defining equation above \mathbf{p} \cdot \dot{\mathbf{q}} - H(\mathbf{q}, \mathbf{p}, t) = -\mathbf{Q} \cdot \dot{\mathbf{P}} - K(\mathbf{Q}, \mathbf{P}, t) + \frac{\partial G_{2}}{\partial t} + \frac{\partial G_{2}}{\partial \mathbf{q}} \cdot \dot{\mathbf{q}} + \frac{\partial G_{2}}{\partial \mathbf{P}} \cdot \dot{\mathbf{P}} Since the old coordinates and new momenta are each independent, the following equations must hold \begin{align} \mathbf{p} &= \frac{\partial G_{2}}{\partial \mathbf{q}} \\ \mathbf{Q} &= \frac{\partial G_{2}}{\partial \mathbf{P}} \\ K &= H + \frac{\partial G_{2}}{\partial t} \end{align} These equations define the transformation as follows: The
first set of equations \mathbf{p} = \frac{\partial G_{2}}{\partial \mathbf{q}} define relations between the new generalized momenta and the old
canonical coordinates . Ideally, one can invert these relations to obtain formulae for each as a function of the old canonical coordinates. Substitution of these formulae for the coordinates into the
second set of equations \mathbf{Q} = \frac{\partial G_{2}}{\partial \mathbf{P}} yields analogous formulae for the new generalized coordinates in terms of the old
canonical coordinates . We then invert both sets of formulae to obtain the
old canonical coordinates as functions of the
new canonical coordinates . Substitution of the inverted formulae into the final equation K = H + \frac{\partial G_{2}}{\partial t} yields a formula for as a function of the new
canonical coordinates . In practice, this procedure is easier than it sounds, because the generating function is usually simple. For example, let G_{2} \equiv \mathbf{g}(\mathbf{q}; t) \cdot \mathbf{P} where is a set of functions. This results in a point transformation of the generalized coordinates \mathbf{Q} = \frac{\partial G_{2}}{\partial \mathbf{P}} = \mathbf{g}(\mathbf{q}; t).
Type 3 generating function The type 3 generating function G_{3}(\mathbf{p}, \mathbf{Q}, t) depends only on the old generalized momenta and the new generalized coordinates G \equiv G_{3}(\mathbf{p}, \mathbf{Q}, t)+ \mathbf{q} \cdot \mathbf{p} where the \mathbf{q} \cdot \mathbf{p} terms represent a
Legendre transformation to change the left-hand side of the equation below. To derive the implicit transformation, we expand the defining equation above -\mathbf{q} \cdot \dot{\mathbf{p}} - H(\mathbf{q}, \mathbf{p}, t) = \mathbf{P} \cdot \dot{\mathbf{Q}} - K(\mathbf{Q}, \mathbf{P}, t) + \frac{\partial G_{3}}{\partial t} + \frac{\partial G_{3}}{\partial \mathbf{p}} \cdot \dot{\mathbf{p}} + \frac{\partial G_{3}}{\partial \mathbf{Q}} \cdot \dot{\mathbf{Q}} Since the new and old coordinates are each independent, the following equations must hold \begin{align} \mathbf{q} &= -\frac{\partial G_{3}}{\partial \mathbf{p}} \\ \mathbf{P} &= -\frac{\partial G_{3}}{\partial \mathbf{Q}} \\ K &= H + \frac{\partial G_{3}}{\partial t} \end{align} These equations define the transformation as follows: The
first set of equations \mathbf{q} = -\frac{\partial G_{3}}{\partial \mathbf{p}} define relations between the new
generalized coordinates and the old
canonical coordinates . Ideally, one can invert these relations to obtain formulae for each as a function of the old canonical coordinates. Substitution of these formulae for the coordinates into the
second set of equations \mathbf{P} = -\frac{\partial G_{3}}{\partial \mathbf{Q}} yields analogous formulae for the new generalized momenta in terms of the old
canonical coordinates . We then invert both sets of formulae to obtain the
old canonical coordinates as functions of the
new canonical coordinates . Substitution of the inverted formulae into the final equation K = H + \frac{\partial G_{3}}{\partial t} yields a formula for as a function of the new
canonical coordinates . In practice, this procedure is easier than it sounds, because the generating function is usually simple.
Type 4 generating function The type 4 generating function G_{4}(\mathbf{p}, \mathbf{P}, t) depends only on the old and new generalized momenta G \equiv G_{4}(\mathbf{p}, \mathbf{P}, t) +\mathbf{q} \cdot \mathbf{p} - \mathbf{Q} \cdot \mathbf{P} where the \mathbf{q} \cdot \mathbf{p} - \mathbf{Q} \cdot \mathbf{P} terms represent a
Legendre transformation to change both sides of the equation below. To derive the implicit transformation, we expand the defining equation above -\mathbf{q} \cdot \dot{\mathbf{p}} - H(\mathbf{q}, \mathbf{p}, t) = -\mathbf{Q} \cdot \dot{\mathbf{P}} - K(\mathbf{Q}, \mathbf{P}, t) + \frac{\partial G_{4}}{\partial t} + \frac{\partial G_{4}}{\partial \mathbf{p}} \cdot \dot{\mathbf{p}} + \frac{\partial G_{4}}{\partial \mathbf{P}} \cdot \dot{\mathbf{P}} Since the new and old coordinates are each independent, the following equations must hold \begin{align} \mathbf{q} &= -\frac{\partial G_{4}}{\partial \mathbf{p}} \\ \mathbf{Q} &= \frac{\partial G_{4}}{\partial \mathbf{P}} \\ K &= H + \frac{\partial G_{4}}{\partial t} \end{align} These equations define the transformation as follows: The
first set of equations \mathbf{q} = -\frac{\partial G_{4}}{\partial \mathbf{p}} define relations between the new generalized momenta and the old
canonical coordinates . Ideally, one can invert these relations to obtain formulae for each as a function of the old canonical coordinates. Substitution of these formulae for the coordinates into the
second set of equations \mathbf{Q} = \frac{\partial G_{4}}{\partial \mathbf{P}} yields analogous formulae for the new generalized coordinates in terms of the old
canonical coordinates . We then invert both sets of formulae to obtain the
old canonical coordinates as functions of the
new canonical coordinates . Substitution of the inverted formulae into the final equation K = H + \frac{\partial G_{4}}{\partial t} yields a formula for as a function of the new
canonical coordinates .
Limitations on the four types of generating functions Considering G_{2}(\mathbf{q}, \mathbf{P}, t) as an example, using generating function of second kind: {p}_i = \frac{\partial G_{2}}{\partial {q}_i} and {Q}_i = \frac{\partial G_{2}}{\partial {P}_i} , the first set of equations consisting of variables \mathbf{p} , \mathbf{q} and \mathbf{P} has to be inverted to get \mathbf{P}(\mathbf q, \mathbf p) . This process is possible when the matrix defined by a_{ij}=\frac{\partial {p}_i(\mathbf q,\mathbf P)}{\partial P_j} is non-singular using the
inverse function theorem, and can be restated as the following relation. \left|\begin{array}{l l l}{{\displaystyle{\frac{\partial^{2}G_{2}}{\partial P_{1}\partial q_{1}}}}}&&{{\displaystyle{\frac{\partial^{2}G_{2}}{\partial P_{1}\partial q_{n}}}}}\\ {\quad \vdots} & {\ddots}&{\quad \vdots}\\{{\displaystyle{\frac{\partial^{2}G_{2}}{\partial P_{n}\partial q_{1}}}}}&&{{\displaystyle{\frac{\partial^{2}G_{2}}{\partial P_{n}\partial q_{n}}}}}\end{array}\right|{\neq0} Hence, restrictions are placed on generating functions to have the matrices: \left[\frac{\partial^2 G_1}{\partial Q_j\partial q_i} \right] , \left[\frac{\partial^2 G_2}{\partial P_j\partial q_i} \right] , \left[\frac{\partial^2 G_3}{\partial p_j\partial Q_i} \right] and \left[\frac{\partial^2 G_4}{\partial p_j\partial P_i} \right] , being non-singular. These conditions also correspond to local invertibility of the coordinates. From these restrictions, it can be stated that type 1 and type 4 generating functions always have a non-singular \left[\frac{\partial Q_i(\mathbf q,\mathbf p)}{\partial p_j} \right] matrix whereas type 2 and type 3 generating functions always have a non-singular \left[\frac{\partial P_i(\mathbf q,\mathbf p)}{\partial p_j} \right] matrix. Hence, the canonical transformations resulting from these four generating functions alone are not completely general.
Generalized use of generating functions In other words, since and are each independent functions, it follows that to have generating function of the form G_{1}(\mathbf{q}, \mathbf{Q}, t) and G_{4}(\mathbf{p}, \mathbf{P}, t) or G_{2}(\mathbf{q}, \mathbf{P}, t) and G_{3}(\mathbf{p}, \mathbf{Q}, t), the corresponding Jacobian matrices \left[\frac{\partial Q_i}{\partial p_j} \right] and \left[\frac{\partial P_i}{\partial p_j} \right] are restricted to be non singular, ensuring that the generating function is a function of independent variables. However, as a feature of canonical transformations, it is always possible to choose such independent functions from sets or , to form a generating function representation of canonical transformations, including the time variable. Hence, it can be proven that every finite canonical transformation can be given as a closed but implicit form that is a variant of the given four simple forms. == Canonical transformation conditions ==