In-Depth Discussions with Logical Reasoning and Practical Applications
Hamiltonian mechanics is a reformulation of classical mechanics introduced by William Rowan Hamilton in 1833. Where Lagrangian mechanics works in configuration space with generalized coordinates qi and their velocities, the Hamiltonian picture moves to phase space, whose coordinates are the qi together with their conjugate momenta pi.
The passage from the Lagrangian L(q, q̇, t) to the Hamiltonian H(q, p, t) is a Legendre transform in the velocity variables. The second-order Euler–Lagrange equations are thereby replaced by a first-order system — Hamilton’s canonical equations — that is symmetric in coordinates and momenta and is the natural setting for conservation laws, canonical transformations, and quantization.
This whitepaper develops the Hamiltonian formalism in full, then applies the same geometric ideas to the dynamics of rigid bodies: generalized coordinates, body versus space frames, the inertia tensor, principal axes, and Euler’s equations.
Given a Lagrangian L(q, q̇, t), the conjugate momentum is
pi = ∂L / ∂q̇i
Provided this relation can be inverted for the velocities, q̇i = q̇i(q, p, t), the Hamiltonian is the Legendre transform
H(q, p, t) = Σi pi q̇i − L(q, q̇, t)
with every velocity on the right-hand side expressed in terms of q and p.
If the kinetic energy T is a homogeneous quadratic form in the velocities (the usual case for scleronomic, time-independent constraints) and the potential V depends only on the coordinates, then
H(q, p) = T(q, p) + V(q)
so H is the total mechanical energy. This identification fails when the constraints are rheonomic (explicitly time-dependent) or when the potential is velocity-dependent, as for a charged particle in an electromagnetic field:
H = (1 / 2m) |p − qA(r, t)|² + q φ(r, t)
L = ½ m q̇² − ½ k q² , p = m q̇
H(q, p) = p² / (2m) + ½ k q²
H is the sum of kinetic and potential energy. Its elliptical level curves in the (q, p) plane are the orbits of the oscillator.
Differentiating the Legendre transform and using the Euler–Lagrange equation yields the 2n first-order equations
q̇i = ∂H / ∂pi , ṗi = − ∂H / ∂qi
If a generalized force Qi not derived from a potential is present, it is added to the momentum equation: ṗi = −∂H/∂qi + Qi.
The vector field XH = (∂H/∂p, −∂H/∂q) is the Hamiltonian vector field. Trajectories never cross (uniqueness), preserve phase-space volume (Liouville), and stay on level sets of H whenever H is time-independent.
Phase space of a harmonic oscillator. Green ellipses are energy contours; the red state point travels on a single contour. Drag to rotate.
The Lagrangian already improves on Newton for constrained systems. The Hamiltonian goes further whenever one needs geometry, transformations, or a path to quantum and statistical physics.
Coordinates and momenta enter on an equal footing. Existence, uniqueness, and geometric constructions (symplectic maps, generating functions) become transparent.
A large group of transformations preserves the form of Hamilton’s equations. This is far richer than the point transformations of the Lagrangian theory.
Conserved quantities, symmetry algebras, and the correspondence principle { , } → [ , ] / iℏ all live in the Poisson bracket.
For integrable systems a canonical transformation yields cyclic coordinates whose conjugate momenta are the actions. Perturbation theory (KAM, celestial mechanics) is built on this.
Incompressibility of phase-space flow is immediate from div XH = 0, the starting point of equilibrium statistical mechanics.
The Hamiltonian is the classical counterpart of the Schrödinger operator; path integrals still start from the action, but canonical quantization starts from H and the Poisson algebra.
Schematic emphasis of each formalism across typical theoretical tasks. Neither replaces the other; they are complementary.
Along a solution of Hamilton’s equations,
dH/dt = ∂H/∂t + Σi (∂H/∂qi q̇i + ∂H/∂pi ṗi) = ∂H/∂t
The sum vanishes identically by the canonical equations. Therefore:
For an autonomous system the orbit lies on the hypersurface H(q, p) = E. In one degree of freedom this is a curve (an ellipse for the harmonic oscillator, a more complicated oval for the pendulum). In n degrees of freedom it is a (2n − 1)-dimensional manifold; integrability foliates it further into invariant tori.
Even when the potential is time-independent but the kinetic energy contains gyroscopic or rheonomic pieces, the conserved quantity may differ from the Newtonian energy. The Jacobi integral of celestial mechanics is the Hamiltonian in a rotating frame, and includes a centrifugal contribution.
Harmonic oscillator: T and V oscillate in antiphase; H = T + V is strictly constant.
The following textbook systems show how little algebra is required once H is written down.
H = p² / (2m) + ½ k q²
q̇ = p/m , ṗ = −k q
Differentiating the first and substituting the second recovers q̈ + ω² q = 0 with ω = √(k/m). The phase portrait is a nested family of ellipses.
Generalized coordinate θ (from the downward vertical), conjugate momentum pθ = m ℓ² θ̇:
H = pθ² / (2 m ℓ²) − m g ℓ cos θ
θ̇ = pθ / (m ℓ²) , ṗθ = − m g ℓ sin θ
Closed orbits (libration) exist for E < m g ℓ; circulating orbits (rotation over the top) exist for E > m g ℓ. The separatrix at E = m g ℓ is the infinite-period homoclinic trajectory through the inverted equilibrium.
Simple pendulum integrated with Hamilton’s equations. The trail traces the bob; energy is conserved to integrator accuracy.
H = pr² / (2m) + pθ² / (2m r²) + V(r)
θ is cyclic, so pθ = ℓ is constant. The radial motion is one-dimensional with effective potential Veff(r) = V(r) + ℓ² / (2m r²).
H = |p|² / (2m) ⇒ q̇ = p/m , ṗ = 0
Uniform rectilinear motion: momentum is conserved because H is independent of q.
For two phase-space functions f(q, p, t) and g(q, p, t) the Poisson bracket is
{f, g} = Σi ( ∂f/∂qi · ∂g/∂pi − ∂f/∂pi · ∂g/∂qi )
These make the smooth functions on phase space into a Lie algebra — the same abstract structure that the commutator gives to quantum observables.
{qi, qj} = 0 , {pi, pj} = 0 , {qi, pj} = δij
Any observable evolves as
df/dt = {f, H} + ∂f/∂t
In particular Hamilton’s equations themselves are q̇i = {qi, H} and ṗi = {pi, H}. A quantity with no explicit time dependence is conserved if and only if it Poisson-commutes with the Hamiltonian: {f, H} = 0.
{Li, Lj} = εijk Lk
The same structure constants appear in the quantum commutation relations of angular momentum. If H is rotationally invariant, then {Li, H} = 0 and each component of L is conserved.
A transformation (q, p) → (Q, P) is canonical if and only if it preserves Poisson brackets: {Qi, Pj}q,p = δij. Equivalently, its Jacobian is a symplectic matrix.
A coordinate change on phase space Q = Q(q, p, t), P = P(q, p, t) is canonical if it preserves the form of Hamilton’s equations: there exists a new Hamiltonian K(Q, P, t) such that
Q̇i = ∂K / ∂Pi , Ṗi = − ∂K / ∂Qi
Point transformations (changes of the q’s alone) are a small subgroup. Canonical transformations can mix coordinates and momenta, send a complicated H into a trivial K (as in the Hamilton–Jacobi method), or isolate action–angle variables for perturbation theory.
Q = p , P = −q
Coordinates and momenta trade roles (with a sign). This is canonical but is not a point transformation — a distinctly Hamiltonian phenomenon.
Every phase-space function G generates an infinitesimal canonical transformation via δq = ε {q, G}, δp = ε {p, G}. Taking G = H recovers time evolution: Hamiltonian flow is itself a continuous canonical transformation.
A canonical transformation may be encoded in a single scalar, the generating function, of one of four classical types according to which mixed pair of old and new variables is used as the independent set.
pi = ∂F1/∂qi
Pi = −∂F1/∂Qi
Useful when old and new coordinates are independent. The exchange map is generated by F1 = q Q.
pi = ∂F2/∂qi
Qi = ∂F2/∂Pi
The workhorse. The identity map is F2 = Σ qi Pi. Point transformations live here.
qi = −∂F3/∂pi
Pi = −∂F3/∂Qi
The dual of Type 1, with old momenta and new coordinates as independents.
qi = −∂F4/∂pi
Qi = ∂F4/∂Pi
Used less often; natural when both old and new momenta are convenient labels.
In every case the new Hamiltonian is
K(Q, P, t) = H(q, p, t) + ∂F / ∂t
If the generating function does not depend explicitly on time, then K is just H rewritten in the new variables.
F2 = Σ qi Pi gives p = P and Q = q — the identity. Replacing q by a function of new coordinates, F2 = Σ fi(q) Pi, generates an arbitrary point transformation together with the corresponding covariant transformation of the momenta.
The Type-1 generating function F1(q, Q) = (m ω q² / 2) cot Q sends the oscillator Hamiltonian to
K = ω P , P = E / ω
Q is then an ignorable angle advancing as Q̇ = ω, and P is the action. This is the prototype of action–angle coordinates.
A rigid body is a system of particles (or a continuum) whose mutual distances are constrained to be constant. After the holonomic rigidity constraints are imposed, a free rigid body in three-dimensional space has six degrees of freedom: three of translation of the centre of mass, and three of orientation.
The centre-of-mass coordinates (X, Y, Z) are the natural translational generalized coordinates. By König’s theorem the kinetic energy splits into centre-of-mass motion plus motion relative to the centre of mass, so the rotational problem decouples from a free translation (or from motion in a uniform gravitational field, up to the potential M g Z).
Orientation is specified by a rotation taking a space-fixed frame into a body-fixed frame. A standard 3–1–3 Euler chart uses
R = Rz(φ) Rx(θ) Rz(ψ)
The chart is singular at θ = 0, π (gimbal lock). Alternative parameterizations — unit quaternions (four coordinates, one constraint) or rotation matrices (nine coordinates, six constraints) — avoid the coordinate singularity at the cost of redundancy.
Two orthonormal frames are in play:
Axes (e1, e2, e3) fixed in an inertial laboratory. Newton’s and Euler’s laws in their Newtonian form refer to this frame. Angular momentum and energy are most simply conserved here when external torques vanish.
Axes (ê1, ê2, ê3) painted on the body. The inertia tensor is constant in this frame, which is why Euler’s equations are written there. The body frame is non-inertial: it rotates with angular velocity ω.
A vector V has two sets of components related by the instantaneous rotation matrix R(t):
Vspace = R(t) Vbody
Time derivatives in the two frames differ by the transport theorem
(dV/dt)space = (dV/dt)body + ω × V
Adding the three sequential angular velocities and projecting onto body axes yields
ω1 = θ̇ cos ψ + φ̇ sin θ sin ψ
ω2 = −θ̇ sin ψ + φ̇ sin θ cos ψ
ω3 = ψ̇ + φ̇ cos θ
Space axes (muted, fixed) versus body axes (bright, glued to the cube). Drag to inspect the two triads.
Relative to a chosen origin (almost always the centre of mass for a free body, or a fixed point for a body with a pivot), the angular momentum of a rigid body is linear in the angular velocity:
L = I ω
The linear map I is the inertia tensor, with Cartesian components
Iij = ∫ (r² δij − xi xj) dm
Diagonal entries are moments of inertia; off-diagonal entries Ixy = −∫ x y dm (and cyclic) are products of inertia. I is symmetric and positive definite, hence orthogonally diagonalizable.
Iij = (2/5) M R² δij
Every axis through the centre is a principal axis with the same moment (2/5) M R². A thin spherical shell gives (2/3) M R².
Axes through the centre and parallel to the edges are principal, with
Ixx = Iyy = Izz = (1/6) M a²
(equivalently M a² / 6 from ∫(x² + y²) dm = M(a² + a²)/12). Products of inertia vanish by cubic symmetry, and the inertia tensor about the centre is isotropic: every axis through the centre is principal with the same moment.
The symmetry axis z and any transverse CM axis are principal:
Izz = ½ M R²
Ixx = Iyy = ¼ M R² + (1/12) M h²
The second formula is the perpendicular-axis / parallel-axis combination of a disk and a line distribution along the generators.
Characteristic principal moments in units of M L², with L the natural length (R for sphere and cylinder, side a for the cube). Cylinder transverse uses h = 2R.
Because I is a real symmetric 3 × 3 matrix it possesses three orthonormal eigenvectors — the principal axes — and three real eigenvalues I1, I2, I3 — the principal moments:
I n̂α = Iα n̂α , α = 1, 2, 3
In the principal frame the inertia tensor is diagonal and
L1 = I1 ω1 , L2 = I2 ω2 , L3 = I3 ω3
The quadratic form Trot = ½ ω · I ω defines the inertia ellipsoid I1 x² + I2 y² + I3 z² = 1 in body coordinates. Poinsot’s construction: in torque-free motion the inertia ellipsoid rolls without slipping on the invariable plane orthogonal to the conserved space-frame angular momentum.
König’s theorem decomposes the kinetic energy into translational and rotational pieces about the centre of mass:
T = ½ M |Vcm|² + ½ ω · Icm ω
In a principal frame the rotational term is purely quadratic and diagonal:
Trot = ½ I1 ω1² + ½ I2 ω2² + ½ I3 ω3²
Equivalently Trot = ½ ω · L. If the body is constrained to rotate about a fixed point O (physical pendulum, top with a pivot), one uses I about O rather than about the CM and drops the separate translational term.
With no potential, L = T. Written in Euler angles the Lagrangian is a quadratic form in (φ̇, θ̇, ψ̇) with configuration-dependent coefficients. The Hamiltonian is the Legendre transform of that quadratic form; in body-frame components it is simply
H = L1² / (2 I1) + L2² / (2 I2) + L3² / (2 I3)
which is the starting point of the Euler–Poinsot rigid-body dynamics on the angular-momentum sphere.
φ and ψ are cyclic, so pφ (space-vertical angular momentum) and pψ (spin) are conserved. The nutation angle θ obeys an effective one-dimensional potential, recovering uniform precession, nutation, and the sleeping-top equilibrium.
In the body principal frame the transport theorem applied to L = I ω, together with (dL/dt)space = N (external torque), yields Euler’s equations
I1 ω̇1 − (I2 − I3) ω2 ω3 = N1
I2 ω̇2 − (I3 − I1) ω3 ω1 = N2
I3 ω̇3 − (I1 − I2) ω1 ω2 = N3
These are first-order in ω but must be supplemented by kinematic equations (Euler-angle rates, or a quaternion ODE) to reconstruct the orientation.
For N = 0 two quantities are conserved: the rotational energy T and the magnitude of angular momentum |L|. Their intersection in ω-space (or on the L-sphere) is a polhode curve. In space, L is a fixed vector (the invariable axis) and the energy ellipsoid rolls on the invariable plane (Poinsot).
Order the principal moments I1 < I2 < I3. Steady rotation about a principal axis is a solution of the torque-free Euler equations. Linearization shows:
A tennis racket (or a book, or the T-handle of the Dzhanibekov effect) flipped about its intermediate axis will reverse orientation in a spectacular π-flip — visible in the simulation below.
Asymmetric brick (I1 < I2 < I3) started near the intermediate principal axis. Cyan: conserved space-frame L. Yellow: body-frame ω. The π-flip is the tennis-racket / Dzhanibekov instability. Drag to rotate.
ω3 = const , ω1 + i ω2 ∝ ei Ω t
with Ω = (I3 − I1) ω3 / I1. The angular-velocity vector precesses uniformly about the body symmetry axis, while the body symmetry axis precesses uniformly about the fixed L in space.
Hamiltonian mechanics recasts the content of the Lagrangian theory in the symplectic geometry of phase space. The payoff is a first-order calculus in which energy generates time evolution, symmetries are Poisson-commuting conserved quantities, and a flexible group of canonical transformations — encoded in generating functions — can simplify, integrate, or quantize a system.
The development proceeded in two movements.
Taken together, the Hamiltonian and rigid-body formalisms are the working language of celestial mechanics, rigid-body attitude control, molecular spectroscopy, and the canonical route into quantum theory. Mastery of both is a practical tool and a conceptual gateway.