# Canonical Transformations

The choice of generalized coordinates is not restricted. Every set of $s$ coordinates that fully characterizes the state of the system is sufficient. Moreover the Lagrange as well as the Hamilton function are invariant under a coordinate transformations. A general transformation has the form \begin{align} Q_i=Q_i(q,t) \end{align} and is also called point transformation. A transformation of this kind does whether change the Lagrangian nor the Hamiltonian of a system. For the Hamilton function an even larger class of transformations is allowed. The Hamilton function contains besides coordinates $q$ also the momentum $p$ as independent variable. Therefore there are $2s$ independent variables $p$ and $q$ that can be changed to new variables $P$ and $Q$ according to \begin{align} Q_i=Q_i(p,q,t) \quad P_i=P_i(p,q,t) \end{align} This expanded class of transformations is a considerable advantage of the Hamiltonian formalism.
Transformations $Q_i=Q_i(p,q,t) \quad P_i=P_i(p,q,t)$ that leave the Hamiltonian invariant are called canonical transformations and lead to new Hamilton functions $H'(P,Q)$ \begin{align} \dot{Q}_i=\frac{\partial H'}{\partial P_i} \quad \dot{P}_i=\frac{\partial H'}{\partial Q_i} \end{align} The conditions on $P_i$ and $Q_i$ in order for the transformation to be canonical are \begin{align} \{Q_i,Q_k\}_{p,q}=0 \quad \{P_i,P_k\}_{p,q}=0 \quad \{P_i,Q_k\}_{p,q}=\delta_{ik} \end{align} where $\{\}_{p,q}$ are Poisson brackets with derivatives with respect to $p$ and $q$.
The new Hamiltonian $H'$ and $H$ must both satisfy the principle of least action \begin{align} \delta \int \left( \sum_i P_i dQ_i - H' dt \right)=\delta \int \left( \sum_i p_i dq_i - H dt \right)=0 \end{align} The Lagrangian is only allowed to differ by a total time derivative of a function we call $F$, like we have shown in the article on Non-uniqueness of the Lagrange Function. \begin{align} \sum_i p_i dq_i - H dt =\sum_i P_i dQ_i - H' dt+dF \end{align} The canonical transformation is characterized by $F$, also called the generating function of the Transformation. Rearranging the equation we have \begin{align} dF=\sum_i p_i dq_i - H dt -\sum_i P_i dQ_i + H' dt\\ dF=\sum_i p_i dq_i -\sum_i P_i dQ_i + (H'-H) dt\\ \end{align} From this equation we see that \begin{align} p_i=\frac{\partial F}{\partial q_i} \quad P_i=\frac{\partial F}{\partial Q_i} \quad H'=H+\frac{\partial F}{\partial t} \end{align} For a given function $F$ these equations relate $p,q$ and the new coordinates $P,Q$ and gives the new Hamiltonian $H'$. Sometimes it's convenient to transform only a few variables e.g. too keep the $q$'s and transform to $P$'s. This is possible by corresponding Legendre Transformation \begin{align} d(F+\sum P_iQ_i)=d(\Phi)=\sum p_i dq_i -\sum Q_i dP_i + (H'-H) dt\\ \end{align} where $\Phi=F+\sum P_iQ_i$ is the new generating function. In general $\Phi$ is of the form \begin{align} \Phi = \sum_i f_i(q,t) P_i \end{align} With this definitions we get \begin{align} p_i=\frac{\partial \Phi}{\partial q_i} \quad Q_i=\frac{\partial \Phi}{\partial P_i} \quad H'=H+\frac{\partial \Phi}{\partial t} \end{align}