The Legendre Transforms

Back to Contents

    In physics we put the phenomena involving scrambled energy into the realm that we call thermodynamics. When we have a system filled with scrambled energy (better known as heat), especially if the system consists of a gas, we have a description of the internal energy of the system in terms of pairs of associated variables, one consisting of an intensive variable (such as entropy, pressure, or chemical potential) and the other consisting of the corresponding extensive variable (temperature, volume, number of molecules). We now want to work out the mathematical form of that description.

    Because energy obeys a conservation law, we know that any description that we have of the energy contained in a system must conform to the requirement that its differential be an exact differential. In a thermodynamic system we do not take the differentials with respect to the spatial coordinates, but rather take them with respect to the extensive parameters of the system, parameters that have values equal to the sums of the values that they have in each of the system’s component subsystems. In a classical thermodynamic system the extensive parameters comprise entropy S, volume V, and the mole number Ni of the i-th chemical species in the system, so we have

(Eq’n 1)

    The second term on the right side of that equation represents the work done by a change in the system’s volume. The partial derivative represents the analogue of a force, one that resists or propels changes in volume. We call that analogue pressure and we know that pressure resists decreases in volume, so we have

(Eq’n 2)

    The first term on the right side of Equation 1 represents heat entering or leaving the system. Again we have an analogue of force and in this case it moves heat into or out of the system. We identify that analogue as the degree of hotness in the system, which we call the system’s temperature,

(Eq’n 3)

    Each component of the third term on the right side of Equation 1 represents chemical energy entering or leaving the system. We identify the analogue of a force in this case as the chemical potential of the i-th chemical species and we note that it moves quantities of the i-th chemical species into or out of the system either by chemical transformation or by actual movement of the relevant particles. We have in this case

(Eq’n 4)

    With these abstract forces we can devise several suitable descriptions of our thermodynamic system for the different problems we encounter. These arise because we have a description of our thermodynamic system with a function of more than one variable and that fact leads to the possibility of inexact differentials. We thus have four basic potentials equal to or analogous to the energy in the system.

Internal Energy

    Now, using Equations 2, 3, and 4, we rewrite Equation 1 as

(Eq’n 5)

the fundamental equation of the energy representation of classical thermodynamics with independent variables S and V. That equation also comes to us with an associated minimizing principle:

    A thermodynamic system so evolves that at equilibrium its unconstrained internal parameters attain values that minimize the system’s energy for a given value of the entropy.

That statement tells us that Equation 5 describes the work done by a system at constant entropy (dS=0).

    As an example let’s consider the adiabatic expansion/compression of a gas from Carnot cycle, the cycle of compression, heating, expansion, and cooling devised and studied by Nicolas Leonard Sadi Carnot (1796 Jun 01 – 1832 Aug 24) and published by him in 1824. In these two parts of the cycle the gas’s entropy remains unchanged, so the gas neither gains nor loses heat.

    In this case let’s consider an ideal monatomic gas (helium will come close enough to ideal for our purpose) enclosed in a cylinder equipped with a piston. In this example we do not put the cylinder into thermal contact with a heat reservoir and we do nothing that will change the chemical potential term, so Equation 5 becomes


(Eq’n 6)

We have the equation of state of a monatomic gas,

(Eq’n 7)

and the basic ideal gas law,


(Eq’n 8)

We substitute the expression in Equation 8 into Equation 7 and then substitute the result into Equation 6 and get

(Eq’n 9)

If we multiply that equation by two thirds, divide it by pV, and then integrate the result, we get

(Eq’n 10)

in which V0 and p0 represent the volume and pressure of the system’s initial state. Because we have already inserted the initial values of the variables, we can set the constant of integration equal to zero. Finding the antilogarithm of the result and rearranging the factors gives us

(Eq’n 11)

From the ideal gas law we know that p=NkT/V, so if we substitute that into Equation 11 and divide out the Nk factor, absorbing it into the constant, we get

(Eq’n 12)

for which we can calculate the constant from the initial conditions of the system and then calculate the temperature the system achieves for any subsequent volume we impose upon it. Thus we can calculate the parameters for two of the phases of the Carnot cycle.

    Let’s look again at the minimizing principle. The first criterion a function must meet in order to display a minimum requires that its first derivative equal zero. In this case dE=0 when the system reaches equilibrium and in an ideal gas we thus have from Equation 5


(Eq’n 13)

Using the ideal gas law of Equation 8 to replace the pressure in Equation 13 gives us

(Eq’n 14)

Dividing that equation by the absolute temperature of the gas and integrating the result gives us


(Eq’n 15)

If we coordinate the volume that the gas fills with the number of microstates that comprise the macrostate that corresponds to the gas filling that volume, then that equation expresses Boltzmann’s theorem of statistical thermodynamics.

Helmholtz Potential

    In order to change the variable that we control in the master equation from S to T we use the Legendre transform


(Eq’n 16)

which gives us

(Eq’n 17)

In those equations F represents the Helmholtz free energy (or potential), the work that a system can do at a constant temperature, which we arrange by putting the system into thermal contact with a heat reservoir. The associated minimizing principle states:

    A thermodynamic system in contact with a heat reservoir so evolves that at equilibrium its unconstrained internal parameters attain values that minimize the Helmholtz potential for a given value of the absolute temperature.

Thus in a system with a fixed temperature the other variables change in a way that minimizes F when we remove any constraints on them.

    In a Helmholtz system we control the temperature and the volume. We set the temperature at a constant value by putting the system into contact with a heat reservoir and control the volume by moving part of the system, such as a piston inside a cylinder. This control gives us the means to analyze the other two, isothermal parts of the Carnot cycle.

    In the isothermal part of a Carnot cycle we put the cylinder containing a monatomic gas and a piston into contact with either a hot or a cold heat reservoir. When we expand or compress the gas we allow heat to flow freely into or out of the gas in order to keep the temperature constant. That entails, of course, the basic gas law of Equation 8 telling us that during this process pV=constant. Again ignoring the chemical potentials and noting that dT=0, we have Equation 17 as dF=-pdV. That equation enables us to calculate the amount of work that we can harness or that we must put into the system when the gas expands or gets compressed. Calculating the instantaneous pressure from the basic gas law, we get

(Eq’n 18)

Thus we can calculate the amount of work that we get out of the isothermal expansion phase and the work that we must put into the isothermal compression phase of the Carnot cycle.

    Another way to interpret the Helmholtz potential considers the creation of a system in an environment of constant temperature. We take the internal energy E as the energy required to create the system in the absence of any other energy sources. If we have the system in contact with a heat reservoir while we create it, it will absorb heat in the amount Q=TS, in which S represents the system’s final entropy. Thus, we can conceive the Helmholtz free energy as the amount of energy that we must supply to create a system in contact with a heat reservoir at an absolute temperature T, the TS term representing the diminution of the energy that we would otherwise have to supply to the system.


    Imagine that we have a system that has a variable volume and assume that we have connected that system to a pressure reservoir, a container whose internal pressure will not change, regardless of how much gas we put into it or take out of it. If we allow the system’s volume to expand by dV, then the system does the inexact differential increment of work


(Eq’n 19)

but a quantity of energy equal to pdV comes into the system from the pressure reservoir, so we get no net change in the system’s energy; specifically,


(Eq’n 20)

We thus get


(Eq’n 21)

because we absorb đW into dE. Because we have constant pressure in the system, we can commute the differential operator and get


(Eq’n 22)

in which we define


(Eq’n 23)

the enthalpy (Greek - en + thalpein (to warm)). Combining that definition with Equation 5 gives us

(Eq’n 24)

The minimizing principle associated with the enthalpy states:

    A thermodynamic system in contact with a pressure reservoir so evolves that at equilibrium its unconstrained internal parameters attain values that minimize the enthalpy for a given value of the pressure in the system.

We conceive the enthalpy as the system’s potential to do work under constant pressure.

    We use enthalpy in our conceptual analysis of Joule-Thomson throttling. Imagine a thermally insulated pipe connecting a high-pressure reservoir to a low-pressure reservoir and imagine that a porous plug blocks the pipe. Gas can seep through the plug and thus pass from one reservoir to the other. We track a parcel of gas of mass M passing from one reservoir to the other and do so by imagining a piston pushing the parcel through the plug at a high pressure p1 and the parcel coming through the plug and pushing a second piston at the lower pressure p2. The first piston does an amount of work p1V1 on the parcel as the gas passes through the plug and the parcel does an amount of work p2V2 on the second piston. The parcel then ends up containing internal energy in the amount


(Eq’n 25)

which tells us that


(Eq’n 26)

in words, that the enthalpy of the gas in the parcel does not change.

    We can also understand enthalpy as the energy that we must apply to establish a system inside a pressure reservoir: the internal energy is needed to establish the system itself and the pV term represents the work that we must do to clear out the volume V so that our system can occupy it.

Gibbs Potential

    Josiah Willard Gibbs (1839 Feb 11 – 1903 Apr 28) added what we also call the Gibbs free energy to the roster of thermodynamic potentials in 1873. The Gibbs function describes the amount of useful work that we can obtain from an isothermal (constant temperature), isobaric (constant pressure) system. Alternatively, we can say that it describes the maximum amount of work that we can obtain from a closed, non-expanding system. Of course, we obtain that maximum only through a reversible process.

If we have a system in which a quantity of heat đQ evolves in the system and the system expands by dV and if we have put that system in contact with a heat reservoir and a pressure reservoir, which act the keep the system’s temperature and pressure constant, then the system’s internal energy does not change. We have đQ=TdS and đW = -pdV and we have the increment in the internal energy dE’=dE, so


(Eq’n 27)

in which đQ and đW get absorbed into the internal energy. Because both the temperature and pressure in the system remain constant we can commute the differential operator and we get


(Eq’n 28)

Thus we have the Legendre transform that trades dT for dS and dp for dV,


(Eq’n 29)

which means that we have, when we put the chemical potentials and replace the internal energy from Equation 5,

(Eq’n 30)

The minimizing principle associated with the Gibbs potential states:

    A thermodynamic system in contact with a pressure reservoir and a heat reservoir so evolves that at equilibrium its unconstrained internal parameters attain values that minimize the Gibbs potential for given values of the pressure and absolute temperature in the system.

We conceive the Gibbs potential as the system’s potential to do work under constant temperature and pressure.

    Gibbs himself called the potential "available energy" and defined it as

"The greatest amount of mechanical work which can be obtained from a given quantity of a certain substance in a given initial state, without increasing its total volume or allowing heat to pass to or from external bodies, except such as at the close of the processes are left in their initial condition."

    Because we want to look at systems whose temperature and pressure do not change, we may want to consider other sources of energy that may contribute to a thermodynamic system and thereby add terms to the right side of Equation 30. If we have an elastic system (e.g. rubber-band motors) that shortens by a distance -dl under a force f, then we would add đW=fdl to the Gibbs potential. And if we have a system into which we put an increment of electric charge dq at the electrostatic potential φ, then we must add đW=φdq to the Gibbs potential. That latter contribution gives us the basis for calculations involving electrolysis or involving electrosynthesis, as in fuel cells.

    Consider first the electrolysis of water. For analysis we generally consider the process applied to one mole (18 grams) of liquid water under standard chemistry lab conditions, in which the process occurs in contact with Earth’s atmosphere, which acts as both a heat reservoir (at a constant absolute temperature of 298 Kelvin) and a pressure reservoir (at a constant pressure of 101,300 Pascals = 1013 millibars). Under those conditions we use an electric current to carry the energy necessary to convert one mole of liquid water into one mole of gaseous hydrogen and one half mole of gaseous oxygen. The change in the internal energy of the system, the energy that we must supply to take the water molecules apart, works out to 282.1 kiloJoules.

    But the electrolysis of water under the conditions given does not actually take 282.1 kiloJoules of energy. In the process the entropy of the system increases, which, at the given temperature, necessitates the absorption of heat from the environment. Likewise, the change of the system from liquid to gas at the given pressure does work that must come from the electric current. Thus the energy that the electric current must supply to the system coincides with the Gibbs free energy.

    Under the given conditions the change in the system’s entropy corresponds to an energy of 48.7 kiloJoules per mole, which we can subtract from the energy necessary to break the chemical bonds. But then we must add the energy necessary to do the work of gaseous expansion,

(101,300 Pa)(1.5 moles)(0.0224 Meter3/mole)(298K/273K)=3.715 kiloJoules.

The Gibbs free energy then comes to

ΔG=282.1 kJ+3.72 kJ-48.7 kJ=237.1 kJ.

    We can, of course, reverse that process in a fuel cell. In that case the Gibbs free energy denumerates what we get out of the device when we put hydrogen gas and oxygen gas into it and get liquid water out. But in this process of converting two gases into a liquid we must diminish the entropy of the system, so, in order that the system satisfy the Second Law of Thermodynamics, some of the energy coming into the system with the gases must get released as heat in an amount corresponding to the diminution of the entropy of the system. That fact necessitates that the energy coming into the fuel cell with the gases corresponds to the enthalpy carried by one mole of hydrogen and one half mole of oxygen, which enthalpy equals 285.83 kilojoules. With that figure we can calculate the theoretical efficiency of a fuel cell: the efficiency simply equals the ratio of the useful energy coming out of the device to the energy going into the device, the ratio of the Gibbs free energy to the enthalpy;


Even an efficiency substantially less than that 83% justifies using fuel cells rather than burning the hydrogen in a Carnot-type heat engine.

    Henceforth this topic will lead us out of physics and into the realms of chemistry and engineering. I will leave the exploration of those realms to others and continue to expand the Map of Physics as far as I can.

Appendix: Legendre Transforms

    We usually find these in classical thermodynamics, where physicists use them to convert the basic description of a thermodynamic system’s internal energy into the enthalpy and the Helmholtz and Gibbs free energies, which express the energy available to do work when some variables in the system can change and others cannot. The name of the transformation comes from Adrien-Marie Legendre (1752 Sep 18 – 1833 Jan 10), the French mathematician who devised it. In dynamics we use a Legendre transformation to go from the Lagrangian to the Hamiltonian formulation of classical mechanics.

    Mathematicians often find it desirable to express a function of some variable, f(x), as a different function, one that uses the derivative of f(x) with respect to x as its argument. If we define p=df/dx as the argument of the new function, then we write the new function as g(p) and call it the Legendre transform of the original function. We define the Legendre transform g(p) of the function f(x) as follows:

(Eq’n A-1)

In that equation the notation maxx denotes the fact that we must maximize the expression in the parentheses with respect to x while holding p constant. We determine the criterion that we must satisfy in order to achieve that maximization by setting the derivative of the expression with respect to x equal to zero;

(Eq’n A-2)

We see that we have maximized the expression already when we defined p as the derivative of f(x) with respect to x. We know that we have achieved a maximum because we can see that the second derivative of the expression with respect to x yields a negative number. However, we must take note that we have a well-behaved Legendre transform if and only if f(x) represents a convex function.

    Reference to the function as convex implies a geometric interpretation that we can extend to the Legendre transformation itself. Putting it a little too simply, we call a function convex if it has a positive second derivative. We have two ways in which we can plot a function as a curve on a graph; we can draw it as a set of points (the usual way of doing it) or we can draw it as the envelope of a set of straight lines, the set of tangents to the curve. In the first way we simply calculate the y-coordinate of the curve through a function that correlates it with the corresponding x-coordinate: y=f(x). Through that relationship we can assert enough values of x to calculate enough points (x, y) to reveal the curve. We base the second way of drawing the curve upon the fact that for a straight line with a slope m=dy/dx and y-intercept b we have the equation y=mx+b (note that this description gives us a point-by-point description of the line). We want a straight line to represent a tangent to the curve at the point (xi, f(xi)), so we write the straight-line equation as

(Eq’n A-3)

That has the form of a Legendre transformation, as we can see when we recall the definition of m. We can then invert the equation, determining the y-intercept for a given slope and reforming the equation as a function of the slope.

    Of course, if we apply the transformation to the same curve twice we get the original description of the curve, so we recognize that the Legendre transform acts as its own inverse. Like the familiar Fourier transform, the Legendre transform takes a function of a coordinate, f(x), and converts it into a function of a different variable, g(p). However, while the Fourier transform consists of an integration with a kernel, the Legendre transform takes a simpler algebraic approach and uses maximization as the transformation procedure.

    We can generalize the Legendre transformation to the mathematical process of convex conjugation, also known as the Legendre-Fenchel transformation. Physicists commonly use it in thermodynamics and in the Hamiltonian formulation of classical mechanics.

    In thermodynamics we use the Legendre transformation to convert our basic description of the internal energy of a system into descriptions of the various kinds of free energy that come available when we change the properties of the system that we can change. This fact tells us that the Legendre transformation is no mere mathematical sleight of hand; it has real consequences when we apply it to our description of Reality.

    In classical dynamics we use the Legendre transformation to convert the Lagrangian function into the Hamiltonian function.


Back to Contents