JOVANA
Explore Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Hamilton's Canonical Equations

The two symmetric equations that govern every Hamiltonian system. We derive them, solve the harmonic oscillator entirely in phase space, and see how conserved momenta fall out for free.

The two equations

The Hamiltonian H(q,p,t) generates the motion through Hamilton's canonical equations. They are the beating heart of the whole formalism, and their symmetry — one equation for how position changes, a nearly mirror-image one for how momentum changes — is not an accident.

\dot q_i = \frac{\partial H}{\partial p_i}, \qquad \dot p_i = -\frac{\partial H}{\partial q_i}

Hamilton's equations: 2n first-order ODEs, one pair per degree of freedom.

Notice the crucial minus sign in the second equation — it is what makes the flow symplectic rather than a simple gradient descent, and it is the source of every conservation law we will meet. Read the pair as a rule: momentum pushes position forward; the slope of the potential (through H) pushes momentum.

Where they come from

The derivation is a one-line consistency check. Write the total differential of H = \sum p_i\dot q_i - L two ways. Treating H as a function of (q,p,t) gives dH = \sum(\partial H/\partial q_i\,dq_i + \partial H/\partial p_i\,dp_i) + \partial H/\partial t\,dt. Differentiating the definition directly, the \dot q\,dp and p\,d\dot q terms rearrange and the d\dot q pieces cancel because p_i=\partial L/\partial\dot q_i. Matching coefficients term by term, and using the Euler–Lagrange equation \dot p_i = \partial L/\partial q_i, gives exactly Hamilton's equations.

\frac{dH}{dt} = \frac{\partial H}{\partial t} = -\frac{\partial L}{\partial t}

A bonus: the total time rate of H equals its explicit time dependence only.

Worked example: the harmonic oscillator in phase space

Take the mass–spring system executing simple harmonic motion. Its kinetic energy is p^2/2m and its potential is \tfrac12 m\omega^2 q^2, so the Hamiltonian is simply their sum. Let us solve it without ever writing \ddot q.

H = \frac{p^2}{2m} + \tfrac12 m\omega^2 q^2

The oscillator Hamiltonian.

Apply the canonical equations. From \partial H/\partial p = p/m and \partial H/\partial q = m\omega^2 q we read off the two first-order equations directly:

\dot q = \frac{p}{m}, \qquad \dot p = -m\omega^2 q

Hamilton's equations for the oscillator.

Differentiate the first and substitute the second: \ddot q = \dot p/m = -\omega^2 q — the familiar SHM equation, recovered. But the phase-space view gives more. Because H=E is constant, every trajectory satisfies p^2/2m + \tfrac12 m\omega^2 q^2 = E: an ellipse. The state circulates around this ellipse forever, sweeping out a fixed area.

\frac{q^2}{\,2E/m\omega^2\,} + \frac{p^2}{2mE} = 1

Each energy is a nested ellipse in the (q,p) plane.

Explore the phase portrait interactively: the oscillator gives nested ellipses, while a pendulum adds a separatrix dividing back-and-forth swinging from full rotation. Slide the energy and watch the orbit grow.

Cyclic coordinates give conservation for free

Here is where the formalism sparkles. Suppose a coordinate q_i does not appear in H at all — it is called cyclic (or ignorable). Then \partial H/\partial q_i=0, so by Hamilton's second equation its conjugate momentum is constant. You spot a conservation law just by scanning which symbols are absent from H.

\frac{\partial H}{\partial q_i}=0 \;\Longrightarrow\; p_i = \text{const}

A cyclic coordinate implies a conserved conjugate momentum.

This is Noether's theorem wearing its simplest clothes: symmetry becomes conservation. Translational symmetry (no x in H) conserves linear momentum; rotational symmetry (no angle in H) conserves angular momentum; time-translation symmetry (no explicit t) conserves energy. Each conserved momentum lets you eliminate one degree of freedom, shrinking the problem.