Short version:
I've been reading through some notes on integrable systems/Hamiltonian dynamics, and am stuck on a problem: Show that the coordinate transformation derived via the generating function method gives you a canonical transformation.
Long version:
A coordinate change $(\vec{q},\vec{p})\to (\vec{Q},\vec{P})$ is called canonical if it leaves Hamilton's equations invariant, i.e. the equations in the original coordinates $$\dot{\vec{q}}=\frac{\partial H}{\partial\vec{p}},\quad \dot{\vec{p}}=-\frac{\partial H}{\partial\vec{q}}$$ are equivalent to $$\dot{\vec{Q}}=\frac{\partial\tilde{H}}{\partial\vec{P}}, \quad \dot{\vec{P}}=-\frac{\partial\tilde{H}}{\partial\vec{Q}}$$ where $\tilde{H}(\vec{Q},\vec{P})=H(\vec{q},\vec{p})$.
The generating function method:
Suppose we have a function $S:\mathbb{R}^{2n}\to\mathbb{R}.$ Write its arguments $S(\vec{q},\vec{P})$. Now set $$\vec{p}=\frac{\partial S}{\partial \vec{q}}, \quad \vec{Q}=\frac{\partial S}{\partial \vec{P}}.$$ The first equation lets us to solve for $\vec{P}$ in terms of $\vec{q},\vec{p}$. The second equation lets us solve for $\vec{Q}$ in terms of $\vec{q},\vec{P}$, and hence in terms of $\vec{q},\vec{p}$. The new coordinates $\vec{Q}$, $\vec{P}$ we find this way will give a canonical transformation. Checking this is just a careful application of the chain rule.
My Problem:
So I decided to try and work out this 'careful application of the chain rule', i.e. prove that the transformation obtained via this generating function method is canonical. I have been unable to do so, and help with this problem would be greatly appreciated.
****my progress****
e.g. try to prove $\dot{\vec{P}}=-\frac{\partial\tilde{H}}{\partial\vec{Q}}$. Thinking of $H$ as $H(\vec{q}(\vec{Q},\vec{P}),\vec{p}(\vec{Q},\vec{P}))$, and using the chain rule, $$\frac{\partial\tilde{H}}{\partial Q_i}=\frac{\partial H}{\partial q_j}\frac{\partial q_j}{\partial Q_i}+\frac{\partial H}{\partial p_j}\frac{\partial p_j}{\partial Q_i}=-\dot{p}_j\frac{\partial q_j}{\partial Q_i}+\dot{q}_j\frac{\partial p_j}{\partial Q_i}$$ using the original Hamilton equations.
Meanwhile, $$-\dot{P}_i=-\frac{\partial P_i}{\partial q_j}\dot{q}_j-\frac{\partial P_i}{\partial p_j}\dot{p}_j,$$ so it will suffice to show $$\frac{\partial P_i}{\partial p_j}=\frac{\partial q_j}{\partial Q_i},\quad \frac{\partial P_i}{\partial q_j}=-\frac{\partial p_j}{\partial Q_i}.$$ I've been able to show $$\frac{\partial p_j}{\partial P_i}=\frac{\partial Q_i}{\partial q_j}$$ using chain rule and symmetry of partial derivatives. This then gives us the first desired equality, by inverting the Jacobian matrix: $$\left[\frac{\partial p_j}{\partial P_i}\right]^{-1} =\left[\frac{\partial Q_i}{\partial q_j}\right]^{-1} \implies \left[\frac{\partial P_i}{\partial p_j}\right] =\left[\frac{\partial q_j}{\partial Q_i}\right]$$
However, I'm not sure how to show $$\frac{\partial P_i}{\partial q_j}=-\frac{\partial p_j}{\partial Q_i}.$$