# Changing Between Thermodynamic Ensembles

For the sake of example, consider the formula for isotropic compressibility.

$$\kappa = -\frac{1}{V} \left(\frac{\partial V}{\partial P}\right)_{N,T}$$

This formula is expressed as a function of $N,P,T$, in other words in the $NPT$ (Isothermal-Isobaric) ensemble.

Now, I wish to express this quantity in a different ensemble, such as the $\mu V T$ (Grand Canonical) ensemble. I've always found this procedure to be messy and mostly guesswork, mainly trial and error with the triple product rule and Maxwell's relations and the chain rule (where convenient).

Is there a clean and systematic way to change variables to the desired ensemble in general?

• Yes, this is what Legendre transforms are for. – lemon Oct 5 '17 at 15:21
• @lemon I'm not sure how you can use Legendre transforms to do this conversion directly. Of course, one can use Legendre transformations to derive things like Maxwell's relations, but using Maxwell's relations seems more like guesswork to me and less than systematic. – Aaron Oct 5 '17 at 15:44
• I edited my answer to add more details. Hope the new version is clearer. – higgsss Oct 12 '17 at 8:04

Given a two-variable function $f(x,y)$ and its Legendre transform $g(x,f_y) = f - yf_y$ , there exists a simple identity between second-order partial derivatives of $f$ and $g$:

\begin{equation} g_{xx} - f_{xx} = - \frac{f_{xy}^2}{f_{yy}} = \frac{g_{x f_y}^2}{g_{f_y f_y}}. \end{equation}

Taking $f$ to be the Helmholtz free energy $F(T, V, N)$, and $g$ to be the Landau free energy $\Omega(T, V, \mu) = F - \mu N$ (Legendre transform of $F$ w.r.t. $N$), one obtains \begin{equation} \Omega_{VV} - F_{VV} = - \frac{F_{VN}^2}{F_{NN}} = \frac{\Omega_{V\mu}^2}{\Omega_{\mu\mu}}, \end{equation} from which an expression for the difference of the following two quantities can be derived: \begin{equation} \kappa_{NVT}^{-1} := -V \left(\frac{\partial P}{\partial V}\right)_{N,T} = V F_{VV}, \end{equation} \begin{equation} \kappa_{\mu VT}^{-1} := -V \left(\frac{\partial P}{\partial V}\right)_{\mu,T} = V \Omega_{VV}. \end{equation}

(Although OP considered $\kappa$ in the $NPT$ ensemble, the $NVT$ ensemble leads to the same quantity as well.)

Also, by setting $f = F(T,V,N)$, $g = G(T,P,N)$ (i.e., Gibbs free energy), $x = T$, $y = V$, and $f_y = -P$, one can derive the relation \begin{equation} C_P - C_V = T(-G_{TT} + F_{TT}) = \frac{VT\alpha^2}{\kappa}, \end{equation} where $\alpha = \frac{1}{V}\left(\frac{\partial V}{\partial T}\right)_{P,N} = G_{PT}/V$ and $\kappa = - \frac{1}{V}\left(\frac{\partial V}{\partial P}\right)_{T,N} = - G_{PP}/V$.

Proof of the identity:

Consider a twice-differentiable function $f(x,y)$ and its Legendre transform w.r.t. $y$:1 \begin{equation} g(x,f_y) := f(x,y) - f_yy. \end{equation} (Here, it is implicitly assumed that $y$ is expressed as a function of $x$ and $f_y$.) Notice that \begin{equation} \tag{1} \label{a} \frac{\partial f}{\partial x} \bigg|_{f_y} = f_x + f_y \frac{\partial y}{\partial x}\bigg|_{f_y} = f_x - f_y \frac{f_{xy}}{f_{yy}}, \end{equation} where the last equality holds due to the triple product rule. We then have \begin{equation} g_x = \frac{\partial f}{\partial x} \bigg|_{f_y} - f_y \frac{\partial y}{\partial x}\bigg|_{f_y} = f_x, \end{equation} from which it follows that \begin{equation} g_{xx} = \frac{\partial f_x}{\partial x} \bigg|_{f_y} = f_{xx} - \frac{f_{xy}^2}{f_{yy}}. \end{equation} Here, the last equality is simply Eq. (\ref{a}) with $f$ replaced by $f_x$. Noting that Legendre transformation of $g$ w.r.t. $f_y$ gives $f$, one can exchange the role of $f$ and $g$ on the above, which leads to \begin{equation} f_{xx} = g_{xx} - \frac{g_{xf_y}^2}{g_{f_yf_y}}. \end{equation}

1 $f$ must be either a convex or a concave function of $y$ for the Legendre transformation to be well-defined.

To make it short and systematic: The way you ask the question, there isn't a general method for "any change of variables to express the same observable". It is important that you know what exactly you want: The way you describe it, you want to know the same observable, but expressed in different variables. The way you formulate it, you still want $\frac{\partial V(p, N, T)}{\partial p}$, but you want this observable number as a function of $\mu$, V, and T. Think about if this is really want you want to know. In the case it is, "just" express $\tilde{p}(\mu, V, T)$, $\tilde{N}(\mu,V, T)$ and $\tilde{T}(\mu, V, T) = T$, the "old variables", as functions of the new ones, and plug them into the old equation you get for your desired observable.

The theory of thermodynamics makes statements over a set of observables: The entropy S, the energy E, the temperature T, the volume V, the pressure p, the particle number N, and the chemical potential $\mu$ (there are more, but I will restrict myself to these in my discussion). For the variables I described, it follows from thermodynamics that you can choose 3 of them (I won't specify which, not every combination is allowed), so that the others can be expressed as a function of these 3.

For example (just an example), I can choose these variables to be $N$, $V$, and $S$ (this would be a set of 3 independent variables). For this specific combination, every other observable can be expressed as a function of these 3 variables: $E(S,V,N)$, $T(S,V,N)$ and so on. Furthermore, there is an additional structure to the observables, stating that one of the other observables takes the role of some kind of potential (for our choice S V N, the observable that takes this role is the energy E(S,V,N)). Every of the remaining observables can then be computed as a derivative of E:

$$T = \frac{\partial E}{\partial S}$$ and so on. It is crucial to observe that this is the derivative of the specific function E(S,N,V). To explain this in more detail: If you had chosen another combination of variables, for example S, V, $\mu$, you could write down a function $\tilde{E}(S, V, \mu)$ to represent the same observable. For the same state of the system, this observable (which means this function) would have the same value. However, the function $\tilde{E}$ would be another function. To express this more mathematically: Let's say $V_1$, $N_1$ and $S_1$ represent the system in state 1, if you choose $S$, $V$ and $N$ to be the representing variables. If you instead choose the variables $S$, $V$, $\mu$, then the same system (same system state means every observable is equal) state is supposed to be expressed by the variables $V_1$, $\mu_1$ and $S_1$. The combinations to represent equal systems means, for example, that $$\tilde{E}(S_1, V_1, \mu_1) = E(S_1, V_1, N_1)$$ However, since $E$ and $\tilde{E}$ are different mathematical functions, the derivatives will not be equal: $$\frac{\partial \tilde{E}}{\partial V} \neq \frac{\partial E}{\partial V}$$

I hope this answer brought you some insight into the way one handles thermodynamic observables, apart from answering your question. One additional note (which is very important to me!): Changing variables and changing ensembles are two completely different things. You can take an arbitrary ensemble, and describe it with arbitrary (allowed) combinations of variables. You can take for example the canonical ensemble (which statistically is described by the variables $N$, $V$, $T$, with the thermodynamic potential being $F$, the free energy. Although $F$ is the the thermodynamic potential rising from the partition function, other observables can be computed from the derivatives of F (for example, $p = - \frac{\partial F}{\partial V}$, and you are free to perform a Legendre transformation to achieve the internal energy $E$ as a function of $N$, $S$, and $T$.

Long story short: In a given statistical system (whatever ensemble), you are free to choose variables that are appropriate to your calculations. The relations between your observables hold in every ensemble.

However, the total values of your observables will differ from ensemble to ensemble, until you take the thermodynamic limit, in which for a given set of variables (for example $V$, $T$, $S$), every observable will have the same value.

The reason one associates a specific choice of variables with an ensemble (for example $V$, $T$ and $N$ for the canonical ensemble) is that those variables are experimentally accessible in the specified ensemble. In the canonical ensemble, you can change $N$ to a desired value by adding particles. In the grand canonical ensemble, there isn't a fixed number of particles, and you'd have to calculate first which amount of $\mu$ is needed so that the value $N$ will take the value you want.

• This doesn't answer the question. The part where you say it's "just" a matter of expressing old variables as a function of the new, well, that's the whole point of the question! – Javier Oct 9 '17 at 21:02
• Well, this is the clean and systematic way to transit from the old variables to the new variables, for the generality that the question is asked. It would be a whole different story if he for example would not change the variable that his observable is derived after (change from $\frac{\partial V(p,N,T)}{\partial p}$ to $\frac{\partial V (p, \mu, T)}{\partial p}$. But in generality that is asked for, this is the only answer one can give. – Quantumwhisp Oct 9 '17 at 21:12
• You haven't given any clean and systematic method, you've just stated the theory behind the subject. If there's no general method you should just say that instead of teaching OP thermodynamics. – Javier Oct 9 '17 at 21:16
• I have made the experience that anytime I asked questions, I was very happy about additional explanations arround the subject. I will follow your critique and put the "(not clean, but) systematic method" to the front of my answer. Whoever wants can still read all the stuff afterwards (which I think is important to do, especially if one doesn't fully understand what "changing of variables" means exactly. – Quantumwhisp Oct 9 '17 at 21:31