Maxwell’s Relations (Part 1)

The Maxwell relations are equations that show up whenever we have a smooth convex function

U \colon \mathbb{R}^n \to \mathbb{R}

They say that the mixed partial derivatives of U commute, but also that the mixed partial derivatives of various functions constructed from U commute. So in a sense they are completely trivial except for the way we construct these various functions! Nonetheless they are very important in physics, because they give generally valid relations between the derivatives of thermodynamically interesting quantities.

For example, here is one of the Maxwell relations that people often use when studying a thermodynamic system like a cylinder of gas or a beaker of liquid:

\displaystyle{  \left. \frac{\partial T}{\partial V} \right|_S \; = \; - \left. \frac{\partial P}{\partial S} \right|_V }


S is the entropy of the system
T is its temperature
V is its volume
P is its pressure

There are also three more Maxwell relations involving these quantities. They all have the same general look, though half contain minus signs and half don’t. So, they’re quite tiresome to memorize. It’s more interesting to figure out what’s really going on here!

I already gave one story about what’s going on: we start with a function U, which happens in this case to be a function of S and V called the internal energy of our system. If we say its mixed partial derivatives commute:

\displaystyle{ \frac{\partial^2 U}{\partial V \partial S} = \frac{\partial^2 U}{\partial S \partial V}   }

we get the Maxwell relation I wrote above, simply by using the standard definitions of T and P as partial derivatives of U. We can then build a bunch of other functions from U, S, T, V and P, and write down other equations saying that the mixed partial derivatives of these functions commute. This gives us all the Maxwell relations.

Let me show you in detail how this works, but without explaining why I’m choosing the particular ‘bunch of other functions’ that I’ll use. There is a way to explain that using the concept of Legendre transform. But next time I’ll give a very different approach to the Maxwell relations, based on this paper:

• David J. Ritchie, A simple method for deriving Maxwell’s relations, American Journal of Physics 36 (1958), 760–760.

This sidesteps the whole business of choosing a ‘bunch of other functions’, and I think it’s very nice.

What follows is a bit mind-numbing, so let me tell you what to pay attention to. I’ll do the same general sort of calculation four times, first starting with any convex smooth function U \colon \mathbb{R}^2 \to \mathbb{R} and then with three other functions built from that one. The only clever part is how we choose those other functions.

The first relation

We start with any smooth convex function U of two real variables S, V and write its differential as follows:

dU = T dS - P d V

This says

\displaystyle{ T =  \left.\frac{\partial U}{\partial S} \right|_V  \qquad    P = - \left. \frac{\partial U}{\partial V} \right|_S }

These are the usual definitions of the temperature T and pressure P in terms of the internal energy U, but you don’t need to know anything about those concepts to follow all the calculations to come. In particular, from the pure mathematical viewpoint the minus sign is merely a stupid convention.

The commuting of mixed partials implies

\displaystyle{  \left. \frac{\partial T}{\partial V} \right|_S \; = \;  \left. \frac{\partial}{\partial V} \right|_S \left. \frac{\partial }{\partial S} \right|_V U \; = \;  \left. \frac{\partial }{\partial S} \right|_V \left. \frac{\partial}{\partial V} \right|_S  U \; = \;  - \left. \frac{\partial P}{\partial S} \right|_V }

giving the first of the Maxwell relations:

\boxed{ \displaystyle{  \left. \frac{\partial T}{\partial V} \right|_S \; = \; - \left. \frac{\partial P}{\partial S} \right|_V } }

The second relation

Next, let’s define the Helmholtz free energy

F = U - TS

Taking its differential we get

\begin{array}{ccl}  dF &=& dU - d(TS) \\ \\ &=& (T dS - P dV) - (SdT + TdS) \\ \\  &=& - S dT - P d V  \end{array}

so if we think of F as a function of T, V we get

\displaystyle{ S =  - \left.\frac{\partial F}{\partial T} \right|_V  \qquad    P = - \left. \frac{\partial F}{\partial V} \right|_T }

The commuting of mixed partials implies

\displaystyle{  \left. - \frac{\partial S}{\partial V} \right|_T \; = \;  \left. \frac{\partial}{\partial V} \right|_T \left. \frac{\partial }{\partial T} \right|_V F \; = \;  \left. \frac{\partial }{\partial T} \right|_V \left. \frac{\partial}{\partial V} \right|_T  F \; = \;  - \left. \frac{\partial P}{\partial T} \right|_V }

giving the second of the Maxwell relations:

\boxed{ \displaystyle{ \left. \frac{\partial S}{\partial V} \right|_T \; = \;  \left. \frac{\partial P}{\partial T} \right|_V } }

The third relation

Copying what we did to get the second relation, let’s define the enthalpy

H = U + P V

Taking its differential we get

\begin{array}{ccl}  dH &=& dU + d(PV) \\ \\ &=& (T dS - P dV) + (VdP + P dV) \\ \\  &=& T dS + V dP  \end{array}

so if we think of H as a function of S, P we get

\displaystyle{ T =  \left.\frac{\partial H}{\partial S} \right|_P  \qquad  V = \left. \frac{\partial H}{\partial P} \right|_S }

The commuting of mixed partials implies

\displaystyle{  \left. \frac{\partial T}{\partial P} \right|_S \; = \;  \left. \frac{\partial}{\partial P} \right|_S \left. \frac{\partial }{\partial S} \right|_P H \; = \;  \left. \frac{\partial }{\partial S} \right|_P \left. \frac{\partial}{\partial P} \right|_S  H \; = \;  \left. \frac{\partial V}{\partial S} \right|_P }

giving the third of the Maxwell relations:

\boxed{ \displaystyle{ \left. \frac{\partial T}{\partial P} \right|_S  \; = \;  \left. \frac{\partial V}{\partial S} \right|_P }}

The fourth relation

Combining the last two tricks, let’s define the Gibbs free energy

G = U + PV - TS

Taking its differential we get

\begin{array}{ccl}  dG &=& dU + d(PV) - d(TS) \\ \\ &=& (T dS - P dV) + (VdP + P dV) - (SdT + TdS) \\ \\  &=& V d P - S dT  \end{array}

so if we think of G as a function of P, T we get

\displaystyle{ V =  \left.\frac{\partial G}{\partial P} \right|_T  \qquad S = -\left. \frac{\partial G}{\partial T} \right|_P }

The commuting of mixed partials implies

\displaystyle{  \left. \frac{\partial V}{\partial T} \right|_P \; = \;  \left. \frac{\partial}{\partial T} \right|_P \left. \frac{\partial }{\partial P} \right|_T G \; = \;  \left. \frac{\partial }{\partial P} \right|_T \left. \frac{\partial}{\partial T} \right|_P  G \; = \;  - \left. \frac{\partial S}{\partial P} \right|_T }

giving the fourth and final Maxwell relation:

\boxed{ \displaystyle{ \left. \frac{\partial V}{\partial T} \right|_P \; = \; - \left. \frac{\partial S}{\partial P} \right|_T }}


I hope you’re a bit unsatisfied, for two main reasons.

The first question you should have is this: why did we chose these four functions to work with:

U, \; U - ST, \; U + PV, \; U - ST + PV

The pattern of signs is not really significant here: if we hadn’t followed tradition and stuck a minus sign in our definition of P here:

\displaystyle{ T =  \left.\frac{\partial U}{\partial S} \right|_V  \qquad    P = - \left. \frac{\partial U}{\partial V} \right|_S }

everything would look more systematic, and we’d use these four functions:

U, \; U - ST, \; U - PV, \; U - ST - PV

This would make it easier to guess how everything works if instead of a function U \colon \mathbb{R}^2 \to \mathbb{R} we started with a function U \colon \mathbb{R}^n \to \mathbb{R}. We could write this as

U(q^1, \dots, q^n)

and define a bunch of functions

\displaystyle{ p_i = \frac{\partial U}{\partial q^i} }

called ‘conjugate quantities’.

Then, we could get 2^n different functions by starting with U and subtracting off products of the form p_i q^i where i ranges over some subset of \{1, \dots, n\}.

Then we could take mixed partial derivatives of these functions, note that the mixed partial derivatives commute, and get a bunch of Maxwell relations — maybe

\displaystyle{ 2^n \frac{n(n-1)}{2} }

of them! (Sanity check: when n is 2 this is indeed 4.)

The second question you should have is: how did I sneakily switch from thinking of U as a function of S and V to thinking of F as a function of T and V, and so on? How could I get away with this? I believe the answer to this involves the concept of Legendre transform, which works well when U is convex.

Answering these questions well might get us into a bit of contact geometry. That would be nice. But instead of answering these questions next time, I’ll talk about Ritchie’s approach to deriving Maxwell’s equations, which seems to sidestep the two questions I just raised!

Just for fun

Finally: students of thermodynamics are often forced to memorize the Maxwell relations. They sometimes use the thermodynamic square:

where for some idiotic reason the p for pressure is written lower-case—perhaps so you can mix it up with momentum!

If you like puzzles, maybe you can figure out how the thermodynamic square works if you stare at it along with the four Maxwell equations I derived:

\displaystyle{  \left. \frac{\partial T}{\partial V} \right|_S \; \phantom{-} = \; - \left. \frac{\partial P}{\partial S} \right|_V }

\displaystyle{ \left. \frac{\partial S}{\partial V} \right|_T \; \phantom{-} = \; \phantom{-} \left. \frac{\partial P}{\partial T} \right|_V }

\displaystyle{ \left. \frac{\partial T}{\partial P} \right|_S  \; \phantom{-} = \; \phantom{-} \left. \frac{\partial V}{\partial S} \right|_P }

\displaystyle{ \left. \frac{\partial V}{\partial T} \right|_P \; \phantom{-} = \; - \left. \frac{\partial S}{\partial P} \right|_T }

Again, it probably be easier if we hadn’t stuck a minus sign into the definition of pressure. If you get stuck, click on the link.

Unfortunately the thermodynamic square is itself so hard to memorize that students resort to a mnemonic for that! Sometimes they say “Good Physicists Have Studied Under Very Fine Teachers” which gives the letters “GPHSUVFT” that you see as you go around the square.

I will never try to remember any of these mnemonics. But I wonder if there’s something deeper going on here. So:

Puzzle. How does the thermodynamic square generalize if U is a function of 3 variables instead of 2? How about more variables?

Part 1: a proof of Maxwell’s relations using commuting partial derivatives.

Part 2: a proof of Maxwell’s relations using 2-forms.

Part 3: the physical meaning of Maxwell’s relations, and their formulation in terms of symplectic geometry.

For how Maxwell’s relations are connected to Hamilton’s equations, see this post:

Classical mechanics versus thermodynamics.

17 Responses to Maxwell’s Relations (Part 1)

  1. Tom Holroyd says:

    What’s the technical term for negative pressure? Suction?

    • John Baez says:

      I don’t know if there is an official technical term. Maybe it’s “tension”.

      If the cosmological constant works the way we think, empty space has a slight negative pressure. People call it “dark energy” but some physicists think “invisible tension” would be more accurate. Or you could just say the universe sucks.

      • Toby Bartels says:

        I usually see ‘tension’ measured in units of force. There's ‘tensile stress’ or ‘tensile strength’, measured in units of pressure, but this is usually not a simple measure of negative pressure but the maximum amount of negative pressure that an object can withstand before being torn apart.

    • Scott says:

      Copied from my comment on part 2:

      Of course, not all situations involve simple hydrostatic pressure; some require a full stress tensor and instead of -p dV one has something like \sigma_{i j} \eta_{i j} (where hydrostatic pressure is the special case \sigma_{i j} =-p \delta_{i j}). Notation tends to vary between linear elasticity theory, fluid dynamics, and other fields where the stress and deformation tensors appear.

      • John Baez says:

        Yes, in Parts 1 and 2 I study Maxwell’s relations for any smooth function of 2 variables

        f \colon \mathbb{R}^2 \to \mathbb{R}

        (I call this function U but it can be anything.) Then in Part 3 I jump from the 2-variable case to the n-variable case. With a bit more sophisticated math we could study the case of

        f \colon L \to \mathbb{R}

        where L is an infinite-dimensional vector space or infinite-dimensional manifold. The key ideas are very general.

  2. Joseph Rizcallah says:

    To get from U to the other potentials one need not know about the potentials in advance but rather simply extract complete differentials (exact 1-forms) from the right-hand side. For example, to get dF one extracts d(TS), i.e. we write dU as dU = d(TS) - SdT - PdV and move the term d(TS) to the left-hand side to get the complete differential d(U - TS). Extracting d(PV) separately or together with d(TS) lead to the other two potentials.

    • John Baez says:

      Thanks. Yes, one can find the potentials this way. In this series of posts I was heading toward a proof of Maxwell’s relations that doesn’t involve these potentials, so I was emphasizing—a bit unfairly—how annoying they can be. But they are interesting and important in their own right, along with the theory of Legendre transforms.

  3. amarashiki says:

    I can only say: It is a wonderful post, just like the 2 other in this series! Congratulations John! Your legacy as blogger, teacher of mathematics, and other stuff is going to last forever (if a meteorite or catastrophe don’t annihilate our world! I’m beginning to think that the solution to the Fermi paradox is that intelligent species has really a short time to develop interstellar skills but I can be wrong! The Great Filter is upon us!)

    • John Baez says:

      Thanks! I don’t think anything lasts forever—it’s strange how we wish things would.

      • amarashiki says:

        Well, obviously as a physicist myself I would say…At least longer than the lifetime of the proton!
        By the way, do you think a 3-variable or n-variable Poisson-like variant (maybe Nambu mechanics) could be possible? As an undergraduated, when reading about Nambu mechanics in the library, I wondered if someone had considered something like dx\wedge dp\wedge dF and a generalized thermodynamics using 3-forms or n-forms. Another issue I wondered in those times was if there is any other form of thermodynamics possible (now I know the answer is yes, as there is Tsallis, Renyi and other types of thermostatistics!). Do you know if there is any about that? Blender and Nevir just formulated fluid dynamics using a Nambu form. And I think another guy even formulated electromagnetism as a Nambu-type fluid! I google it and checked it in my database of articles: Worth reading yet! If any reader knows about any other n-ary works about fluid thermodynamics or alike I would be pleased to read them all.

  4. amarashiki says:

    The intuitive argument in favor of Nambu-like dynamics is the presence of a chemical potentiatl and other charges/potentials in the first principle, e.g.:
    dU=pdV-TdS+\mu dN or dU=pdV-TdS+\mu dN+\sum_i \lambda_idQ_i. Then, one would expect something like
    \omega = dp\wedge dT\wedge d\mu \wedge d\lambda_i and its dual form \overline{\omega}=dV\wedge dS\wedge dN\wedge dQ_i to be invariant forms similar to the 2-form in common thermodynamics. What do you think?

    • Toby Bartels says:

      In the simple case considered in this article, we don't have \mathrm d p \wedge \mathrm d T or \mathrm d V \wedge \mathrm d S; we have \mathrm d T \wedge \mathrm d S and \mathrm d p \wedge \mathrm d V (added together with a minus sign). So this just looks like moving from 2 variables to n variables but still with a 2-form: \omega = \mathrm d T \wedge \mathrm d S - \mathrm d p \wedge \mathrm d V - \mathrm d \mu \wedge \mathrm d N - \sum_i \mathrm d \lambda_i \wedge \mathrm d Q_i.

      • amarashiki says:

        Yes Tony, I realized I wrote the WRONG variable in the 2-form, but I can not edit my posts here :(. My mistake…
        With respect to n-ary Thermodynamics I was watching some papers yesterday about geometric thermodynamics in black holes and/or fluid dynamics in which there are some Nambu formulations! However, I am not sure I understand the formulation of Nambu dynamics and the fundamental identity when quantized. If my memory doesn’t fail, there are some algebras by Filipov (or a guy with similar name) which studied n-ary algebras in Nambu-like style, but I have not read Nambu dynamics papers for a while. Perhaps, it’s time to read about Nambu mechanics again. Even more, I found out that there is a dissipative version of classical mechanics combining the metric and a Poisson bracket structure, something called metriplectic dynamics. I am not sure of what is the capability of that mechanics but I will also reseach on it…

      • John Baez says:

        When we go to more variables in thermodynamics we still get a cotangent bundle equipped with the usual 2-form, which is a symplectic structure, and the submanifold of thermodynamic states is a Lagrangian submanifold. This is sort of ‘well-known’, though people often phrase the idea using contact geometry instead of symplectic geometry, and it’s not incredibly easy to find a clear account of all this. You can read a tiny bit more about near the very end here:

        Classical mechanics versus thermodynamics.

        where I discuss the case where we keep track of particle number (for just one kind of particle) and the chemical potential. Near the end here:

        Maxwell’s relations (part 3).

        I describe the math in the general case, but not specific examples from thermodynamics.

  5. Maxwell Relations are commonly known as a set of four partial differential equations between four thermodynamic quantities or potentials: pressure (P), volume (V), temperature (T), and entropy (S).


You can use Markdown or HTML in your comments. You can also use LaTeX, like this: $latex E = m c^2 $. The word 'latex' comes right after the first dollar sign, with a space after it.

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.