Legendre Transforms
Here is a practical annoyance at the heart of thermodynamics. The fundamental relation contains everything — but its natural variables are entropy and volume, and no laboratory instrument controls entropy. Thermometers set temperature; barometers set pressure. We want to re-express the same physics in the variables we can actually hold fixed, without losing any information. The Legendre transform is precisely the mathematical operation that does this, and it is one of the most beautiful ideas a physicist meets: a way to trade a variable for its slope and lose nothing. The geometric heart is a duality. A smooth convex curve can be described two completely equivalent ways: as the set of its points , or as the envelope of its tangent lines. Each tangent has a slope and an intercept; recording that intercept as a function of the slope is the Legendre transform . Because a convex curve and its family of tangent lines carry identical information, the transform is invertible — and applying it twice returns you exactly to the original function. This involution property, , is the signature that no information was thrown away. In thermodynamics the conjugate pairs are , , and : each intensive variable is the derivative of with respect to its extensive partner. Transforming on trades entropy for temperature and produces the Helmholtz free energy ; transforming on trades volume for pressure and gives the enthalpy ; transforming on both gives the Gibbs free energy . Each new potential is minimized at equilibrium under exactly the constraints its natural variables describe — which is why free energies, not energy, govern chemistry, phase transitions, and stability. There is one crucial catch, and it is physics, not a technicality. The transform is reversible only where is strictly convex. Where has a non-convex region — as a fundamental relation does inside a coexistence region — the slope is no longer single-valued, the transform becomes ambiguous, and the correct procedure replaces the offending dip with its convex hull: a straight common-tangent chord. That chord is the Maxwell construction, and the flat piece it produces is a first-order phase transition. The Legendre transform's failure is where phase transitions live.
- The Legendre transform re-expresses the fundamental relation in experimentally natural variables (temperature, pressure) by trading each extensive variable for its conjugate slope, without losing information.
- Geometrically it swaps the point description of a convex curve for its tangent-line description (slope, intercept).
- It is an involution on convex functions: , the guarantee that the transform is reversible and complete.
- The thermodynamic potentials are Legendre transforms of : , , .
- The transform breaks down on non-convex regions — the slope goes multivalued — and the fix is the convex-hull common-tangent chord, which is a first-order phase transition (Maxwell construction).
- Key idea: a Legendre transform trades a variable for its slope, preserving all information as long as the function is convex; its breakdown on non-convex regions is where phase transitions appear.
The Legendre transform re-expresses a convex function in terms of its slopes rather than its arguments, losing no information (it is an involution, ). In thermodynamics it turns into the free energies , , in experimentally natural variables; its failure on non-convex regions produces the common-tangent construction and first-order phase transitions.
Where this lives today
The Legendre transform is far from a thermodynamic footnote — it is one of the load-bearing structures of theoretical physics and applied optimization. In classical mechanics it converts the Lagrangian into the Hamiltonian , trading velocity for momentum, which is the gateway to phase space, canonical quantization, and statistical mechanics. In convex optimization and machine learning it appears as the convex conjugate (Fenchel transform), the backbone of duality theory: every constrained optimization problem has a dual obtained by Legendre-transforming the objective, and support-vector machines, entropy-regularized methods, and optimal-transport algorithms all run on it. In condensed matter and field theory the transform relating the free energy to the effective action — trading the source field for the order parameter — is exactly the tool that turns a microscopic partition function into a Landau free energy whose non-convex regions signal symmetry breaking. The common-tangent construction this article emphasizes is used daily in materials science: phase diagrams of alloys are computed by finding common tangents to the Gibbs free-energy curves of competing phases, precisely the convex-hull procedure that repairs the Legendre transform's breakdown. Wherever a problem has a "primal" description and a "dual" one, the Legendre transform is usually the bridge.
The physical picture
Imagine a smooth, upward-curving hill . You can catalogue it by walking along and recording your height at each position — the point description . Or you can stand back and catalogue the tangent lines: for every slope, note where that tangent line would cross the axis. For a convex hill these two catalogues are perfectly interchangeable, because a convex curve is the envelope of its own tangents. The Legendre transform is just the second catalogue: records, for each slope , how far the tangent's intercept sits. The magic is that the transform undoes itself. Take the tangent-line catalogue and build its tangent-line catalogue, and you recover the original hill exactly: . Nothing was lost in translating from "where am I" to "how steep is it here."
In thermodynamics the "position" is an extensive variable and the "slope" is its conjugate intensive variable. The slope of with respect to is the temperature; with respect to it is . Trading for turns into the Helmholtz free energy — the natural potential when you control temperature, which is almost always the experimental situation. But there is a boundary to the magic, and it is exactly where the physics gets interesting. The involution works only if the curve is convex everywhere — only then is the slope a one-to-one label for position. If the fundamental relation has a non-convex dip (as it does inside a liquid–gas coexistence region), several positions share the same slope, the transform becomes ambiguous, and the correct object is the convex hull: you bridge the dip with a straight common-tangent chord. The plot below shows this — the flat chord that replaces the wiggle is a first-order phase transition, and the horizontal segment is exactly the Maxwell equal-area construction.
So the Legendre transform is not merely a change of variables. Its clean invertibility is the mathematical shadow of thermodynamic stability, and its breakdown is the mathematical fingerprint of a phase transition.
The core equations
Define the transform by the maximum-difference (physicists' sign) convention: for a convex , evaluate the tangent construction at the slope .
where: — a convex function of ; — the slope (conjugate variable); — the point where the slope equals , obtained by inverting . This is a single value because convexity makes monotone. The defining property — the one that makes the transform complete — is that it is its own inverse on convex functions:
where: — the Legendre transform of . Because both and carry identical information, transforming twice returns the original: no thermodynamic content is ever lost. Applying (1) to the fundamental relation, transform on (conjugate slope ) to obtain the Helmholtz free energy:
where: — Helmholtz free energy, natural variables ; the sign is (not ) because enters the fundamental relation with a plus sign. Its differential is , so . Transforming on instead (slope ) gives the enthalpy, and transforming on both gives the Gibbs free energy:
where: — enthalpy, natural variables , with ; — Gibbs free energy, natural variables , with . The condition that the transform is single-valued is that be strictly convex, i.e. its slope is monotone:
where: where changes sign the slope is non-monotone, several share one , and the naive transform is multivalued — signalling instability and requiring the convex-hull (common-tangent) replacement.
The goal is to prove the property that makes the transform trustworthy for physics: that it loses no information, i.e. transforming twice returns the original function, . This is what guarantees that the Helmholtz, enthalpy, and Gibbs potentials contain exactly the same physics as — nothing more, nothing less. The proof rests entirely on convexity making the slope a one-to-one, invertible map; we work it through on the family (any strictly convex parabola) and check every step symbolically.
Step 1. Compute the slope and invert it: , so . Because , this inverse is single-valued — the crucial convexity condition. Why: only a monotone slope gives a unique for each , so the transform is well-defined.
Step 2. Form the transform via (1): . Why: substituting the inverted turns the tangent construction into an explicit function of the slope alone.
Step 3. Now transform again. Its slope with respect to is , inverted to . Then . Why: applying the same rule to produces a function of the doubly-conjugate variable.
Step 4. Identify , which is exactly the original with : . The transform is an involution — its own inverse. Why: this is the guarantee of no information loss, and it is why can be inverted to recover ; the free energy is as complete as the energy. *Verified: , the double transform , and the Helmholtz special case with are all checked symbolically in verify_aq-sm-legendre-transforms.py.*
Go deeper · Derivation B · 2 minBreakdown on a non-convex function: the common-tangent construction
The goal is to show what goes wrong when the function is not convex, because that failure is not a mathematical nuisance — it is the location of first-order phase transitions. When has a region of negative curvature, its slope is non-monotone, so several distinct share the same slope and the Legendre transform is multivalued. The physically correct object replaces the non-convex dip by its convex hull, a straight common-tangent chord; the flat chord is a coexistence region and its endpoints are the two coexisting phases. We demonstrate this on the double-well .
Step 1. Compute the curvature: , which is negative for . In this band the function is concave — non-convex — so the convexity condition (5) fails. Why: a free energy with a concave stretch violates stability; a fluctuation there lowers , so the homogeneous state cannot persist.
Step 2. Look at the slope . It vanishes at and is non-monotone, so for a range of there are three values of — the transform is multivalued and the naive is ill-defined. Why: a one-to-one slope-to-position map is exactly what convexity guarantees and non-convexity destroys.
Step 3. The remedy is the convex hull. Replace the dip between the two minima by the lowest straight line touching the curve at two points with a common tangent. For this symmetric double well the two minima at have equal depth, , so the common tangent is horizontal. Why: the convex hull is the largest convex function lying below ; on the coexistence interval it is a straight chord, and equal-depth wells make it flat.
Step 4. Interpret physically: the two touching points are the two coexisting phases, the chord is the coexistence (constant-slope) region, and the horizontal segment means both phases share the same intensive variable (equal pressure or chemical potential). This flat piece is a first-order phase transition, and the equal-area rule that fixes the chord is the Maxwell construction. Why: thus the Legendre transform's breakdown is not a defect but the mathematical signature of phase coexistence. *Verified: on the non-convex band, the three critical points making the slope non-monotone, and the equal-depth minima () giving a horizontal common tangent are all checked in the verify script.*
Limiting cases
How the transform specializes and where it matters:
| Case | Result | Meaning |
|---|---|---|
| Strictly convex | (involution) | Fully reversible; carry the same physics as . |
| Transform on | , natural variable | Helmholtz free energy — the potential for fixed- experiments. |
| Transform on | , natural variable | Enthalpy — heat at constant pressure, . |
| Transform on both | , natural | Gibbs free energy — governs chemistry and phase coexistence. |
| Non-convex region | slope multivalued → convex hull | Common-tangent chord = first-order phase transition (Maxwell). |
| Linear (zero curvature) | transform undefined at that slope | Degenerate: whole interval maps to one slope (latent heat). |
Worked examples
1 · Transforming and inverting a concrete potential (confidence builder)
Take the toy energy (a strictly convex fundamental relation at fixed , with ). Construct the Helmholtz free energy by Legendre transform, verify , and confirm you can transform back to recover .
Step 1. Slope: , so . Because , this inverse is unique — the transform is well-defined.
Step 2. Transform: evaluated at : . The free energy is a concave function of — as every free energy must be.
Step 3. Check the differential relation: . Confirmed — the coefficient of in is , matching .
Step 4. Transform back: treating , its conjugate slope is , and . The double transform returns exactly — the involution in action, no information lost.
2 · A double well and the birth of a phase transition (exam level)
The free-energy density of a system is modeled as where is an order parameter. Identify the non-convex region, find the coexisting phases, and explain what the common-tangent construction represents.
Step 1. Curvature: . This is negative for , i.e. — the non-convex band where the homogeneous phase is unstable.
Step 2. Minima: at . The point is a local maximum (); the two minima are at with — the two coexisting phases.
Step 3. Common tangent: because the two minima are equally deep (), the lowest common tangent touching both is horizontal, the line from to . This flat chord is the convex hull replacing the unstable dip.
Step 4. Interpretation: the horizontal segment is a coexistence region — a first-order phase transition. Any state with an average order parameter between and phase-separates into a mixture of the two pure phases , with the mixing fraction set by the lever rule. The Legendre transform's refusal to be single-valued here is exactly the mathematics of a phase transition.
Origins · 1 minadrien-marie legendre and how this was discovered
Adrien-Marie Legendre was a French mathematician whose name is attached to an extraordinary range of objects — Legendre polynomials, the Legendre symbol in number theory, elliptic integrals, and the least-squares method he published before Gauss. The transform that bears his name grew out of his 1787 work on the geometry of surfaces and contact transformations: the observation that a convex curve can be described interchangeably by its points or by its tangent lines. He could not have anticipated that a century and a half later this duality would become the organizing tool of thermodynamics, converting the internal energy into the free energies that govern every chemical reaction and phase change. Legendre worked in relative obscurity in his later years, overshadowed by Gauss and impoverished after losing his pension; only one contested portrait of him is thought to survive. His transform, however, is now indispensable across classical mechanics (Hamiltonian from Lagrangian), thermodynamics, and convex analysis.
Going further
References. Callen, Thermodynamics and an Introduction to Thermostatistics, 2nd ed., chs. 5–6 (Legendre transforms and the potentials) · Pathria & Beale, Statistical Mechanics, 3rd ed., ch. 3 · Kardar, Statistical Physics of Particles, ch. 1 · Reif, Fundamentals of Statistical and Thermal Physics, ch. 5 · Zia, Redish & McKay, "Making sense of the Legendre transform," Am. J. Phys. 77, 614 (2009) · Arnold, Mathematical Methods of Classical Mechanics, ch. 3 (the transform in mechanics).
Provenance. The transform definition at , the involution , and the potential definitions , , are standard (Callen chs. 5–6). A verifier should reproduce the chain and the Helmholtz special case , ; and confirm the double-well has on with equal-depth minima at (horizontal common tangent). All checked in verify_aq-sm-legendre-transforms.py.
Builds on: First Law of Thermodynamics and Internal Energy · Temperature, Pressure, and Chemical Potential as Entropy Derivatives · Second Law of Thermodynamics and Entropy. Leads to: Helmholtz Free Energy, Enthalpy, and Gibbs Free Energy · Maxwell Relations · Thermodynamic Potentials and the Fundamental Relation · Euler Relation and Gibbs–Duhem Equation.
Why do we even need the Legendre transform — why not just substitute T for S directly?
Because a naive substitution loses information. If you take and simply replace by using , you get a function — but this function no longer contains all the thermodynamics. Two different fundamental relations can give the same while differing in their entropy content, so you cannot recover or the full physics from it. The Legendre transform is the correct way to change variables: by subtracting (not just substituting), it produces , whose derivative regenerates the entropy. That is why is a complete potential and is not.
Is the Legendre transform the same thing as the Fourier or Laplace transform?
No — they are conceptually different, though all three change how a function is represented. Fourier and Laplace transforms are integral transforms: they express a function as a superposition of oscillating or exponential modes, and they are linear. The Legendre transform is a pointwise, nonlinear operation based on the geometry of tangent lines and convexity; it trades a variable for its derivative. There is a deep connection — the Laplace transform of is dominated, as , by the point of stationary phase, and the exponent of the result is precisely the Legendre transform of (this is the saddle-point / large-deviation link between the canonical and microcanonical ensembles). But as operations they are distinct: one is integral and linear, the other is geometric and convex.
What actually goes wrong if I apply the transform to a non-convex function?
The slope stops being one-to-one. In a non-convex region, is non-monotone, so several different values give the same slope , and the formula has multiple candidate values — the transform is multivalued and ambiguous. Physically this signals instability: a free energy with a concave stretch describes a state that will spontaneously phase-separate. The correct procedure is to first take the convex hull of (the largest convex function below it), which replaces the non-convex dip with a straight common-tangent chord, and then transform that. The chord is a coexistence region, and the whole procedure is the Maxwell construction. So the "failure" is really the theory correctly refusing to describe an unstable state as homogeneous.
Why is the free energy always concave in temperature, and why does that matter?
It follows from the transform and from thermodynamic stability. The internal energy is convex in (stability requires ). The Legendre transform of a convex function is itself convex in its own variable, but is the transform with respect to , and it comes out concave in : . This matters because concavity of is equivalent to the heat capacity being positive — a stability condition. If you ever compute a free energy that is convex (curving up) in temperature over some range, you have found a thermodynamically unstable region, exactly as a non-convex signals mechanical instability. The curvature signs of the potentials are a complete bookkeeping of stability.
How does the Legendre transform connect to the Hamiltonian in mechanics?
It is the very same operation. In Lagrangian mechanics the dynamics is encoded in , a function of position and velocity. The Legendre transform on the velocity — with conjugate slope the momentum — produces the Hamiltonian . This is structurally identical to -type transforms in thermodynamics (trade a variable for its slope), and it is why Hamiltonian phase space, with its symplectic structure and Liouville's theorem, is the natural bridge to statistical mechanics. The convexity requirement appears there too: the transform is invertible only if is convex in , which for ordinary kinetic energy it always is. Recognizing thermodynamics and mechanics as two applications of one transform is a genuine unification.
If F, H, and G all contain the same information as U, why bother having four potentials?
Because you should always use the potential whose natural variables match what you actually hold fixed, so that equilibrium is a simple minimum. A system in a thermal bath at fixed relaxes to the minimum of ; at fixed it minimizes ; a process at constant pressure exchanges heat equal to . Using the "wrong" potential forces you to track the reservoir explicitly and turns a clean minimization into a messy total-entropy calculation. They are informationally equivalent (each is a Legendre transform of the others), but computationally one is almost always far more convenient — which is exactly the practical payoff of the transform.