Physics Classical Mechanics 100% Free Open Access
Chapter 5 • Theory & Derivations

Hamilton's Equations of Motion & Least Action

Rigorous transition from configuration space to 2n-dimensional phase space, Legendre transformation from Lagrangian to Hamiltonian, derivation of Hamilton's 2n first-order canonical equations, physical meaning of H as total energy, modified Hamilton's principle, Maupertuis' principle of least action, and Hamiltonian dynamics of electromagnetic charged particles.

§5.1 Transition from Configuration Space to Phase Space

1. Limitations of the Lagrangian Framework

In the Lagrangian formulation, a dynamical system of $n$ degrees of freedom is described in an $n$-dimensional configuration space spanned by generalized coordinates $(q_1, \dots, q_n)$. The equations of motion:
$$\frac{d}{dt}\left( \frac{\partial L}{\partial \dot{q}_j} \right) - \frac{\partial L}{\partial q_j} = 0, \quad j = 1, \dots, n$$
constitute a set of $n$ coupled second-order differential equations. Specifying a unique dynamical trajectory requires $2n$ initial boundary conditions: initial positions $q_j(0)$ and initial velocities $\dot{q}_j(0)$. However, generalized velocities $\dot{q}_j$ are not independent state variables—they are geometric tangents to the trajectory.

2. The 2n-Dimensional Phase Space

In 1835, Sir William Rowan Hamilton developed a symmetric reformulation by replacing the $n$ generalized velocities $\dot{q}_j$ with $n$ canonical conjugate momenta $p_j$:
$$p_j = \frac{\partial L}{\partial \dot{q}_j}(q, \dot{q}, t)$$
The state of the system is now mapped as a single point in a $2n$-dimensional phase space spanned by $2n$ independent coordinates:
$$(q_1, \dots, q_n; p_1, \dots, p_n) \in \mathbb{R}^{2n}$$
Instead of $n$ second-order differential equations, Hamiltonian dynamics governs motion through a system of $2n$ first-order differential equations, displaying complete mathematical symmetry between positions and momenta.

§5.2 The Legendre Transformation & Derivation of Hamilton's Equations

1. The Mathematical Legendre Transformation

Consider the total differential of the Lagrangian $L(q, \dot{q}, t)$:
$$dL = \sum_{j=1}^n \frac{\partial L}{\partial q_j} dq_j + \sum_{j=1}^n \frac{\partial L}{\partial \dot{q}_j} d\dot{q}_j + \frac{\partial L}{\partial t} dt = \sum_{j=1}^n \dot{p}_j dq_j + \sum_{j=1}^n p_j d\dot{q}_j + \frac{\partial L}{\partial t} dt$$
where we used $p_j = \frac{\partial L}{\partial \dot{q}_j}$ and Lagrange's equations $\dot{p}_j = \frac{\partial L}{\partial q_j}$. To transform the active variable from $\dot{q}_j$ to $p_j$, we perform a Legendre transformation by subtracting the differential $d\left( \sum_{j=1}^n p_j \dot{q}_j \right)$:
$$d\left( \sum_{j=1}^n p_j \dot{q}_j - L \right) = \sum_{j=1}^n \dot{q}_j dp_j + \sum_{j=1}^n p_j d\dot{q}_j - dL = \sum_{j=1}^n \dot{q}_j dp_j - \sum_{j=1}^n \dot{p}_j dq_j - \frac{\partial L}{\partial t} dt$$

2. Definition of the Hamiltonian Function $H$

We define the Hamiltonian function $H(q, p, t)$ by the Legendre transform:
$$H(q, p, t) = \sum_{j=1}^n p_j \dot{q}_j - L(q, \dot{q}, t)$$
where all occurrences of $\dot{q}_j$ must be inverted algebraically in terms of $q, p, t$. The exact total differential of $H(q, p, t)$ as a function of its natural canonical variables is:
$$dH = \sum_{j=1}^n \frac{\partial H}{\partial q_j} dq_j + \sum_{j=1}^n \frac{\partial H}{\partial p_j} dp_j + \frac{\partial H}{\partial t} dt$$

3. Hamilton's Canonical Equations of Motion

Equating coefficients of the independent differentials $dq_j, dp_j, dt$:
$$\dot{q}_j = \frac{\partial H}{\partial p_j}, \quad \dot{p}_j = -\frac{\partial H}{\partial q_j}, \quad j = 1, 2, \dots, n$$
together with the partial time derivative identity:
$$\frac{\partial H}{\partial t} = -\frac{\partial L}{\partial t}$$

These $2n$ coupled equations are known as Hamilton's Canonical Equations of Motion.

§5.3 Physical Meaning of the Hamiltonian & Energy Conservation

1. Total Time Derivative of the Hamiltonian

Differentiating $H(q(t), p(t), t)$ along a physical dynamical trajectory:
$$\frac{dH}{dt} = \sum_{j=1}^n \left( \frac{\partial H}{\partial q_j} \dot{q}_j + \frac{\partial H}{\partial p_j} \dot{p}_j \right) + \frac{\partial H}{\partial t}$$
Substituting Hamilton's canonical equations:
$$\frac{dH}{dt} = \sum_{j=1}^n \left( -\dot{p}_j \dot{q}_j + \dot{q}_j \dot{p}_j \right) + \frac{\partial H}{\partial t} = \frac{\partial H}{\partial t} = -\frac{\partial L}{\partial t}$$

Conservation Theorem: If the Hamiltonian does not depend explicitly on time ($\frac{\partial H}{\partial t} = 0$), then the Hamiltonian is a strict constant of motion: $H(q, p) = E = \text{constant}$.

2. Condition Under Which $H$ Equals Total Mechanical Energy ($H = T + V$)

Recall Euler's theorem for homogeneous functions. The kinetic energy $T$ is generally expressed as:
$$T = T_2 + T_1 + T_0$$
where $T_2 = \frac{1}{2} \sum_{j,k} m_{jk}(q) \dot{q}_j \dot{q}_k$ (quadratic in velocities), $T_1 = \sum_j a_j(q) \dot{q}_j$ (linear), and $T_0$ is independent of $\dot{q}$. The canonical momenta are $p_j = \frac{\partial T_2}{\partial \dot{q}_j} + a_j$. Then:
$$\sum_{j=1}^n p_j \dot{q}_j = 2 T_2 + T_1$$
The Hamiltonian is:
$$H = \sum_{j=1}^n p_j \dot{q}_j - (T - V) = (2T_2 + T_1) - (T_2 + T_1 + T_0 - V) = T_2 - T_0 + V$$
Therefore, $H = T + V = E$ if and only if two conditions are met simultaneously:
  1. The transformation equations $\vec{r}_i = \vec{r}_i(q)$ are scleronomic (no explicit time dependence $\frac{\partial \vec{r}_i}{\partial t} = 0$), which makes $T_1 = 0$ and $T_0 = 0$.
  2. The potential energy $V = V(q)$ is independent of velocities $\dot{q}$.

§5.4 Variational Principles: Modified Hamilton's Principle & Least Action

1. Modified Hamilton's Principle in Phase Space

In configuration space, Hamilton's principle varies coordinates $q_j(t)$ with $\delta q_j(t_1) = \delta q_j(t_2) = 0$. In phase space, both $q_j(t)$ and $p_j(t)$ are treated as $2n$ independent path variables. Substituting $L = \sum p_j \dot{q}_j - H(q, p, t)$:
$$\delta \int_{t_1}^{t_2} \left( \sum_{j=1}^n p_j \dot{q}_j - H(q, p, t) \right) dt = 0$$
Carrying out independent variations $\delta q_j$ and $\delta p_j$:
$$\int_{t_1}^{t_2} \sum_{j=1}^n \left[ \delta p_j \dot{q}_j + p_j \frac{d}{dt}(\delta q_j) - \frac{\partial H}{\partial q_j} \delta q_j - \frac{\partial H}{\partial p_j} \delta p_j \right] dt = 0$$
Integrating $p_j \frac{d}{dt}(\delta q_j)$ by parts with fixed coordinate endpoints $\delta q_j(t_1) = \delta q_j(t_2) = 0$ (note that endpoint variations $\delta p_j$ are unconstrained):
$$\int_{t_1}^{t_2} \sum_{j=1}^n \left[ \left( \dot{q}_j - \frac{\partial H}{\partial p_j} \right) \delta p_j - \left( \dot{p}_j + \frac{\partial H}{\partial q_j} \right) \delta q_j \right] dt = 0$$
Because $\delta q_j$ and $\delta p_j$ are completely independent, their coefficients must vanish individually, reproducing Hamilton's equations.

2. Maupertuis' Principle of Least Action

For conservative systems ($H = E = \text{const}$), Pierre Louis Maupertuis (1744) formulated an abbreviated variational principle where time is not held fixed at endpoints ($\Delta t \neq 0$). The abbreviated action $S_0$ is defined as:
$$S_0 = \int_{q^{(1)}}^{q^{(2)}} \sum_{j=1}^n p_j dq_j = \int_{t_1}^{t_2} 2 T dt$$

Maupertuis' Principle: For physical paths with constant total energy $E$, the varied path renders the abbreviated action stationary:

$$\Delta S_0 = \Delta \int \sum_{j=1}^n p_j dq_j = 0$$
For a single particle in a potential $V(\vec{r})$ with mass $m$, $p = \sqrt{2m(E - V)}$. The principle becomes:
$$\delta \int \sqrt{2m(E - V(\vec{r}))} ds = 0$$
This is Jacobi's geometric form of the Principle of Least Action, showing that dynamical trajectories in potential fields are geodesics in a curved Riemannian space with metric $g_{ij} = 2m(E - V)\delta_{ij}$, providing the classical mechanical analogue to Fermat's principle of least time in optics.

§5.5 Hamiltonian of a Charged Particle in an Electromagnetic Field

1. Construction of the Electromagnetic Hamiltonian

Recall the velocity-dependent Lagrangian of a particle with charge $q$ and mass $m$ in potentials $(\Phi, \vec{A})$:
$$L = \frac{1}{2}m \vec{v}^2 - q\Phi + q \vec{v} \cdot \vec{A}$$
The canonical momentum $\vec{p}$ conjugate to position $\vec{r}$ is:
$$\vec{p} = \frac{\partial L}{\partial \vec{v}} = m \vec{v} + q \vec{A}$$
Notice that canonical momentum $\vec{p}$ differs fundamentally from kinematic mechanical momentum $m \vec{v}$:
$$m \vec{v} = \vec{p} - q \vec{A}$$
Inverting for velocity: $\vec{v} = \frac{1}{m}(\vec{p} - q\vec{A})$. Applying the Legendre transformation:
$$H = \vec{p} \cdot \vec{v} - L = \vec{p} \cdot \vec{v} - \left( \frac{1}{2}m v^2 - q\Phi + q \vec{v} \cdot \vec{A} \right) = \vec{v} \cdot (\vec{p} - q\vec{A}) - \frac{1}{2}m v^2 + q\Phi$$
Substituting $\vec{v} = \frac{1}{m}(\vec{p} - q\vec{A})$:
$$H(\vec{r}, \vec{p}, t) = \frac{1}{2m} (\vec{p} - q\vec{A}(\vec{r}, t))^2 + q\Phi(\vec{r}, t)$$

2. Hamilton's Equations for the Charged Particle

$$\dot{\vec{r}} = \nabla_p H = \frac{1}{m}(\vec{p} - q\vec{A})$$
$$\dot{\vec{p}} = -\nabla_r H = -q \nabla \Phi + \frac{q}{m} \sum_{j=1}^3 (p_j - q A_j) \nabla A_j$$
Substituting $\vec{p} = m \dot{\vec{r}} + q \vec{A}$ recovers the complete Lorentz force law $m \ddot{\vec{r}} = q(\vec{E} + \dot{\vec{r}} \times \vec{B})$, proving exact equivalence.

Standard University Exam Solved Problems

Solved Problem Example 5.1: Phase Space Trajectory of a Relativistic 1D Harmonic Oscillator

A particle of rest mass $m$ and potential energy $V(x) = \frac{1}{2}k x^2$ moves relativistically in one dimension where relativistic Hamiltonian is $H(x, p) = \sqrt{p^2 c^2 + m^2 c^4} - m c^2 + \frac{1}{2}k x^2$. Derive Hamilton's canonical equations and find the shape of the phase space orbit for total energy $E$.

Step 1: Compute Hamilton's Canonical Equations of Motion
$$\dot{x} = \frac{\partial H}{\partial p} = \frac{p c^2}{\sqrt{p^2 c^2 + m^2 c^4}}, \quad \dot{p} = -\frac{\partial H}{\partial x} = -k x$$

Differentiating $H$ with respect to $p$ gives the relativistic velocity $v = \frac{p c^2}{E_{\text{kin}} + mc^2} = \frac{p}{\gamma m}$. The rate of change of momentum is the linear restoring force $-kx$.

Step 2: Derive the Phase Space Boundary Equation
$$\sqrt{p^2 c^2 + m^2 c^4} + \frac{1}{2}k x^2 = E + m c^2 = E_{\text{total}}$$

Since $\frac{\partial H}{\partial t} = 0$, $H(x, p) = E = \text{constant}$. Rearranging isolates the momentum $p(x)$.

Step 3: Solve for Phase Space Momentum p as a Function of x
$$p(x) = \pm \frac{1}{c} \sqrt{\left(E + m c^2 - \frac{1}{2}k x^2\right)^2 - m^2 c^4}$$

In the non-relativistic limit ($E \ll mc^2$), this reduces to the familiar ellipse $p^2/(2m) + kx^2/2 = E$. In the ultra-relativistic limit ($p c \gg mc^2$), the phase portrait deforms from an ellipse into diamond-like rounded contours.

Final Answer & Physical Insight

Equations of motion: ẋ = p c² / √(p² c² + m² c⁴), ṗ = -k x. Phase orbit: p(x) = ± (1/c) √[(E + mc² - kx²/2)² - m²c⁴].

Solved Problem Example 5.2: Hamiltonian & Cyclic Coordinates of a Spherical Pendulum

A spherical pendulum consists of a mass $m$ suspended by a rigid rod of length $l$ free to swing in any direction under gravity. Formulate the Hamiltonian $H(\theta, \phi, p_\theta, p_\phi)$ and determine the constants of motion.

Step 1: Write Lagrangian in Spherical Coordinates (θ, φ)
$$L = \frac{1}{2}m l^2 (\dot{\theta}^2 + \sin^2 \theta \dot{\phi}^2) + m g l \cos \theta$$

Here $\theta$ is the polar angle from the downward vertical and $\phi$ is the azimuthal angle. Potential energy is $V = -mgl\cos\theta$.

Step 2: Calculate Canonical Momenta and Invert for Velocities
$$p_\theta = m l^2 \dot{\theta} \implies \dot{\theta} = \frac{p_\theta}{m l^2}, \quad p_\phi = m l^2 \sin^2 \theta \dot{\phi} \implies \dot{\phi} = \frac{p_\phi}{m l^2 \sin^2 \theta}$$

Notice that $\phi$ does not appear in $L$; hence $p_\phi$ is a strict constant of motion (conserved vertical angular momentum $L_z$).

Step 3: Construct the Hamiltonian via Legendre Transform
$$H = p_\theta \dot{\theta} + p_\phi \dot{\phi} - L = \frac{p_\theta^2}{2 m l^2} + \frac{p_\phi^2}{2 m l^2 \sin^2 \theta} - m g l \cos \theta$$

Since the coordinates are scleronomic, $H = T + V = E = \text{constant}$. The effective potential for $\theta$-motion is $V_{\text{eff}}(\theta) = \frac{p_\phi^2}{2 m l^2 \sin^2 \theta} - m g l \cos \theta$.

Final Answer & Physical Insight

Hamiltonian: H = p_θ²/(2ml²) + p_φ²/(2ml² sin²θ) - mgl cos θ. Conserved quantities: H = E (total energy) and p_φ = L_z (azimuthal momentum).

Solved Problem Example 5.3: Area of Phase Space Orbit for a 1D Harmonic Oscillator (Action Variable)

For a 1D simple harmonic oscillator with mass $m$, spring constant $k = m\omega^2$, and energy $E$, calculate the enclosed phase space area $J = \oint p dq$ and show that it equals $2\pi E / \omega$.

Step 1: Write the Equation of the Phase Space Trajectory
$$H(q, p) = \frac{p^2}{2m} + \frac{1}{2}m \omega^2 q^2 = E \implies \frac{q^2}{2E / (m\omega^2)} + \frac{p^2}{2m E} = 1$$

The trajectory in $(q, p)$ phase space is an ellipse with semi-axes $q_0 = \sqrt{\frac{2E}{m\omega^2}}$ and $p_0 = \sqrt{2m E}$.

Step 2: Calculate the Enclosed Phase Area
$$J = \oint p dq = \text{Area of Ellipse} = \pi q_0 p_0 = \pi \sqrt{\frac{2E}{m\omega^2}} \sqrt{2m E} = \frac{2\pi E}{\omega}$$

Evaluating the line integral $\oint p dq$ around the closed periodic orbit yields the action variable $J = 2\pi E / \omega$.

Step 3: Relate to Period and Frequency
$$\frac{\partial H}{\partial J} = \frac{\partial E}{\partial J} = \frac{\omega}{2\pi} = \nu = \frac{1}{T_{\text{period}}}$$

The derivative of energy with respect to the action variable gives the orbital oscillation frequency $\nu$, laying the foundation for action-angle variables and Bohr-Sommerfeld quantization $J = n h$.

Final Answer & Physical Insight

Phase space area: J = ∮ p dq = 2π E / ω. The quantity J is an adiabatic invariant under slow parameter variations.