# Hamilton's canonical equations

Let

$g:={\begin{pmatrix}q\\p\end{pmatrix}}$ be a vector of generalized coordinates, ($q$ might itself be a vector of positions and $p$ a vector of momenta, both of them having the same size)

$\nabla :={\begin{pmatrix}{\partial \over \partial q}\\{\partial \over \partial p}\end{pmatrix}}$ be a vector differential operator,

$i:={\begin{pmatrix}0&-1\\1&0\end{pmatrix}}$ be a Givens rotation matrix for a counterclockwise right-angle rotation. (NB: This is a square root of $-I$ , where $I$ is the identity 2×2 matrix; this is a matric version of the imaginary unit.) Let H denote the Hamiltonian (function for total energy).

Then

${\dot {g}}={\begin{pmatrix}{\dot {q}}\\{\dot {p}}\end{pmatrix}}$ where overdot is Newton’s fluxional notation for time derivative.

$\nabla H=i{\dot {g}}$ This is a compactified form of Hamilton’s canonical equations (of motion). It could also be re-expressed (trivially) as

${\dot {g}}=-i\nabla H$ To see that it is the pair of canonical equations, unpack the symbolism:

${\begin{pmatrix}{\partial H \over \partial q}\\{\partial H \over \partial p}\end{pmatrix}}={\begin{pmatrix}0&-1\\1&0\end{pmatrix}}{\begin{pmatrix}{\dot {q}}\\{\dot {p}}\end{pmatrix}}={\begin{pmatrix}-{\dot {p}}\\{\dot {q}}\end{pmatrix}}$ thus

${\partial H \over \partial q}=-{\dot {p}}$ ${\partial H \over \partial p}={\dot {q}}$ An immediate consequence of the canonical equation is that

${\dot {g}}\cdot i{\dot {g}}=0$ ,

that is,

${\begin{pmatrix}{\dot {q}}\\{\dot {p}}\end{pmatrix}}\cdot {\begin{pmatrix}-{\dot {p}}\\{\dot {q}}\end{pmatrix}}=-{\dot {q}}{\dot {p}}+{\dot {p}}{\dot {q}}=0$ so

${\dot {g}}\cdot \nabla H=0$ This means (geometrically) that g moves perpendicularly to H’s gradient, so as to conserve H.

## a simple example

Let

$H={1 \over 2m}p^{2}+{k \over 2}q^{2}$ This corresponds to a simple harmonic oscillator, where m is mass and k is a spring constant. The first term is kinetic energy and the second term is potential energy (of displacement from the stable equilibrium).

Then

${\partial H \over \partial q}=kq=-F=-{\dot {p}}=-m{\ddot {q}}$ Note how deriving H by q returns a multiple of q; q is an “eigen-derivator” of H, as it were. ($kq=-F$ follows from ${\partial U \over \partial q}=-F$ being true in general (for conservative forces), where U denotes potential energy; $F={\dot {p}}$ is Newton’s second law, and m may be assumed to be constant)

On the other hand,

${\partial H \over \partial p}={p \over m}={m{\dot {q}} \over m}={\dot {q}}$ and note how deriving H by p returns a multiple of p, so p is also an “eigen-derivator” of H.