In both classical mechanics and in statistical mechanics, at some point while you’re following the derivations, suddenly an expression like “and this is the Legendre transformation” will pop up. Now, in my experience that was it. I was so confused: “Wait what was the transformation? We were just messing around with differentials.” It’s possible my experience was an outlier, but in case it isn’t (and because the transformation itself is kind of cool), here are some notes describing what it actually is.

Say we have a function . We define the exact differential of the function as

and we can further introduce the variables and such that

.

We call and *conjugate variables*; likewise and . We now define the Legendre transformation as the addition or subtraction of a conjugate variable pair to the original function, with the goal “swapping differentials.” An example to illustrate: we introduce a new function

.

Let’s take the total derivative of this expression to give

.

We see that the terms cancel out leaving

.

So the transformation has swapped the first conjugate variable pair, with the differential now on the rather than the . We can even write by analogy with how we started out. Try out the transformation

for yourself.

In classical mechanics, the time-independent Lagrangian can be turned into another function where (the canonical velocity) and (the canonical momentum) are conjugate variables. Those familiar can now recognize the Legendre transformation definition of this Hamiltonian (with an unimportant total minus sign)

.

In statistical mechanics, the First Law of thermodynamics is typically written as

.

That is, the change in internal energy is related to the temperature times the change in entropy , the negative of the pressure times the change in volume , and the so-called chemical potential times the change in the number of particles (in general for many particle types this last term will be a sum). Notably, the conjugate variables come in pairs of one intensive and one extensive variable.

Now, via Legendre transformations, we can introduce a whole family of *thermodynamic potentials*:

- The enthalpy .
- The Helmholtz free energy .
- The Gibbs free energy .
- The grand potential .
- Another useful one that I’m not sure has a name is .

Now, since , the reader can now try, using the transformations above, to write similar expressions for the other potentials. For example, .

To reiterate: the Legendre transformation are when we add or subtract a conjugate variable pair to a function in order to swap which of the two variables is “under the differential operator”. This becomes really useful for deriving things like the Maxwell relations.