physics2u
Tier
⌕ Search ⌘K
physics2u.com/vault/hamilton-equations-of-motion.html
Derivation

Hamilton's Canonical Equations

D-133 Home PU-201 Threads energy · force · symmetry Depends on The Legendre Transform to the Hamiltonian
Statement

Given a non-singular Lagrangian L(q, q̇, t) with conjugate momentum p = ∂L/∂q̇ and Hamiltonian H(q, p, t) = p q̇ − L obtained by Legendre transform, the dynamics of the system are governed by the pair of symmetric first-order equations q̇ = ∂H/∂p and ṗ = − ∂H/∂q, together with ∂H/∂t = − ∂L/∂t. These are Hamilton's canonical equations, equivalent to the single second-order Euler–Lagrange equation.

Why it matters

Hamilton's equations replace one second-order equation in configuration space by two first-order equations in phase space (q, p). This flattening exposes the geometric structure of mechanics: the state is a point, the motion is a flow, and the flow preserves phase-space volume (Liouville) and the symplectic two-form. It is the launching pad for canonical transformations, Hamilton–Jacobi theory, statistical mechanics, and the correspondence to quantum mechanics through [q̂, p̂] = iℏ.

The equations wear the three threads on their sleeve. The term ṗ = − ∂H/∂q is Newton's force law recast as a gradient of energy; H itself is (under standard conditions) the total energy; and any coordinate absent from H immediately yields a conserved momentum — the cleanest statement of the symmetry–conservation link.

Assumptions
The Lagrangian is non-singular:the Hessian ∂²L/∂q̇i∂q̇j is invertible, so p = ∂L/∂q̇ can be inverted to give q̇(q, p, t). If dropped, the Legendre transform is many-to-one, H is not a function of (q, p) alone, and one enters constrained (Dirac) dynamics.
All forces derive from the Lagrangian:there are no non-potential or dissipative generalized forces outside L. If dropped, Euler–Lagrange gains a source term and the clean ṗ = −∂H/∂q acquires an extra force.
Coordinates and momenta are independent phase-space variables:after the transform, q and p are treated as independent, not linked by p = m q̇. If dropped and one keeps varying , the coefficient-matching step is illegal and the symmetry between the two equations is lost.
The trajectory is a stationary point with fixed endpoints:in the variational route, δq = 0 at both ends so the boundary term from integration by parts vanishes. If dropped, a surface term [p δq] survives and the equations of motion are contaminated by boundary data.
Derivation
1
H(q, p, t) = p q̇ − L(q, q̇, t)
Definition of the Hamiltonian as the Legendre transform of L in the variable ; the momentum p = ∂L/∂q̇ is the conjugate slope. A
2
dL = (∂L/∂q) dq + (∂L/∂q̇) dq̇ + (∂L/∂t) dt
Total differential of L as a function of its three arguments; pure calculus, no dynamics yet. A
3
dL = ṗ dq + p dq̇ + (∂L/∂t) dt
Insert two on-shell facts: the momentum definition ∂L/∂q̇ = p, and the Euler–Lagrange equation ∂L/∂q = d/dt(∂L/∂q̇) = ṗ. This is the only place the physical trajectory enters. B
4
dH = q̇ dp + p dq̇ − dL
Differentiate the defining product H = p q̇ − L by the product rule. A
5
dH = q̇ dp − ṗ dq − (∂L/∂t) dt
Substitute step 3; the p dq̇ from step 4 cancels the p dq̇ hidden in dL. The velocity differential disappears — the signature of a completed Legendre transform. B
6
dH = (∂H/∂q) dq + (∂H/∂p) dp + (∂H/∂t) dt
Independently, H is a function of (q, p, t), so its total differential has exactly these three terms. A
7
q̇ = ∂H/∂p    ṗ = − ∂H/∂q    ∂H/∂t = − ∂L/∂t
Because dq, dp, dt are independent, the coefficients in steps 5 and 6 must match term by term. Reading them off gives the canonical equations. B
8
S[q, p] = ∫ (p q̇ − H(q, p, t)) dt
Independent variational route: write the action in phase-space (first-order) form and vary q(t) and p(t) as independent functions — the modified Hamilton's principle. B
9
δS = ∫ [ q̇ δp + p δq̇ − (∂H/∂q) δq − (∂H/∂p) δp ] dt
First variation, differentiating the integrand with respect to each field. B
10
∫ p δq̇ dt = [ p δq ] − ∫ ṗ δq dt = − ∫ ṗ δq dt
Integrate the p δq̇ term by parts; the endpoint term vanishes because δq = 0 at both limits. B
11
δS = ∫ [ (q̇ − ∂H/∂p) δp − (ṗ + ∂H/∂q) δq ] dt = 0
Since δq and δp are arbitrary and independent, each bracket must vanish, reproducing q̇ = ∂H/∂p and ṗ = −∂H/∂q. Two independent derivations, one answer. C
Result
q̇ = ∂H/∂p      ṗ = − ∂H/∂q

Reading. The rate of change of a coordinate is the gradient of the energy with respect to its conjugate momentum, and the rate of change of that momentum is minus the gradient of the energy with respect to the coordinate. The two equations are mirror images up to a single sign — that antisymmetric sign is the whole content of the symplectic structure. A coordinate missing from H gives ṗ = 0 (conservation); a Hamiltonian with no explicit t gives dH/dt = 0 (energy conservation).

Units check. With [H] = J = kg·m²/s² and [p] = kg·m/s: ∂H/∂p has units (kg·m²/s²)/(kg·m/s) = m/s, matching . And ∂H/∂q has units (kg·m²/s²)/m = kg·m/s² = N, matching (rate of change of momentum). Both equations are dimensionally consistent.

Limiting cases
  • Newtonian particle. For H = p²/2m + V(q): q̇ = p/m and ṗ = −V′(q). Combining, m q̈ = −V′(q) = F — Newton's second law recovered exactly.
  • Cyclic coordinate. If H does not contain a coordinate qk, then k = −∂H/∂qk = 0, so pk is conserved (e.g. angular momentum for a rotationally symmetric H).
  • Autonomous system. If ∂H/∂t = 0, then H is a constant of the motion; when H equals total energy this is energy conservation.
  • Free particle. H = p²/2m gives q̇ = p/m = const, ṗ = 0: uniform straight-line motion.
Breaks when
  • Singular (degenerate) Lagrangians. When ∂²L/∂q̇² is not invertible — gauge fields, the relativistic point particle in reparametrization-invariant form, systems with velocity constraints — the map q̇ → p cannot be inverted. H is defined only on a constraint surface and one needs Dirac's constrained Hamiltonian formalism instead.
  • Dissipative or non-potential forces. Friction, drag, or any force not obtainable from a potential (or velocity-dependent potential) is invisible to H(q, p, t). The plain canonical equations then give the wrong ; one must add explicit generalized forces or use non-Hamiltonian (e.g. bracket-with-dissipation) methods.
  • Explicitly time-varying constraints with hidden work. When the transformation to generalized coordinates is time-dependent, H may differ from the total energy, so reading H as energy fails even though the equations themselves still hold.
Failure modes
  • Dropping the minus sign on ṗ = −∂H/∂q. The asymmetric sign is the entire physics; writing ṗ = +∂H/∂q reverses the force and destroys energy conservation.
  • Leaving inside H. After the transform, H must be expressed in (q, p). Differentiating a residual as if independent gives nonsense; every velocity must first be eliminated using q̇ = q̇(q, p).
  • Confusing ∂H/∂t with dH/dt. The partial holds q, p fixed; the total follows the trajectory. They coincide numerically only because the phase-space terms cancel — a result, not a definition.
  • Assuming H = T + V always. True only for time-independent, holonomic constraints and velocity-independent potentials. Under time-dependent constraints H can be neither the energy nor T + V.
  • Treating p as m q̇ universally. Conjugate momentum equals ∂L/∂q̇; in curvilinear coordinates or with magnetic/velocity-dependent potentials it is not simply mass times velocity.
Discussion

The deep move in passing from Lagrange to Hamilton is a change of independent variables via the Legendre transform: from (q, q̇) on the tangent bundle to (q, p) on the cotangent bundle, the phase space. The transform trades a variable for its conjugate slope precisely because that slope, p, is the quantity Euler–Lagrange already singles out. The cancellation of p dq̇ in step 5 is not luck; it is the defining property that makes H depend on p rather than .

The near-symmetry between the two equations, broken only by a sign, is the fingerprint of symplectic geometry. Writing the phase-space point as ξ = (q, p), Hamilton's equations become ξ̇ = J ∇H with J the antisymmetric unit matrix. This is why any smooth H generates a flow that preserves phase-space volume: the same structure that underlies Poisson brackets, canonical transformations, and Liouville's theorem in statistical mechanics.

The force thread and the symmetry thread meet here. ṗ = −∂H/∂q says force is the negative gradient of energy in configuration; when that gradient vanishes because the coordinate is absent, force and momentum change both vanish and a conservation law appears. This is Noether's theorem in its most transparent guise: continuous symmetry of H ↔ conserved conjugate momentum, no calculus of variations of symmetry orbits required.

Quantization inherits this scaffolding directly. The Poisson bracket {q, p} = 1, itself a shadow of the symplectic form, is promoted to the commutator [q̂, p̂] = iℏ, and Hamilton's equation ξ̇ = {ξ, H} becomes the Heisenberg equation dÂ/dt = (i/ℏ)[Ĥ, Â] + ∂Â/∂t. The identical algebraic skeleton in classical and quantum mechanics is why the Hamiltonian, not the Lagrangian, is the natural object for quantization and for time evolution.

Common misconceptions. The two equations are not "Newton split in half" in a trivial way — they are genuinely more symmetric, and that symmetry is content, not cosmetics. And H being conserved (∂H/∂t = 0) is logically separate from H being the energy (a statement about the constraints); a system can conserve H while H is not the mechanical energy, or vice versa.

Worked examples

Example 1 — One-dimensional harmonic oscillator.

1
H = p²/2m + ½ k q²
Standard oscillator Hamiltonian: kinetic plus spring potential energy, expressed in (q, p). A
2
q̇ = ∂H/∂p = p/m    ṗ = −∂H/∂q = −k q
Apply the canonical equations, differentiating symbol by symbol before inserting numbers. A
3
m = 0.50 kg, k = 200 N/m, q = 0.030 m, p = 0.40 kg·m/s
Insert the state of the system at the chosen instant. A
4
q̇ = 0.40 / 0.50 = 0.80 m/s    ṗ = −200 × 0.030 = −6.0 N
Arithmetic; units carry through to velocity and force as the units check predicts. A
q̇ = 0.80 m/s,   ṗ = −6.0 N

Reading. The coordinate is increasing at 0.80 m/s while the restoring force drives the momentum down at 6.0 N. The angular frequency is ω = √(k/m) = √(200/0.50) = 20 rad/s, and the conserved energy is E = p²/2m + ½kq² = 0.16 + 0.09 = 0.25 J.

Example 2 — Planar central-force motion in polar coordinates.

1
H = pr²/2m + pθ²/(2m r²) − α/r
Hamiltonian for a particle in an attractive inverse-distance potential V = −α/r; note θ is absent (cyclic). B
2
θ̇ = ∂H/∂pθ = pθ/(m r²)    ṗθ = −∂H/∂θ = 0
Because θ does not appear in H, its conjugate momentum (angular momentum) is conserved. B
3
ṙ = ∂H/∂pr = pr/m    ṗr = −∂H/∂r = pθ²/(m r³) − α/r²
The radial pair: centrifugal term minus the true attractive force. B
4
m = 1.0 kg, r = 2.0 m, pθ = 4.0 kg·m²/s, pr = 0, α = 8.0 N·m²
A candidate circular state: no radial momentum, fixed angular momentum. A
5
θ̇ = 4.0/(1.0 × 4.0) = 1.0 rad/s    ṗr = 16/(1.0 × 8.0) − 8.0/4.0 = 2.0 − 2.0 = 0
Numbers inserted; the centrifugal and gravitational terms balance exactly. A
θ̇ = 1.0 rad/s,   ṗθ = 0,   ṗr = 0,   ṙ = 0

Reading. The cyclic coordinate θ makes angular momentum conserved, and the vanishing of r with pr = 0 means the radius neither moves nor accelerates: this is a circular orbit at r = 2.0 m traversed at 1.0 rad/s. The balance m r θ̇² = α/r² (both equal 2.0 N) is exactly the centripetal condition, recovered here with no free-body diagram — only ∂H/∂q.

Problems
  1. A free particle has H = p²/2m with m = 3.0 kg and momentum p = 12 kg·m/s. Find and , and state which quantity is conserved.
    Solution

    q̇ = ∂H/∂p = p/m = 12/3.0 = 4.0 m/s. ṗ = −∂H/∂q = 0 because q is absent from H (cyclic), so p = 12 kg·m/s is conserved. The particle drifts at constant 4.0 m/s.

  2. For a mass on a spring, H = p²/2m + ½k q² with m = 0.25 kg, k = 100 N/m, at the instant q = 0.020 m, p = 0.10 kg·m/s. Find and , then show dE/dt = 0 symbolically.
    Solution

    q̇ = p/m = 0.10/0.25 = 0.40 m/s; ṗ = −k q = −100 × 0.020 = −2.0 N. Energy rate: dE/dt = (∂H/∂q)q̇ + (∂H/∂p)ṗ = (kq)(p/m) + (p/m)(−kq) = 0. Energy is conserved for any state.

  3. A body falls under gravity with H = p²/2m + m g q (q = height), m = 1.5 kg, g = 9.8 m/s², released from rest (p = 0) at q = 20 m. Find and at release, and the acceleration .
    Solution

    q̇ = p/m = 0 at release. ṗ = −∂H/∂q = −m g = −1.5 × 9.8 = −14.7 N (momentum decreasing, i.e. downward). Acceleration q̈ = d(p/m)/dt = ṗ/m = −14.7/1.5 = −9.8 m/s², the expected free-fall value.

  4. A free particle moves in a plane, H = (px² + py²)/2m, with m = 2.0 kg, px = 6.0 kg·m/s, py = −4.0 kg·m/s. Identify the cyclic coordinates, give the two velocities, and give the two momentum rates.
    Solution

    Both x and y are absent from H, so both are cyclic: x = 0, y = 0, so px and py are conserved. Velocities: ẋ = px/m = 3.0 m/s, ẏ = py/m = −2.0 m/s. Straight-line motion at constant velocity.

  5. Using Hamilton's equations, prove the identity dH/dt = ∂H/∂t along any trajectory. Then apply it to the oscillator of Problem 2 to state the conserved energy value.
    Solution

    Total derivative: dH/dt = (∂H/∂q)q̇ + (∂H/∂p)ṗ + ∂H/∂t. Substitute Hamilton's equations q̇ = ∂H/∂p, ṗ = −∂H/∂q: the first two terms become (∂H/∂q)(∂H/∂p) + (∂H/∂p)(−∂H/∂q) = 0, leaving dH/dt = ∂H/∂t. For the oscillator, ∂H/∂t = 0, so H is conserved at E = p²/2m + ½kq² = (0.10)²/(2 × 0.25) + ½(100)(0.020)² = 0.020 + 0.020 = 0.040 J.