Legendre Transform

January 5, 2008 – 4:19 am

The Legendre transform is a simple and useful tool in some branches of physics such as Thermodynamics and Mechanics. In my experience though, this transform is usually explained in a very confusing way.

I want to give my own derivation, which I hope is clear and straightforward. If you’re already familiar with the transform, you can skip straight to Derivation of the Legendre Transform.

Some Background

Let’s start with the definition. If you have a function f(x), its Legendre transform is a function g(p), where p is thought of as f(x)’s derivative. g(p) is defined as:

g(p) = xp-f(x)

This definition is already confusing, because x is considered a function of p. This function is found by solving the following equation for x:

p = \frac{df}{dx}(x)

To clarify matters, let’s consider an example. Take f(x)=x^2, then:

p=\frac{df}{dx}(x)=2x

x=p/2

The Legendre transform is then:

g(p) = x(p)p-f(x(p))=\frac{p}{2}p-(\frac{p}{2})^2=\frac{p^2}{4}

Okay, what is it good for? The usual explanation starts with some geometric construction like the one you see on Wikipedia(*). Then, to explain why the transform works, you are shown the differential:

df=\frac{df}{dx}dx=pdx

dg=d(px)-df=xdp+pdx-pdx=xdp

And the conclusion is that g is indeed a function of p, which is f’s derivative. Mathematically speaking, this argument is quite unconvincing, because saying that g is a function of f’(x) has no meaning. g is a function of some real number, and this number has no intrinsic connection to any derivatives.

One possible relation could be that g and f agree if you give the corresponding arguments:

g(\frac{df}{dx}(x))=f(x)

but this is not the case! Some better explanation is obviously needed.

Derivation of the Legendre Transform

We define as before:

p(x)=\frac{df}{dx}(x)

And we are looking for a function g(p). The crucial point is this: We require that g’s derivative will correspond to x:

x=\frac{dg}{dp}(p)

Rigorously, this means:

x=\frac{dg}{dp}(p(x))

Where p(x) is the function defined by the first requirement.

Now we have something we can use. We look at the function g(p(x)) and we calculate:

\frac{d}{dx}g(p(x))=\frac{dg}{dp}(p(x)) \cdot \frac{dp}{dx}(x) = x \cdot \frac{d^2f}{dx^2}(x)

Both requirements were used in the last transition. We now integrate this equation by dx:

\int \frac{d}{dx}g(p(x)) dx=\int x \cdot \frac{d^2f}{dx^2}(x) dx

Integrating by parts on the right-hand side:

g(p(x))=x \cdot \frac{df}{dx}(x)-\int \frac{df}{dx}(x) dx = xp(x)-f(x) + C

Thus g(p) is defined up to a constant, and choosing C=0 we get the familiar Legendre transform:

g(p)=xp-f(x)

Motivation

Finally, I want to comment on this second requirement that x=g’(p), which is how I came up with this derivation. In Thermodynamics, the important parameters of a problem always come in pairs: Pressure and Volume, Temperature and Entropy, Number of particles and the Chemical constant, and so on. They are paired by the First Law, which is conservation of energy:

dU = TdS-PdV + \mu dN + ~ \cdots

So here, the internal energy U is a natural function of S,V,N. Its partial derivatives are T,-P, and mu. Of course it can depend on other variables and there are other derivatives, but these are the ones that are easiest to calculate.

The Legendre transform is used to get new forms of energy that are naturally dependent on other parameters. This is done by switching between pairs of variables. For instance, if you know the temperature T instead of the entropy S, you can transform like this:

F = U-TS

F is called the ‘Helmholtz Free Energy’, and its natural parameters are T,V,N:

dF = -SdT-PdV + \mu dN + ~ \cdots

So T, which was a derivative before, is now a parameter. But equally as important, S is now a derivative. This is very important because it allows us to calculate S very easily. If we had a new function F=F(T,V,N) that wouldn’t allow simple calculation of S, it would be useless. This is what makes the Legendre transform so useful.

Having said that, we now see that we can define other transforms by changing this requirement. We still get functions that can be thought of as ‘functions of the derivative of f’. For example, require:

ax+b=\frac{dg}{dp}(p)

Where a,b are some arbitrary parameters. Then we get a new transform:

g(p) = a(xp-f(x)) + bp

Perhaps this method can generate some other useful transforms.

(*) I just saw that Wikipedia has something that is related to my explanation under ‘Another definition’, although it goes through a different route and still uses the geometric requirements.

  1. 2 Responses to “Legendre Transform”

  2. Thanks for writing this up! I found it really helpful.

    By jascha on Mar 24, 2009

  3. nice post! :-)

    By sivaramakrishnan on Oct 19, 2009

Post a Comment