# Clarifying the definition of pressure in statistical physics

I am studying David Tong's lecture note on statistical physics, and I have a question regarding the precise definition of pressure. I checked other postings in this community, but was unable to get the answer. Also, apologies for this absurdly long question.

If you feel this question is too long, I guess you can jump directly to $$\eqref{e:7}$$ and only read the relevant equations.

1. Tong first discusses microcanonical ensemble, a system of fixed energy $$E$$ in a variable volume $$V$$. There, he defines the pressure as

$$P = T \frac{\partial S}{\partial V}. \tag{1}\label{e:1}$$

This relation is then used to derive the relation

$$\mathrm{d}E = T \, \mathrm{d}S - P \, \mathrm{d}V,$$

which I envision as differential of $$E$$ when $$E$$ is understood as a function of $$S$$ and $$V$$. Here, my mental picture is that the physical consideration in this context gives rise to a constraint among $$T$$, $$S$$, $$V$$, which in turn defines a 2-dimensional manifold (or foliation). The above relation then implicitly specifies this manifold. So far, everything sounds good.

2. Then Tong moves on to canonical ensemble, where we shift gear to reformulating entropy and related quantities in terms of the Boltzmann distribution. Some of the consequences are the relations

$$\langle E \rangle - TS = -k_B T \log \mathcal{Z} \qquad\text{and}\qquad S = k_B \frac{\partial}{\partial T}(T \log \mathcal{Z}), \tag{2}\label{e:2}$$

where $$\langle E \rangle$$ is the average energy of the system and $$\mathcal{Z}$$ is the partition function. (The two relations are actually equivalent.) Since this quantity is so important, we denote this quantity by $$F$$ and call it the (Helmholtz) free energy.

Now, again, let us allow the volume $$V$$ of the system to vary. Then Tong claims that we have

$$\mathrm{d}F = -S \, \mathrm{d}T - P \, \mathrm{d} V. \tag{3}\label{e:3}$$

However, I failed to derive this formula using the definition $$\eqref{e:1}$$. Again, I envision that physical constraints on $$T$$, $$S$$, $$V$$ defines a 2-dim manifold. So, any physical quantity that depends on these there variables can be expressed (at least locally) as a function of any two of them.

Now, in order to derive $$\eqref{e:3}$$, I first noticed that the following relations hold:

• The specific heat satisfies $$T \frac{\partial S}{\partial T} = \frac{\partial(TS)}{\partial T} - S \stackrel{\eqref{e:2}}= \frac{\partial}{\partial T}(\langle E \rangle + k_B T \log \mathcal{Z}) - S \stackrel{\eqref{e:2}}= \frac{\partial\langle E\rangle}{\partial T}. \tag{4}\label{e:4}$$

• Regarding $$S$$ as a function of $$T$$ and $$V$$, $$T \, \mathrm{d}S = T \biggl( \frac{\partial S}{\partial T} \, \mathrm{d}T + \frac{\partial S}{\partial V} \, \mathrm{d}V \biggr) \stackrel{\eqref{e:4}}= \frac{\partial \langle E\rangle}{\partial T} \, \mathrm{d}T + T \frac{\partial S}{\partial V} \, \mathrm{d}V \tag{5}\label{e:5}$$

• Then, starting from the definition $$F = \langle E \rangle - TS$$ and regarding everything as a function of $$T$$ and $$V$$, \begin{align*} \mathrm{d}F &= \mathrm{d}\langle E\rangle - \mathrm{d}(TS) \\ &= \biggl( \frac{\partial \langle E\rangle}{\partial T} \, \mathrm{d}T + \frac{\partial \langle E\rangle}{\partial V} \, \mathrm{d}V \biggr) - T \, \mathrm{d}S - S \, \mathrm{d}T \\ &\stackrel{\eqref{e:5}}= \biggl( -T \frac{\partial S}{\partial V} + \frac{\partial \langle E\rangle}{\partial V} \biggr) \, \mathrm{d}V - S \, \mathrm{d}T. \tag{6}\label{e:6} \end{align*}

Finally, comparing $$\eqref{e:6}$$ and $$\eqref{e:3}$$, Tong seems suggesting that the pressure $$P$$ is given by

$$P = T \frac{\partial S}{\partial V} - \frac{\partial \langle E\rangle}{\partial V}, \tag{7}\label{e:7}$$

which clearly does not match the original definition $$\eqref{e:1}$$ unless $$\frac{\partial \langle E\rangle}{\partial V} = 0$$. So here goes my question:

Question. Why do we have the discrepancy between $$\eqref{e:1}$$ and $$\eqref{e:7}$$?

I have checked the following posts in this community,

but none of them resolved my question. I guess the most relevant one is the last link, in which a statement says that the pressure is actually defined as $$P = - \frac{\partial F}{\partial V}$$. So it seems like we are actually revising the definition of the pressure so that the formula

$$\mathrm{d}\langle E \rangle = T \, \mathrm{d}S - P \, \mathrm{d} V$$

continues to hold in a canonical ensemble, but I am not sure if I am correctly interpreting this or I am simply missing some details.

To give you some idea about my background knowledge, I majored in mathematics specialized in probability theory but only tangentially studied physics in my undergraduate. I am now trying to study statistical mechanics as a hobby and to paint some more insight on the mathematical models motivated from statistical mechanics.

• First one is at $E$ fixed since you are in the microcanonical ensemble. Second one is at $T$ fixed. It does not make sense to do so (you really have to derive the formula by hand as you just did!),but an intuitive argument to understand the difference is the following: in the microcanonical ensemble $E$ and $V$ are independent variables. Thus you might see why it does not appear in the pressure computation as it does in the canonical ensemble where $E(T, V, N)$. Commented May 27 at 21:41
• In equation 1, the pressure must be defined as $P = T\frac{\partial S}{\partial V} |_E$. Since $E$ is held constant in the partial derivative, its derivative with respect to $V$ must be zero, as you wrote below Eq. 7: which clearly does not match the original definition (1) unless ∂⟨E⟩/∂V=0. Commented May 27 at 22:11
• @Syrocco, Archisman Panigrahi, Thank you! I often forget to interpret each mathematical variable/operation in the context of the corresponding physical system (such as, fixing $T$ in the canonical ensemble means we are adjoining the given system to a heat reservoir, and then perhaps changing $T$ in this context means we are heating up/cooling down the combined system, etc.). Commented May 28 at 4:00

As Sirocco commented, you need to be careful with which are your two reference variables. Actually, your question has little to do with statistical mechanics, but more about classical thermodynamics. $$F$$ and $$U$$ (what you call $$E$$, $$U$$ is more common for internal energy) are related by a Legendre transform: $$dU = TdS-PdV \\ F = U-ST \\ dF = -TdS-PdV$$ where the first equation is defines $$T$$ and $$p$$ as: $$T = \left(\frac{\partial U}{\partial S}\right)_V \quad P = -\left(\frac{\partial U}{\partial V}\right)_S$$ and the second equation is the definition of $$F$$ and the third equation follows from the first two by taking the differential of the second one and injecting the first one.
There is no discrepancy with equation (7). Indeed, more explicitly, (7) states: $$P = T\left(\frac{\partial S}{\partial V}\right)_P-\left(\frac{\partial U}{\partial V}\right)_P$$ which compatible with (1) using the chain rule. In general, it is more convenient to think in terms of differential in thermodynamics and stick to a set of reference variables. You can look into the Maxwell relations for similar gymnastics.
In statistical mechanics, the reasoning is similar, only instead of using $$U$$ and $$F$$, it is more natural to think in terms of $$S$$ and $$\beta F$$ (with $$\beta = 1/T$$ with $$k_B = 1$$, Massieu function). In this case, the previous expressions are equivalent to: $$dS = \beta dU+\beta PdV \\ \beta F = \beta U-S \\ d(\beta F) = Ud\beta-\beta PdV$$
• Thank you so much for the answer! I actually thought statistical mechanics is a synonym for the thermodynamics, which obviously turned out to be not the case. Also, thank you for confirming that there is no discrepancy. Tong's lecture note originally defined $P$ as $T\frac{\partial S}{\partial V}$ in the context of microcanonical ensemble, and the it suddenly said that $\mathrm{d}U = T\,\mathrm{d}S-P\,\mathrm{d}V$ holds without explaining $P$ has to be redefined in order to satisfy this relation. Now that everyone confirms this relation is the starting point (definition) for $P$, I am happy! Commented May 28 at 4:08