Legendre's Tranformation: An Intuitive Approach

Legendre Transformation is an involutive transformation on real-valued functions that are convex on a real variable. Specifically, if a real-valued multivariable function is convex on one of its independent real variables, then the Legendre transform with respect to this variable is applicable to the function.

This uses the fact that points and lines are related by some sort of duality, which let's us relate different ideas of physics to each other. Although, we learn it just as a transformation in Classical Mechanics & Thermodynamics, it is really simple and intuitive.

In this blog, we will undertand exactly that.

πŸͺΆ Poem A curve of thought, so smooth, so sly,
Hides truth in tangents passing by.
Each slope a whisper, each line a clue,
Trade x for p β€” the world feels new.
In mirrors of math, two forms agree,
Lagrange and Hamilton β€” duality’s key.
Where physics and geometry softly rhyme,
Lives the Legendre’s timeless design..

---K.A.Rousan

Introduction

Suppose we have some function y=f(x)y=f(x). We can draw it as some curve on x-y plane. So, all the information of the function is stored in that graph. But as It can be seen below if we just draw all the tangent lines of the graph, we can get the curve itself, i.e., All the information of the curve is stored in it's tangent lines. To be more precise y intercepts of it's tangent lines(but not for all type of functions).

1234βˆ’1βˆ’2βˆ’3βˆ’42468βˆ’2βˆ’4

Transforming one function into another without information loss

To go further, let's start with the function:

f(x)=x2f(x) = x^2

What kind of information is present here? The answer is for any value xx on the real number we have a value f(x)=x2f(x)=x^2. Our goal is to transform ff from depending on xx to a new function gg such that it depends on pp. But the catch is: we don't want to loose any information in the process.

This is done through derivative. If we take the derivative of f(x)f(x), we get,

p(x)=dfdx=2xp(x) = \frac{df}{dx} = 2x
1234βˆ’1βˆ’2βˆ’3βˆ’42468βˆ’2βˆ’4
xβ‚€ = 0.00
P
(0, 0.00)

So, pp gives the slope of the tangent line at every xx. In this specific example, for every value of xx we get a specific value of pp, i.e., there is a 1 to 1 corresondance between xx and pp. This allows us to to consider another function x(p)x(p), i.e.,

x(p)=p2x(p) = \frac{p}{2}

Hence, we have two ways of understanding:

  1. Either pp as a function of xx.

  2. Or xx as a function of pp.

We can then plug xx as a function of pp directly into ff, making it now function of pp. This gives us:

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

It seems we have suceed in transforming ff from a function that depends on xx to a new function that depends on pp without lossing any information. But sadly it's not that simple.

Finding the lost information

To understand this now consider,

f(x)=(xβˆ’d)2f(x) = (x-d)^2

In this case dy/dx=2(xβˆ’d)=pdy/dx = 2(x-d) = p. If we plug it back, we get,

f(p)=p24f(p) = \frac{p^2}{4}

again! So, whatever value we choose for dd, we will get the same end function. The information about dd is lost in the procedure we are currently following. The reason it happens is very simple. This happens because we have only been considering the tangent lines of each function which turns out to be the same everywhere just shifted.

2468βˆ’2βˆ’424681012141618βˆ’2βˆ’4
yβ‚€ = 4.00
P₁
Pβ‚‚
Blue: f₁(x)=xΒ²
Green: fβ‚‚(x)=(xβˆ’4)Β²
Tangents remain parallel at equal heights
Fortunately, there is a closely related quantity that is able to capture the uniqueness of each of these functions and that is the yy intercepts of the tangent line which we can see actually do differ depending on the original function. So, taking that into account, we can solve this problem.

Let's say (x,y)=(x,f)(x,y)=(x,f) is a point on the parabola (y=f(x)=x2y=f(x)=x^2). Then, as mentioned slope is df/dx=pdf/dx = p and the yy intercept is g. This gg can be given by,

p=f+gxβˆ’0⟹g=pxβˆ’fp = \frac{f + g}{x - 0} \implies g = px - f

This truely captures all the information of the function.

πŸ“ Note Here as the intercept is always negative, I have already taken the intercept to be (0,βˆ’g)(0,-g). So, above gg is the distance from origin to intercept.

Legendre Transformation

Introduction

Finally, in general if we have a function f(x)f(x), then Legendre Transformation of it is,

g(p)=pβ‹…x(p)βˆ’f(x(p))g(p) = p\cdot x(p) - f(x(p))

i.e., a transformation which converts one function into another such that the information remains same and whose parameter is slope of the previous one.

For our two functions f1(x)=x2f_1(x) = x^2 and f2(x)=(xβˆ’d)2f_2(x) = (x-d)^2. We get,

g1(p)=p4   and  g2(p)=p24+pdg_1(p) = \frac{p}{4} \text{ \ \ and\ \ } g_2(p) = \frac{p^2}{4} + pd

We have now included information of yy intercept too, so each of the original functions of xx maps to a unique function of pp. Also, beacuse no information has been lost in this, we can also find the Legendre transform of gg and get back original functions ff's.

πŸ€” Problem Try showing that if we start from g1g_1 and g2g_2, we can recover the original functions g1g_1 and g2g_2.
We now truly have two ways of expressing the same information. One that depends on xx and other on pp, providing a beautiful duality between points and lines. This mapping is 1-to-1, i.e., unique.

What functions respect legendre transformation?

Now the question is does it works for all functions?, sadly the answer is no!

To motivate the answer let's start with the function f(x)=x3f(x) = x^3. We do the exact same things, we have done before,

f(x)=x3⟹fβ€²(x)=3x2=p(x)⟹x=Β±(p3)1/2f(x) = x^3 \implies f'(x) = 3x^2 = p(x) \implies x = \pm \Big(\frac{p}{3}\Big)^{1/2}

Immediately we run into a problem. This is not a function (not bijective). Any value we put for pp will gives us two different values of xx. This means, there are many airs of points that have same slope. We can see it in the interactive plot below. With the exception of the origin(not Gojo Saturo), we are always able to find two points that have exact same value. In terms of f(x)f(x), these values correspond to producing the exact same slope for tangent lines.

123βˆ’1βˆ’2βˆ’3246810βˆ’2βˆ’4βˆ’6
p (slope) = 3.00
x₁
xβ‚‚
f(x)=xΒ³ (blue), p(x)=3xΒ² (pink)
Two tangents share the same slope p
This gives us the key thing we need in order to be able to find the legendre transform of a given function. We need all the slopes of tangent lines to be unique and this will happen if the function's derivative is always increasing or decreasing, i.e., monotonically increasing or decreasing. From ff's point of view, for f to have legendre transformation, f(x) must be convex, means if we connect any two points on the curve, the line is always on the same side of the curve. To check if any function is convex, we can just find it's second derivative and then if,

fβ€²β€²(x)β‰₯0      for all x  in the domainf''(x)\geq 0 \text{ \ \ \ \ \ for all } x \text{ \ in the domain}

then f(x)f(x) is convex. With all of these, we now know what is Legendre Transform and on which functions we can apply it on.

But does it only works on single variable functions?, Well no!, we can apply the idea on multivariable functions too! and also there can be some variables which don't participate in the transformation. Let's see this:

Legendre Transform of multi-variable functions

Suppose we have a function f(x1,x2,β‹―,xn,u1,u2,β‹―,um)f(x_1,x_2,\cdots, x_n, u_1,u_2,\cdots,u_m) then let's say we want to create a function for studying the same system but with p1,p2,p3,β‹―,pnp_1,p_2,p_3,\cdots , p_n where pi=βˆ‚f/βˆ‚xip_i = \partial f/\partial x_i and keep uiu_i's as they are. Then, the Legendre Transform is,

g(p1,p2,β‹―,pm,u1,u2,β‹―,um)=βˆ‘i=1npixiβˆ’f(x1(p1),x2(p2),β‹―,xn(pn),u1,u2,β‹―,um)g(p_1,p_2,\cdots,p_m,u_1,u_2,\cdots,u_m) = \sum_{i=1}^{n} p_i x_i - f(x_1(p_1),x_2(p_2),\cdots, x_n(p_n),u_1,u_2,\cdots,u_m)

We can easily show that gg will only be function of pp's and uu's only.

πŸ“ Note Visit this page for the proof.
Here for multivariable case, we check the Hessian Matrix (positive semi-definite then convex) for convex check.

Application of Legendre Transform

There are many applications of this transformation. But the most iconic ones are in Classical Mechanics and Thermodynamics. As thermodyanics one is much more popular, we will see that one here.

As we know internal energy(UU) of s system is a function of state which means that a system undergoes the same change in UU when we move it from one equilibrium state to another, irrespetive of which route we take through parameter space. This makes UU a very useful quantity. But we know U=U(V,S)U = U(V,S), i.e., it's function of entropy and volume(keeping particle number constant).

But to be honest SS is very hard to control. Rather controlling TT and pp is much more easy. But then what we do?

To truly undertsand it let's start with UU. From 1st law of thermodynamics,

dU=(βˆ‚Uβˆ‚S)VdS+(βˆ‚Uβˆ‚V)SdV=T dSβˆ’p dVdU = \Bigg(\frac{\partial U}{\partial S}\Bigg)_V dS+ \Bigg(\frac{\partial U}{\partial V}\Bigg)_S dV = T\ dS - p\ dV

This gives us,

T=(βˆ‚Uβˆ‚S)V   and    p=βˆ’(βˆ‚Uβˆ‚S)ST = \Bigg(\frac{\partial U}{\partial S}\Bigg)_V \text{\ \ \ and \ \ \ } p = -\Bigg(\frac{\partial U}{\partial S}\Bigg)_S

So, for constant volume process of our system, dU=T dSdU = T\ dS and much more.

But now we want to study a system where the temperature is constant. How are we going to study such systems?.. How are we going to study the energy change?

The answer just find a function which is also energy but one of it's parameters are TT. As we know SS and TT are related and as we just showed they are related by derivative(like pp and xx in previous examples). This should shout the name of our legendary Legendre Transformation.

So, we will define,

F=Uβˆ’TSF = U - TS

(We can also use TSβˆ’UTS-U but then the physical interpretations will not be straight-forward, so we use this convention of using Uβˆ’TSU-TS). This then tells us,

dF=T dSβˆ’p dVβˆ’T dSβˆ’S dT=βˆ’S dTβˆ’p dVdF = T\ dS - p\ dV - T\ dS - S\ dT = -S\ dT - p\ dV

This implies that the natural variables for FF are VV and TT, i.e., F=F(V,T)F=F(V,T). Then for a Isothermal process, we have,

dF=βˆ’p dVβŸΉΞ”F=βˆ’βˆ«V1V2p dVdF = -p\ dV \implies \Delta F = -\int_{V_1}^{V_2}p\ dV

Hence, a positive change in FF represents reversible work done on the system by the surroundings, while a negative change in FF means reversible work done on the surrounding by the system.

We can also see as dF=dUβˆ’T dSdF = dU - T\ dS (for constant TT) and dWβ‰₯dUβˆ’T dSdW\geq dU - T\ dS (equality holds for reversible process). So, we have,

dWβ‰₯dFdW\geq dF

What it means is, adding work to the system increases the system's F(called Helmholtz energy). In a reversible process, dW=dFdW = dF and the work added to the system goes directly into increasing the Helmholtz energy. If we extract a certain amount of work from system(dW<0dW<0), then this will be associated with at least as big a drop in the system's FF.

This shows how powerful Legendre Transformation is. Using it we just found something FF which is also energy(check the dimension) and not just any energy, It represent a very powerful energy, i.e., free energy. This tells us how much energy we can extract from the system, i.e., how much energy is avaliable for us to extract from the system.

In this way, we can find many more useful things. Maybe in another blog I will discuss them.

πŸ€” Problem Suppose, we want to study our system under isobaric process (P=P= constant). Try creating a new type of energy for that from U(S,V)U(S,V).

Also, try finding what will be it's physical interpretation.

If you guys are interested read:

  1. A Student's Guide to Entropy by Lemons

  2. An Introductory Course of Statistical Mechanics by P.B. Pal

  3. Making sense of the Legendre transform. American Journal of Physics. 77 (7): 614, Zia, R. K. P.; Redish, E. F.; McKay, S. R. (2009)

I have mainly followed 3rd one along with 2nd one.


I hope you learn something new and enjoyed this article.

If you have some queries, do let me know in the comments or contact me using my using the informations that are given on the page About Me.

CC BY-SA 4.0 Kazi Abu Rousan. Last modified: October 31, 2025. Website built with Franklin.jl and the Julia programming language.