In 1788 Lagrange had turned Newton’s mechanics into a set of equations valid in any coordinates. Hamilton admired that book, which he called “a kind of scientific poem”. In 1834 and 1835, in the two essays On a General Method in Dynamics, he took the idea further, bringing into mechanics what he had learned from rays of light.

Position and momentum

Lagrange described a system by its positions $q$ and velocities $\dot q$. Hamilton replaced the velocity with the momentum $p$ (for a simple particle, mass times velocity, $p = m\dot q$) and put at the centre of everything a single function, the Hamiltonian $H(q, p)$, which in most cases is the total energy, kinetic plus potential:

$$H = T + V.$$

The whole motion comes out of two equations of almost perfect symmetry:

$$\frac{dq}{dt} = \frac{\partial H}{\partial p}, \qquad \frac{dp}{dt} = -\frac{\partial H}{\partial q}.$$

A spring

For a mass $m$ attached to a spring of constant $k$,

$$H = \frac{p^2}{2m} + \frac{k q^2}{2}.$$

Hamilton’s equations give

$$\frac{dq}{dt} = \frac{p}{m}, \qquad \frac{dp}{dt} = -kq.$$

The first says that momentum is mass times velocity; the second is Hooke’s law, the force of the spring. Together they give $m\ddot q = -kq$: the familiar oscillation. And since $\frac{dH}{dt} = \frac{\partial H}{\partial q}\frac{dq}{dt} + \frac{\partial H}{\partial p}\frac{dp}{dt} = \frac{\partial H}{\partial q}\frac{\partial H}{\partial p} - \frac{\partial H}{\partial p}\frac{\partial H}{\partial q} = 0$, energy is conserved automatically.

Phase space

The great advantage of Hamilton’s form is geometric. The state of the system at an instant is a point $(q, p)$, and the equations say where that point moves. Since $H$ does not change, the point always runs along the same level curve $H(q, p) = \text{constant}$. To understand every possible motion, it is enough to draw the level curves of a function of two variables.

For the pendulum, with units chosen to keep things simple, $q$ is the angle and $H = \frac{p^2}{2} - \cos q$. Change the energy and release the pendulum:

With little energy the curves are closed ovals: the pendulum swings back and forth. With a lot of energy they are open: the pendulum goes right round. Between the two lies a special curve, the separatrix, on which the pendulum takes an infinite time to reach the top.

Exercise: free fall

A stone of mass $m$ at height $q$ has $H = \frac{p^2}{2m} + mgq$. Write Hamilton’s equations and solve them for a stone dropped from rest.

$\frac{dq}{dt} = \frac{p}{m}$ and $\frac{dp}{dt} = -mg$. The second gives $p = -mgt$; the first, $\frac{dq}{dt} = -gt$, that is, $q = q_0 - \frac{g t^2}{2}$. It is Galileo’s fall.

Exercise: the pendulum's amplitude

With $H = \frac{p^2}{2} - \cos q$, what is the greatest angle $a$ of the pendulum when $H = 0$? And when $H = -\frac12$?

At the highest point of the swing the pendulum stops, $p = 0$, so $-\cos a = H$. For $H = 0$, $\cos a = 0$ and $a = 90°$. For $H = -\frac12$, $\cos a = \frac12$ and $a = 60°$. Check it in the interactive figure.

Sources: William Rowan Hamilton, “On a General Method in Dynamics”, Philosophical Transactions (1834) and “Second Essay on a General Method in Dynamics” (1835) · Thomas L. Hankins, Sir William Rowan Hamilton (1980) · Cornelius Lanczos, The Variational Principles of Mechanics (1949).


All topics on William Rowan Hamilton · ← Complex numbers as couples · Quaternions: the formula on the bridge →

Image credits.