# Why are the integrability conditions necessary and sufficient for the existence of a canonical transformation's generating function?

Consider a canonical transformation $(p,q) \rightarrow (P,Q)$ under a generating function $F$. The condition for form invariance of Hamiltonian equations of motion looks like : $$\sum_{s}P_s\dot{Q_s} - H' = \sum_{s,r}(\frac{\partial{q_s}}{\partial{Q_r}}\dot{Q_r} + \frac{\partial{q_s}}{\partial{P_r}}\dot{P_r}) + \sum_sp_s\frac{\partial{q_s}}{\partial{t}} - H + \sum_r(\frac{\partial F}{\partial Q_r}\dot{Q_r} + \frac{\partial F}{\partial P_r}\dot{P_r}) + \frac{\partial F}{\partial t}\tag{22}$$

As quoted in "Classical Dynamics - a modern perspective, Sudarshan, Mukunda", the necessary and sufficient condition for the existence of $F$ are the following three integrability conditions (24a-c): Where do these come from and what is the missing link between these two statements?

1. Let us for later convenience introduce a collective notation $$(Z^1,\ldots,Z^{2n}) ~=~ (Q^1, \ldots, Q^n;P_1,\ldots, P_n)$$ for the new phase space variables.

2. Next note that the integrability conditions (24a-c) are Maxwell relations $$\tag{24'} \frac{\partial \Theta_I}{\partial Z^J} ~=~(I \leftrightarrow J), \qquad I,J~\in~\{1,\ldots, 2n\},$$ for some functions $\Theta_I=\Theta_I(Z,t)$, whose explicit form is given in Ref. 1.

3. Equivalently, the one-form $$\Theta~=~\sum_{I=1}^{2n} \Theta_I ~\mathrm{d}Z^I$$ is closed $$\tag{24''} \mathrm{d}\Theta~=~ 0.$$

4. Poincare Lemma then states that there exists$^1$ a function/zero-form $F=F(Z,t)$ such that $$\tag{23''}\Theta~=~\mathrm{d}F.$$

5. Equivalently, $$\tag{23'} \Theta_I~=~\frac{\partial F}{\partial Z^I}, \qquad I~\in~\{1,\ldots, 2n\},$$ which is the content of eqs. (23a-b) in Ref. 1.

6. Conversely, if $F$ exists, then $\Theta$ is closed, since $\mathrm{d}^2=0$. Hence the integrability conditions (24a-c) are necessary and sufficient$^1$ condition for the existence of $F$.

References:

1. E.C.G. Sudarshan & N. Mukunda, Classical Dynamics: A Modern Perspective, 1974; p.36.

--

$^1$ Mathematical caveat: The existence of the function $F$ is only guaranteed in a contractible region of phase space.