# Hamilton's canonical equations

Let

${\displaystyle g:={\begin{pmatrix}q\\p\end{pmatrix}}}$

be a vector of generalized coordinates, (${\displaystyle q}$ might itself be a vector of positions and ${\displaystyle p}$ a vector of momenta, both of them having the same size)

${\displaystyle \nabla :={\begin{pmatrix}{\partial \over \partial q}\\{\partial \over \partial p}\end{pmatrix}}}$

be a vector differential operator,

${\displaystyle 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 ${\displaystyle -I}$, where ${\displaystyle 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

${\displaystyle {\dot {g}}={\begin{pmatrix}{\dot {q}}\\{\dot {p}}\end{pmatrix}}}$

where overdot is Newton’s fluxional notation for time derivative.

${\displaystyle \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

${\displaystyle {\dot {g}}=-i\nabla H}$

To see that it is the pair of canonical equations, unpack the symbolism:

${\displaystyle {\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

${\displaystyle {\partial H \over \partial q}=-{\dot {p}}}$
${\displaystyle {\partial H \over \partial p}={\dot {q}}}$

An immediate consequence of the canonical equation is that

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

that is,

${\displaystyle {\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

${\displaystyle {\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

${\displaystyle 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

${\displaystyle {\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. (${\displaystyle kq=-F}$ follows from ${\displaystyle {\partial U \over \partial q}=-F}$ being true in general (for conservative forces), where U denotes potential energy; ${\displaystyle F={\dot {p}}}$ is Newton’s second law, and m may be assumed to be constant)

On the other hand,

${\displaystyle {\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.