Interactive Lecture
Energy-based reformulations of classical dynamics — from the Euler-Lagrange equation to Hamilton's phase space
by Dr Arnaldo Delli Carri
Newtonian mechanics describes motion through forces and accelerations in Cartesian coordinates. This works well for simple systems, but becomes cumbersome when constraints are present — a bead on a wire, a rigid body, a robotic arm. Analytical mechanics reformulates the same physics using scalar energy functions, which automatically respect constraints and generalise to any choice of coordinates.
The entire dynamics of a mechanical system follow from a single scalar function — the Lagrangian \(L = T - V\) — without ever resolving constraint forces.
For a system with \(n\) degrees of freedom subject to holonomic constraints, we introduce generalised coordinates \(q_1, q_2, \ldots, q_n\) that parameterise the configuration space while automatically satisfying all constraints. The generalised coordinates need not be lengths — they may be angles, areas, or any convenient quantities.
For a double pendulum, the two joint angles \(\theta_1\) and \(\theta_2\) are natural generalised coordinates. No constraint forces (tension in the rods) ever appear in the equations of motion.
The Lagrangian is defined as the difference between kinetic and potential energy:
\[L(\mathbf{q},\dot{\mathbf{q}},t) = T - V\]
where \(T\) is the kinetic energy and \(V\) is the potential energy, both expressed in terms of generalised coordinates.
The Euler-Lagrange equations — one for each generalised coordinate — give the equations of motion:
\[\frac{d}{dt}\!\left(\frac{\partial L}{\partial \dot{q}_i}\right) - \frac{\partial L}{\partial q_i} = Q_i \qquad i = 1,\ldots,n\]
Where:
These \(n\) second-order ODEs replace Newton's equations. For a simple pendulum of length \(\ell\) and mass \(m\), choosing \(\theta\) as the generalised coordinate gives \(T = \tfrac{1}{2}m\ell^2\dot{\theta}^2\), \(V = -mg\ell\cos\theta\), and the Euler-Lagrange equation immediately yields \(\ddot{\theta} + (g/\ell)\sin\theta = 0\) — with no constraint forces needed.
The generalised momentum conjugate to \(q_i\) is:
\[p_i = \frac{\partial L}{\partial \dot{q}_i}\]
For a particle in Cartesian coordinates, \(p_i = m\dot{x}_i\) (ordinary linear momentum). For a pendulum, \(p_\theta = m\ell^2\dot{\theta}\) (angular momentum). The Hamiltonian is obtained via the Legendre transform:
\[H(\mathbf{q},\mathbf{p},t) = \sum_{i} p_i \dot{q}_i - L(\mathbf{q},\dot{\mathbf{q}},t)\]
For conservative systems with a natural (quadratic) kinetic energy: \(H = T + V\) — the total mechanical energy.
Replacing \(n\) second-order ODEs with \(2n\) first-order ODEs, Hamilton's equations describe evolution in phase space \((\mathbf{q},\mathbf{p})\):
\[\dot{q}_i = \frac{\partial H}{\partial p_i}, \qquad \dot{p}_i = -\frac{\partial H}{\partial q_i}\]
These are the equations of motion in Hamiltonian form. The flow in phase space conserves \(H\) for autonomous systems, so trajectories lie on surfaces of constant energy.
Both formulations follow from a single variational principle. The action is:
\[S = \int_{t_1}^{t_2} L\,dt\]
Hamilton's principle: the actual trajectory of a mechanical system is the one that makes the action stationary: \(\delta S = 0\). This is the deepest statement of classical mechanics, and its quantum analogue underlies Feynman's path integral formulation.
The double pendulum has two degrees of freedom \((\theta_1, \theta_2)\). Its Lagrangian yields two coupled nonlinear ODEs, integrated here with a 4th-order Runge-Kutta method. Enable the perturbed pendulum to observe sensitive dependence on initial conditions — the hallmark of deterministic chaos.
The phase portrait shows the flow in phase space \((\theta,\,\dot\theta)\) for a simple pendulum. Each curve is a trajectory of constant Hamiltonian \(H\). Closed curves represent oscillatory motion; open curves represent full rotations. The separatrix (highlighted in gold) divides these two regimes and passes through the unstable equilibria at \(\theta = \pm\pi\).
Set the initial conditions and press Add trajectory to trace a path through phase space.
| Concept | Equation | Description |
|---|---|---|
| Lagrangian | \(L = T - V\) | Kinetic minus potential energy in generalised coordinates |
| Euler-Lagrange equation | \(\dfrac{d}{dt}\!\left(\dfrac{\partial L}{\partial \dot{q}_i}\right) - \dfrac{\partial L}{\partial q_i} = Q_i\) | Equation of motion for each generalised coordinate |
| Generalised momentum | \(p_i = \dfrac{\partial L}{\partial \dot{q}_i}\) | Momentum conjugate to coordinate \(q_i\) |
| Hamiltonian (Legendre transform) | \(H = \displaystyle\sum_i p_i\dot{q}_i - L\) | Total energy in phase space variables \((q_i, p_i)\) |
| Hamilton's equations | \(\dot{q}_i = \dfrac{\partial H}{\partial p_i},\quad \dot{p}_i = -\dfrac{\partial H}{\partial q_i}\) | \(2n\) first-order ODEs governing phase-space flow |
| Hamilton's principle | \(\delta S = \delta\!\displaystyle\int_{t_1}^{t_2} L\,dt = 0\) | Physical trajectory makes the action stationary |
| Energy conservation | \(\dfrac{dH}{dt} = \dfrac{\partial H}{\partial t}\) | \(H\) is conserved for autonomous systems (\(\partial H/\partial t = 0\)) |
A simple pendulum of length \(\ell = 1.5\,\text{m}\) and mass \(m = 0.5\,\text{kg}\) swings in a vertical plane. Using the Lagrangian method with \(\theta\) as the generalised coordinate:
Show Solution
Solution:
Step 1 — Kinetic and potential energy.
The mass moves on a circular arc of radius \(\ell\), so its speed is \(v = \ell\dot{\theta}\).
\[T = \tfrac{1}{2}m\ell^2\dot{\theta}^2\]
Taking the pivot as the reference for potential energy, with \(y = -\ell\cos\theta\):
\[V = -mg\ell\cos\theta\]
Step 2 — Lagrangian.
\[L = T - V = \tfrac{1}{2}m\ell^2\dot{\theta}^2 + mg\ell\cos\theta\]
Step 3 — Euler-Lagrange equation.
\[\frac{\partial L}{\partial \dot{\theta}} = m\ell^2\dot{\theta} \implies \frac{d}{dt}\!\left(\frac{\partial L}{\partial \dot{\theta}}\right) = m\ell^2\ddot{\theta}\]
\[\frac{\partial L}{\partial \theta} = -mg\ell\sin\theta\]
Substituting into \(\dfrac{d}{dt}\!\left(\dfrac{\partial L}{\partial \dot{\theta}}\right) - \dfrac{\partial L}{\partial \theta} = 0\):
\[m\ell^2\ddot{\theta} + mg\ell\sin\theta = 0\]
\[\boxed{\ddot{\theta} + \frac{g}{\ell}\sin\theta = 0}\]
Step 4 — Small-angle linearisation.
For \(|\theta| \ll 1\), \(\sin\theta \approx \theta\):
\[\ddot{\theta} + \frac{g}{\ell}\,\theta = 0\]
This is simple harmonic motion with natural frequency \(\omega_n = \sqrt{g/\ell}\).
Step 5 — Period.
\[\omega_n = \sqrt{\frac{9.81}{1.5}} = \sqrt{6.54} = 2.557\,\text{rad/s}\]
\[T = \frac{2\pi}{\omega_n} = \frac{2\pi}{2.557} = \boxed{2.46\,\text{s}}\]
A mass \(m = 2\,\text{kg}\) is attached to a spring of stiffness \(k = 50\,\text{N/m}\) on a frictionless horizontal surface. Using \(q\) (displacement from equilibrium) as the generalised coordinate, apply the Lagrangian method to:
Show Solution
Solution:
Step 1 — Energies.
\[T = \tfrac{1}{2}m\dot{q}^2, \qquad V = \tfrac{1}{2}kq^2\]
Step 2 — Lagrangian.
\[L = T - V = \tfrac{1}{2}m\dot{q}^2 - \tfrac{1}{2}kq^2\]
Step 3 — Euler-Lagrange equation.
\[\frac{\partial L}{\partial \dot{q}} = m\dot{q} \implies \frac{d}{dt}\!\left(\frac{\partial L}{\partial \dot{q}}\right) = m\ddot{q}\]
\[\frac{\partial L}{\partial q} = -kq\]
\[m\ddot{q} - (-kq) = 0 \implies \boxed{m\ddot{q} + kq = 0}\]
Step 4 — Natural frequency.
\[\omega_n = \sqrt{\frac{k}{m}} = \sqrt{\frac{50}{2}} = \sqrt{25} = \boxed{5\,\text{rad/s}}\]
\[f_n = \frac{\omega_n}{2\pi} = \frac{5}{2\pi} = \boxed{0.796\,\text{Hz}}\]
Two masses \(m_1 = 4\,\text{kg}\) and \(m_2 = 2\,\text{kg}\) are connected by a light inextensible string over a frictionless, massless pulley. Using the displacement \(q\) of mass \(m_1\) downward as the single generalised coordinate, apply the Lagrangian to find the acceleration of the system. Take \(g = 9.81\,\text{m/s}^2\).
Show Solution
Solution:
Step 1 — Energies.
The string is inextensible, so when \(m_1\) descends by \(q\), \(m_2\) rises by \(q\). Both masses move at speed \(|\dot{q}|\).
\[T = \tfrac{1}{2}(m_1 + m_2)\dot{q}^2\]
Taking \(q = 0\) as the reference configuration:
\[V = -m_1 g q + m_2 g q = (m_2 - m_1)gq\]
Step 2 — Lagrangian.
\[L = \tfrac{1}{2}(m_1+m_2)\dot{q}^2 - (m_2-m_1)gq\]
Step 3 — Euler-Lagrange equation.
\[\frac{d}{dt}\!\left(\frac{\partial L}{\partial \dot{q}}\right) = (m_1+m_2)\ddot{q}, \qquad \frac{\partial L}{\partial q} = -(m_2-m_1)g = (m_1-m_2)g\]
\[(m_1+m_2)\ddot{q} - (m_1-m_2)g = 0\]
Step 4 — Acceleration.
\[\ddot{q} = \frac{(m_1-m_2)g}{m_1+m_2} = \frac{(4-2)\times 9.81}{4+2} = \frac{2\times 9.81}{6} = \boxed{3.27\,\text{m/s}^2}\]
Mass \(m_1\) accelerates downward at \(3.27\,\text{m/s}^2\); \(m_2\) accelerates upward at the same rate.
For a spring-mass oscillator with \(m = 1\,\text{kg}\) and \(k = 4\,\text{N/m}\), using displacement \(q\) as the generalised coordinate:
Show Solution
Solution:
Step 1 — Generalised momentum.
The Lagrangian is \(L = \tfrac{1}{2}m\dot{q}^2 - \tfrac{1}{2}kq^2\), so:
\[p = \frac{\partial L}{\partial \dot{q}} = m\dot{q} = \dot{q} \quad (\text{since } m = 1\,\text{kg})\]
Hence \(\dot{q} = p/m = p\).
Step 2 — Hamiltonian via Legendre transform.
\[H = p\dot{q} - L = p \cdot \frac{p}{m} - \left(\frac{1}{2}m\frac{p^2}{m^2} - \frac{1}{2}kq^2\right) = \frac{p^2}{m} - \frac{p^2}{2m} + \frac{1}{2}kq^2 = \frac{p^2}{2m} + \frac{1}{2}kq^2\]
Substituting \(m = 1\,\text{kg}\), \(k = 4\,\text{N/m}\):
\[\boxed{H = \frac{p^2}{2} + 2q^2}\]
This is the total mechanical energy \(T + V\), as expected for a conservative system.
Step 3 — Hamilton's equations.
\[\dot{q} = \frac{\partial H}{\partial p} = p \quad\checkmark \quad (\text{equivalent to } \dot{q} = p/m)\]
\[\dot{p} = -\frac{\partial H}{\partial q} = -4q\]
Step 4 — Verify equation of motion.
Differentiating \(\dot{q} = p\) with respect to time: \(\ddot{q} = \dot{p} = -4q\), giving:
\[\ddot{q} + 4q = 0 \implies \ddot{q} + \frac{k}{m}q = 0 \quad\checkmark\]
Natural frequency: \(\omega_n = \sqrt{k/m} = \sqrt{4} = 2\,\text{rad/s}\), period \(T = \pi \approx 3.14\,\text{s}\).