Solution (source code)

= Solution

Let $A=Dy(x)$ be the <Jacobian matrix> and $K(y)=H(x(y))$. The <chain rule> gives $\nabla_xH=A^T\nabla_yK$. Therefore the <Hamilton equations> transform to $\dot y=AJ A^T\nabla_yK$, with $J=\begin{pmatrix}0&-I\\I&0\end{pmatrix}$. They have the required canonical form for every <Hamiltonian> exactly when
$$
\boxed{AJA^T=J.}
$$
Necessity follows by choosing Hamiltonians whose gradients take arbitrary values at a point; sufficiency follows from the displayed transformed equation. This is the <symplectic matrix> condition for a <canonical transformation>, and it also forces $A$ to be invertible.

For the given transformation, $A=\begin{pmatrix}1&2\\-1/4&1/2\end{pmatrix}$ has <determinant> one. For any $2\times2$ matrix, $AJA^T=(\det A)J$, so the proposed transformation \b[is canonical].