Legendre Transforms

Here is a practical annoyance at the heart of thermodynamics. The fundamental relation U(S,V,N)U(S,V,N) 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 y=f(x)y = f(x) can be described two completely equivalent ways: as the set of its points (x,f(x))(x, f(x)), or as the envelope of its tangent lines. Each tangent has a slope p=f′(x)p = f'(x) and an intercept; recording that intercept as a function of the slope is the Legendre transform f⋆(p)f^\star(p). 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, f⋆⋆=ff^{\star\star} = f, is the signature that no information was thrown away. In thermodynamics the conjugate pairs are (T,S)(T, S), (−P,V)(-P, V), and (μ,N)(\mu, N): each intensive variable is the derivative of UU with respect to its extensive partner. Transforming on SS trades entropy for temperature and produces the Helmholtz free energy F=U−TSF = U - TS; transforming on VV trades volume for pressure and gives the enthalpy H=U+PVH = U + PV; transforming on both gives the Gibbs free energy GG. 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 ff is strictly convex. Where ff 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.

Key takeaways
  • 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 (x,f(x))(x, f(x)) of a convex curve for its tangent-line description (slope, intercept).
  • It is an involution on convex functions: f⋆⋆=ff^{\star\star} = f, the guarantee that the transform is reversible and complete.
  • The thermodynamic potentials are Legendre transforms of UU: F=U−TSF = U - TS, H=U+PVH = U + PV, G=U−TS+PVG = U - TS + PV.
  • 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 core insight

The Legendre transform re-expresses a convex function in terms of its slopes rather than its arguments, losing no information (it is an involution, f⋆⋆=ff^{\star\star}=f). In thermodynamics it turns U(S,V,N)U(S,V,N) into the free energies FF, HH, GG 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 L(q,q˙)L(q, \dot q) into the Hamiltonian H(q,p)H(q, p), 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 y=f(x)y = f(x). You can catalogue it by walking along and recording your height at each position — the point description (x,f(x))(x, f(x)). 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: f⋆(p)f^\star(p) records, for each slope pp, 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: f⋆⋆=ff^{\star\star} = f. Nothing was lost in translating from "where am I" to "how steep is it here."

Figure
Legendre transform: a convex curve is the envelope of its tangent lines; f*(p) records their intercepts
A convex curve = the envelope of its tangent lines f x (x, f(x)) each tangent: slope p = f′(x) intercept = −f*(p) f*(p) = p·x − f(x) at p = f′(x)

In thermodynamics the "position" is an extensive variable and the "slope" is its conjugate intensive variable. The slope of UU with respect to SS is the temperature; with respect to VV it is −P-P. Trading SS for TT turns U(S,V,N)U(S,V,N) into the Helmholtz free energy F(T,V,N)F(T,V,N) — 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.

Figure
Where convexity fails: the common-tangent chord replaces the dip — a first-order phase transition
Non-convex free energy → common-tangent construction F V (or density) true (non-convex) F — unstable dip phase α phase β common tangent = convex hull = coexistence flat chord ⇒ first-order transition (Maxwell 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 f(x)f(x), evaluate the tangent construction at the slope pp.

f⋆(p)=p x⋆−f(x⋆),p=f′(x⋆)(1)f^\star(p) = p\,x^\star - f(x^\star), \qquad p = f'(x^\star) \qquad (1)

where: ff — a convex function of xx; p=f′(x)p = f'(x) — the slope (conjugate variable); x⋆(p)x^\star(p) — the point where the slope equals pp, obtained by inverting p=f′(x)p = f'(x). This is a single value because convexity makes f′f' monotone. The defining property — the one that makes the transform complete — is that it is its own inverse on convex functions:

f⋆⋆=f(2)f^{\star\star} = f \qquad (2)

where: f⋆⋆f^{\star\star} — the Legendre transform of f⋆f^\star. Because both ff and f⋆f^\star carry identical information, transforming twice returns the original: no thermodynamic content is ever lost. Applying (1) to the fundamental relation, transform U(S,V,N)U(S,V,N) on SS (conjugate slope T=∂U/∂ST = \partial U/\partial S) to obtain the Helmholtz free energy:

F(T,V,N)=U−TS(3)F(T,V,N) = U - TS \qquad (3)

where: FF — Helmholtz free energy, natural variables (T,V,N)(T,V,N); the sign is U−TSU - TS (not TS−UTS - U) because TT enters the fundamental relation with a plus sign. Its differential is dF=−S dT−P dV+μ dN\mathrm{d}F = -S\,\mathrm{d}T - P\,\mathrm{d}V + \mu\,\mathrm{d}N, so −S=(∂F/∂T)V,N-S = (\partial F/\partial T)_{V,N}. Transforming on VV instead (slope −P=∂U/∂V-P = \partial U/\partial V) gives the enthalpy, and transforming on both gives the Gibbs free energy:

H=U+PV(S,P,N),G=U−TS+PV(T,P,N)(4)H = U + PV \qquad (S,P,N), \qquad\qquad G = U - TS + PV \qquad (T,P,N) \qquad (4)

where: HH — enthalpy, natural variables (S,P,N)(S,P,N), with dH=T dS+V dP+μ dN\mathrm{d}H = T\,\mathrm{d}S + V\,\mathrm{d}P + \mu\,\mathrm{d}N; GG — Gibbs free energy, natural variables (T,P,N)(T,P,N), with dG=−S dT+V dP+μ dN\mathrm{d}G = -S\,\mathrm{d}T + V\,\mathrm{d}P + \mu\,\mathrm{d}N. The condition that the transform is single-valued is that ff be strictly convex, i.e. its slope is monotone:

f′′(x)>0⟺p=f′(x) is invertible(5)f''(x) > 0 \quad\Longleftrightarrow\quad p = f'(x)\ \text{is invertible} \qquad (5)

where: where f′′f'' changes sign the slope is non-monotone, several xx share one pp, and the naive transform is multivalued — signalling instability and requiring the convex-hull (common-tangent) replacement.

Derivation AThe Legendre transform is an involution on convex functions

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, f⋆⋆=ff^{\star\star} = f. This is what guarantees that the Helmholtz, enthalpy, and Gibbs potentials contain exactly the same physics as UU — nothing more, nothing less. The proof rests entirely on convexity making the slope p=f′(x)p = f'(x) a one-to-one, invertible map; we work it through on the family f(x)=ax2f(x) = a x^2 (any strictly convex parabola) and check every step symbolically.

Step 1. Compute the slope and invert it: p=f′(x)=2axp = f'(x) = 2ax, so x⋆(p)=p/(2a)x^\star(p) = p/(2a). Because f′′=2a>0f'' = 2a > 0, this inverse is single-valued — the crucial convexity condition. Why: only a monotone slope gives a unique xx for each pp, so the transform is well-defined.

Step 2. Form the transform via (1): f⋆(p)=p x⋆−f(x⋆)=p⋅p2a−a(p2a)2=p22a−p24a=p24af^\star(p) = p\,x^\star - f(x^\star) = p\cdot\frac{p}{2a} - a\left(\frac{p}{2a}\right)^2 = \frac{p^2}{2a} - \frac{p^2}{4a} = \frac{p^2}{4a}. Why: substituting the inverted x⋆x^\star turns the tangent construction into an explicit function of the slope alone.

Step 3. Now transform g(p)=f⋆(p)=p2/(4a)g(p) = f^\star(p) = p^2/(4a) again. Its slope with respect to pp is q=g′(p)=p/(2a)q = g'(p) = p/(2a), inverted to p⋆(q)=2aqp^\star(q) = 2aq. Then g⋆(q)=q p⋆−g(p⋆)=q⋅2aq−(2aq)24a=2aq2−aq2=aq2g^\star(q) = q\,p^\star - g(p^\star) = q\cdot 2aq - \frac{(2aq)^2}{4a} = 2aq^2 - aq^2 = aq^2. Why: applying the same rule to f⋆f^\star produces a function of the doubly-conjugate variable.

Step 4. Identify g⋆(q)=aq2g^\star(q) = aq^2, which is exactly the original ff with x→qx \to q: f⋆⋆=ff^{\star\star} = f. The transform is an involution — its own inverse. Why: this is the guarantee of no information loss, and it is why F=U−TSF = U - TS can be inverted to recover U=F+TSU = F + TS; the free energy is as complete as the energy. *Verified: f⋆=p2/(4a)f^\star = p^2/(4a), the double transform f⋆⋆=aq2=ff^{\star\star} = aq^2 = f, and the Helmholtz special case F(T)=−T2/(4a)F(T) = -T^2/(4a) with ∂F/∂T=−S\partial F/\partial T = -S 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
Derivation BBreakdown 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 ff has a region of negative curvature, its slope p=f′(x)p = f'(x) is non-monotone, so several distinct xx 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 f(x)=x4−2x2f(x) = x^4 - 2x^2.

Step 1. Compute the curvature: f′′(x)=12x2−4f''(x) = 12x^2 - 4, which is negative for ∣x∣<1/3|x| < 1/\sqrt3. 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 FF, so the homogeneous state cannot persist.

Step 2. Look at the slope p=f′(x)=4x3−4xp = f'(x) = 4x^3 - 4x. It vanishes at x=0,+1,−1x = 0, +1, -1 and is non-monotone, so for a range of pp there are three values of xx — the transform is multivalued and the naive f⋆(p)f^\star(p) 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 x=±1x = \pm1 have equal depth, f(±1)=−1f(\pm1) = -1, so the common tangent is horizontal. Why: the convex hull is the largest convex function lying below ff; on the coexistence interval it is a straight chord, and equal-depth wells make it flat.

Step 4. Interpret physically: the two touching points x=±1x = \pm1 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: f′′<0f'' < 0 on the non-convex band, the three critical points making the slope non-monotone, and the equal-depth minima (f(1)=f(−1)f(1) = f(-1)) giving a horizontal common tangent are all checked in the verify script.*

Limiting cases

How the transform specializes and where it matters:

CaseResultMeaning
Strictly convex fff⋆⋆=ff^{\star\star} = f (involution)Fully reversible; F,H,GF, H, G carry the same physics as UU.
Transform on SSF=U−TSF = U - TS, natural variable TTHelmholtz free energy — the potential for fixed-TT experiments.
Transform on VVH=U+PVH = U + PV, natural variable PPEnthalpy — heat at constant pressure, ΔH=QP\Delta H = Q_P.
Transform on bothG=U−TS+PVG = U - TS + PV, natural (T,P)(T,P)Gibbs free energy — governs chemistry and phase coexistence.
Non-convex regionslope multivalued → convex hullCommon-tangent chord = first-order phase transition (Maxwell).
Linear ff (zero curvature)transform undefined at that slopeDegenerate: whole interval maps to one slope (latent heat).

Worked examples

1 · Transforming and inverting a concrete potential (confidence builder)

Take the toy energy U(S)=aS2U(S) = a S^2 (a strictly convex fundamental relation at fixed V,NV, N, with a>0a > 0). Construct the Helmholtz free energy F(T)F(T) by Legendre transform, verify −S=∂F/∂T-S = \partial F/\partial T, and confirm you can transform back to recover UU.

Step 1. Slope: T=∂U/∂S=2aST = \partial U/\partial S = 2aS, so S(T)=T/(2a)S(T) = T/(2a). Because U′′=2a>0U'' = 2a > 0, this inverse is unique — the transform is well-defined.

Step 2. Transform: F=U−TS=aS2−TSF = U - TS = aS^2 - T S evaluated at S=T/(2a)S = T/(2a): F=aT24a2−TT2a=T24a−T22a=−T24aF = a\frac{T^2}{4a^2} - T\frac{T}{2a} = \frac{T^2}{4a} - \frac{T^2}{2a} = \mathbf{-\dfrac{T^2}{4a}}. The free energy is a concave function of TT — as every free energy must be.

Step 3. Check the differential relation: ∂F/∂T=−T2a=−S\partial F/\partial T = -\dfrac{T}{2a} = -S. Confirmed — the coefficient of dT\mathrm{d}T in dF\mathrm{d}F is −S-S, matching dF=−S dT\mathrm{d}F = -S\,\mathrm{d}T.

Step 4. Transform back: treating F(T)F(T), its conjugate slope is ∂F/∂T=−S\partial F/\partial T = -S, and F−(−S)T=F+ST=−T24a+T2aT=T24a=aS2=UF - (-S)T = F + ST = -\frac{T^2}{4a} + \frac{T}{2a}T = \frac{T^2}{4a} = aS^2 = \mathbf{U}. The double transform returns UU 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 f(x)=x4−2x2f(x) = x^4 - 2x^2 where xx is an order parameter. Identify the non-convex region, find the coexisting phases, and explain what the common-tangent construction represents.

Step 1. Curvature: f′′(x)=12x2−4f''(x) = 12x^2 - 4. This is negative for x2<1/3x^2 < 1/3, i.e. ∣x∣<1/3≈0.577|x| < 1/\sqrt3 \approx \mathbf{0.577} — the non-convex band where the homogeneous phase is unstable.

Step 2. Minima: f′(x)=4x3−4x=4x(x2−1)=0f'(x) = 4x^3 - 4x = 4x(x^2 - 1) = 0 at x=0,±1x = 0, \pm1. The point x=0x = 0 is a local maximum (f′′=−4<0f'' = -4 < 0); the two minima are at x=±1x = \pm1 with f(±1)=1−2=−1f(\pm1) = 1 - 2 = \mathbf{-1} — the two coexisting phases.

Step 3. Common tangent: because the two minima are equally deep (f(+1)=f(−1)=−1f(+1) = f(-1) = -1), the lowest common tangent touching both is horizontal, the line f=−1f = -1 from x=−1x = -1 to x=+1x = +1. 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 −1-1 and +1+1 phase-separates into a mixture of the two pure phases x=±1x = \pm1, 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
AL
adrien-marie legendre
1752–1833 · Paris

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.

History
1755
— Euler formalizes the theory of homogeneous functions that underlies the extensive/intensive structure.
1787
— Legendre studies contact transformations of surfaces, the geometric root of the transform.
1834
— Hamilton uses the transform (Lagrangian → Hamiltonian) in his reformulation of mechanics.
1875
— Gibbs applies the transform to thermodynamics, defining the free energies as transforms of U.
1912
— Carathéodory and Born sharpen the axiomatic/convex-analytic footing of the thermodynamic transform.

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 f⋆(p)=px−f(x)f^\star(p) = px - f(x) at p=f′(x)p = f'(x), the involution f⋆⋆=ff^{\star\star} = f, and the potential definitions F=U−TSF = U - TS, H=U+PVH = U + PV, G=U−TS+PVG = U - TS + PV are standard (Callen chs. 5–6). A verifier should reproduce the f=ax2→f⋆=p2/(4a)→f⋆⋆=ff = ax^2 \to f^\star = p^2/(4a) \to f^{\star\star} = f chain and the Helmholtz special case F(T)=−T2/(4a)F(T) = -T^2/(4a), ∂F/∂T=−S\partial F/\partial T = -S; and confirm the double-well f=x4−2x2f = x^4 - 2x^2 has f′′<0f'' < 0 on ∣x∣<1/3|x| < 1/\sqrt3 with equal-depth minima at ±1\pm1 (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 U(S,V,N)U(S,V,N) and simply replace SS by TT using T=∂U/∂ST = \partial U/\partial S, you get a function U~(T,V,N)\tilde U(T,V,N) — but this function no longer contains all the thermodynamics. Two different fundamental relations can give the same U~(T)\tilde U(T) while differing in their entropy content, so you cannot recover SS or the full physics from it. The Legendre transform is the correct way to change variables: by subtracting TSTS (not just substituting), it produces F=U−TSF = U - TS, whose derivative ∂F/∂T=−S\partial F/\partial T = -S regenerates the entropy. That is why FF is a complete potential and U~(T)\tilde U(T) 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 e−Nf(x)e^{-N f(x)} is dominated, as N→∞N \to \infty, by the point of stationary phase, and the exponent of the result is precisely the Legendre transform of ff (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 p=f′(x)p = f'(x) stops being one-to-one. In a non-convex region, f′f' is non-monotone, so several different xx values give the same slope pp, and the formula f⋆(p)=px−f(x)f^\star(p) = px - f(x) 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 ff (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 U(S)U(S) is convex in SS (stability requires ∂2U/∂S2=T/CV>0\partial^2 U/\partial S^2 = T/C_V > 0). The Legendre transform of a convex function is itself convex in its own variable, but F(T)=U−TSF(T) = U - TS is the transform with respect to SS, and it comes out concave in TT: ∂2F/∂T2=−CV/T<0\partial^2 F/\partial T^2 = -C_V/T < 0. This matters because concavity of F(T)F(T) 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 F(V)F(V) 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 L(q,q˙)L(q, \dot q), a function of position and velocity. The Legendre transform on the velocity q˙\dot q — with conjugate slope the momentum p=∂L/∂q˙p = \partial L/\partial \dot q — produces the Hamiltonian H(q,p)=pq˙−LH(q, p) = p\dot q - L. This is structurally identical to F=TS−UF = TS - U-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 LL is convex in q˙\dot q, which for ordinary kinetic energy 12mq˙2\tfrac12 m\dot q^2 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 T,V,NT, V, N relaxes to the minimum of F(T,V,N)F(T,V,N); at fixed T,P,NT, P, N it minimizes G(T,P,N)G(T,P,N); a process at constant pressure exchanges heat equal to ΔH\Delta H. 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.

Before this

Where this leads