The Legendre Transform

The mathematical operation that takes us from \(L(q, \dot{q})\) to \(H(q, p)\) — replacing velocities with momenta as independent variables. The same transform connects all thermodynamic potentials.

Historical Context

Adrien-Marie Legendre introduced this transform in 1787 while studying the geometry of curves. The idea is deceptively simple: instead of describing a convex function by its values, describe it by its tangent lines. This "dual description" appeared independently in thermodynamics (Gibbs, 1870s) and in mechanics (Hamilton, 1834). The mathematical theory was placed on firm ground by Fenchel and Rockafellar in the 20th century as part of convex analysis.

In mechanics, the Legendre transform is the bridge from the Lagrangian to the Hamiltonian formulation. It replaces the velocity \(\dot{q}\) (a tangent vector) with the momentum \(p\) (a cotangent vector), revealing the natural symplectic structure of phase space.

1. The Legendre Transform: Definition

Given a function \(f(x)\) that is convex (\(f''(x) > 0\)), its Legendre transform is a new function \(g(p)\) defined by:

\[g(p) = \sup_x \left[px - f(x)\right] = p\,x(p) - f(x(p))\]

where \(x(p)\) is determined by the condition \(p = f'(x)\) (i.e., the supremum is attained where the derivative equals \(p\)). The key idea: we are switching from describing \(f\) in terms of its argument \(x\) to describing it in terms of its slope \(p = f'(x)\).

The Involution Property

The Legendre transform is its own inverse. If \(g\) is the Legendre transform of \(f\), then \(f\) is the Legendre transform of \(g\):

\[f(x) = \sup_p \left[xp - g(p)\right]\]

This is the involution (or duality) property. It means no information is lost: the Legendre transform is a bijection between convex functions and their duals.

2. Geometric Interpretation

The Legendre transform has a beautiful geometric meaning. Consider the graph of\(y = f(x)\). At each point \(x\), draw the tangent line with slope \(p = f'(x)\). This line has equation:

\[y = px - g(p)\]

where \(g(p)\) is the \(y\)-intercept of the tangent line (with a sign flip). So\(g(p)\) encodes the same curve by its family of tangent lines rather than its points. For a convex function, these two descriptions are equivalent — the curve is the envelope of its tangent lines.

Why Convexity Matters

If \(f\) is not convex, the map \(x \mapsto p = f'(x)\) is not one-to-one: different \(x\) values can give the same slope \(p\). The Legendre transform is then not invertible. Convexity ensures \(f'' > 0\), so \(f'\) is strictly monotonic, and the transform is a well-defined bijection.

3. From \(L(q, \dot{q})\) to \(H(q, p)\)

In mechanics, we apply the Legendre transform with respect to the velocity variables\(\dot{q}_i\), holding \(q_i\) and \(t\) fixed. The conjugate momentum is:

\[p_i = \frac{\partial L}{\partial \dot{q}_i}\]

The Hamiltonian is the Legendre transform of \(L\) with respect to \(\dot{q}\):

The Hamiltonian

\[H(q, p, t) = \sum_i p_i \dot{q}_i - L(q, \dot{q}, t)\]

where \(\dot{q}_i\) on the right side must be expressed in terms of \(q_i\) and\(p_i\) by inverting the relation \(p_i = \partial L/\partial \dot{q}_i\).

Convexity Condition in Mechanics

The Legendre transform is well-defined when the "Hessian matrix" is non-singular:

\[\det\left(\frac{\partial^2 L}{\partial \dot{q}_i \partial \dot{q}_j}\right) \neq 0\]

For standard mechanical systems where \(T = \frac{1}{2}\sum_{ij} M_{ij}(q)\dot{q}_i\dot{q}_j\), this Hessian is just the mass matrix \(M_{ij}\), which is positive definite. So the Legendre transform always works for conventional mechanics. It fails for some singular Lagrangians that arise in gauge theories (e.g., electrodynamics), requiring the Dirac-Bergmann constraint algorithm.

4. Worked Examples

Example 1: Free Particle

\(L = \frac{1}{2}m\dot{x}^2\)

\(p = \frac{\partial L}{\partial \dot{x}} = m\dot{x} \Rightarrow \dot{x} = p/m\)

\(H = p\dot{x} - L = p \cdot \frac{p}{m} - \frac{1}{2}m\left(\frac{p}{m}\right)^2 = \frac{p^2}{2m}\)

As expected: the Hamiltonian is the kinetic energy expressed in terms of momentum.

Example 2: Harmonic Oscillator

\(L = \frac{1}{2}m\dot{x}^2 - \frac{1}{2}kx^2\)

\(p = m\dot{x} \Rightarrow \dot{x} = p/m\)

\(H = \frac{p^2}{m} - \frac{1}{2}\frac{p^2}{m} + \frac{1}{2}kx^2 = \frac{p^2}{2m} + \frac{1}{2}kx^2\)

\(H = T + V\): the total energy, which is conserved since \(H\) has no explicit time dependence.

Example 3: Particle in Electromagnetic Field

\(L = \frac{1}{2}m|\dot{\mathbf{r}}|^2 + \frac{e}{c}\dot{\mathbf{r}} \cdot \mathbf{A} - e\phi\)

\(\mathbf{p} = m\dot{\mathbf{r}} + \frac{e}{c}\mathbf{A}\) (canonical momentum includes the vector potential!)

\(\dot{\mathbf{r}} = \frac{1}{m}\left(\mathbf{p} - \frac{e}{c}\mathbf{A}\right)\)

\(H = \frac{1}{2m}\left|\mathbf{p} - \frac{e}{c}\mathbf{A}\right|^2 + e\phi\)

The canonical momentum \(\mathbf{p}\) is not the mechanical momentum \(m\dot{\mathbf{r}}\). This distinction is crucial in quantum mechanics.

Example 4: Relativistic Particle

\(L = -mc^2\sqrt{1 - |\dot{\mathbf{r}}|^2/c^2}\)

\(\mathbf{p} = \frac{m\dot{\mathbf{r}}}{\sqrt{1 - v^2/c^2}} = \gamma m \dot{\mathbf{r}}\)

\(H = \sqrt{|\mathbf{p}|^2 c^2 + m^2 c^4}\)

The famous relativistic energy-momentum relation \(E^2 = p^2c^2 + m^2c^4\) emerges directly from the Legendre transform.

5. Thermodynamic Analogy

The Legendre transform plays exactly the same role in thermodynamics, connecting the different thermodynamic potentials. The internal energy \(U(S, V, N)\) is the fundamental potential, and all others are obtained by Legendre transforms:

Transform
Result
\(S \to T = \partial U/\partial S\)
\(F = U - TS\) (Helmholtz free energy)
\(V \to P = -\partial U/\partial V\)
\(H_{\text{th}} = U + PV\) (Enthalpy)
\(S \to T\) and \(V \to P\)
\(G = U - TS + PV\) (Gibbs free energy)

The analogy is exact:

Mechanics

\(L(q, \dot{q}) \to H(q, p)\)

\(p = \partial L / \partial \dot{q}\)

\(H = p\dot{q} - L\)

Thermodynamics

\(U(S, V) \to F(T, V)\)

\(T = \partial U / \partial S\)

\(F = U - TS\)

6. The Routhian: A Hybrid Approach

The Routhian (introduced by Edward Routh, 1877) is a partial Legendre transform: we transform only the cyclic coordinates (those that don't appear in \(L\)), leaving the others in Lagrangian form. For cyclic coordinates \(q_c\) with conjugate momenta \(p_c\):

\[R(q_{\text{nc}}, \dot{q}_{\text{nc}}, p_c) = L - \sum_{\text{cyclic}} p_c \dot{q}_c\]

The Routhian acts as a Lagrangian for the non-cyclic coordinates and as a (negative) Hamiltonian for the cyclic ones. This is especially useful for systems with symmetry, like the symmetric top or the Kepler problem.

Example: Central Force with Routhian

For the Kepler problem in polar coordinates, \(L = \frac{1}{2}m(\dot{r}^2 + r^2\dot{\theta}^2) - V(r)\). Since \(\theta\) is cyclic, \(p_\theta = mr^2\dot{\theta} = l\) (conserved).

The Routhian is:

\[R = L - p_\theta \dot{\theta} = \frac{1}{2}m\dot{r}^2 - \frac{l^2}{2mr^2} - V(r)\]

This is effectively a 1D Lagrangian for the radial motion, with \(l^2/(2mr^2)\)acting as the centrifugal barrier in the effective potential.

Python Simulation: Legendre Transform Visualization

We visualize the Legendre transform geometrically, demonstrate the involution property, compute the Hamiltonian for several systems, and show the Routhian reduction of the Kepler problem.

Legendre Transform: Geometry, Involution, and Mechanics

Python
script.py250 lines

Click Run to execute the Python code

Code will be executed with Python 3 on the server

Summary

  • The Legendre transform replaces a function's argument with its derivative as the independent variable.
  • Geometrically, it re-encodes a curve via its tangent lines instead of its points.
  • Convexity ensures the transform is well-defined and invertible (involution property).
  • In mechanics: \(H(q,p) = p\dot{q} - L(q,\dot{q})\) where \(p = \partial L / \partial \dot{q}\).
  • The thermodynamic potentials (Helmholtz, Gibbs, enthalpy) are all Legendre transforms of internal energy.
  • The Routhian is a partial Legendre transform, useful for systems with cyclic coordinates.
Rate this chapter: