Solution (source code)

= Solution

With <Hamilton's equations> $\dot q_j=H_{p_j}$ and $\dot p_j=-H_{q_j}$, the chain rule gives
$$
\boxed{\frac{dF}{dt}=\sum_j(F_{q_j}H_{p_j}-F_{p_j}H_{q_j})=[F,H].}
$$
For the vortex problem, combine the two ordered terms for each unordered pair, writing $D_{ij}=(p_i-p_j)^2+(q_i-q_j)^2$ and $H=-(\kappa/2)\sum_{i<j}\log D_{ij}$. Since $F_{q_j}=2q_j$, $F_{p_j}=2p_j$, its pairwise contribution to the <Poisson bracket> is
$$
-\frac{2\kappa}{D_{ij}}
\bigl[(q_i-q_j)(p_i-p_j)-(p_i-p_j)(q_i-q_j)\bigr]=0.
$$
Every pair cancels, so $[F,H]=0$ and \b[$\sum_j(q_j^2+p_j^2)$ is conserved] along any collision-free solution. The logarithmic <Hamiltonian> is undefined at coinciding vortices, so the derivation applies on its natural domain.