# Question about the definition of the pressure in statistical physics

I learned, that the definition of the pressure in the grand canonical ensemble is $$p=-\langle \frac{\partial H}{\partial V}\rangle=\frac{1}{\beta}(\frac{\partial}{\partial V} \ln\Xi$$. First thing about that I dont understand is, that the Hamiltonian does in general not explicitly depend on the volume, so we would get zero pressure for an photon gas, which is obviously not right. Second thing: When I try to derive an expression for the pressure from the laws of thermodynamics I come to the following: First $$\mathrm{d}U=\delta Q + \delta W$$. Then $$\delta Q=T\mathrm{d}S$$ and $$\delta W=-p\mathrm{d}V$$ plus other terms, but essentially we want the differential of the volume. So when I plug this in and compare with the total differential of $$U$$, I get $$p=-\frac{\partial U}{\partial V}$$. Now, when I take the definition of the energy average at zero chemical potential (which is the case in my purpose) $$U=-\frac{\partial}{\partial \beta}\ln\Xi$$ I get $$p=\frac{\partial}{\partial V}\frac{\partial}{\partial \beta}\ln\Xi$$ which is not exactly what I learned. So what goes wrong in my derivation? Thanks for answers in advance!

• > "the Hamiltonian does in general not explicitly depend on the volume" This is almost certainly incorrect. Which Hamiltonian do you mean? Hamiltonian for particles in a box has to take into account the walls of the box. The motion of the particles will be affected by changing volume of the box, so the appropriate Hamiltonian will be affected as well. Jun 17 '19 at 21:39

The Hamiltonian does depend on the volume either explicitly or through the boundary conditions. For example, for the 1-dimensional infinite square well, we can write the Hamiltonian as $$\frac{p^2}{2m}$$, along with boundary conditions that the wave function goes to zero at the well boundaries, or we can write a Hamiltonian $$\frac{p^2}{2m}+V(x)$$, where $$V(x)$$ is the confining potential that restricts the particle to the volume.

While you can perturb the boundary conditions directly, the usual way to deal with this in 3 dimensions is to imagine a volume of size $$V=L^3$$. Then change variables from $$\vec r_i$$ to $$\vec u_i = \frac{\vec r_i}{L}$$, with conjugate momenta $$\vec p_{ui} = L \vec p_i$$ so that the canonical commutation relations are still fulfilled.

The boundary conditions on $$\vec u_i$$ are now independent of $$L$$, and the $$L$$ dependence of the other terms is displayed. For example, for a free nonrelativistic gas $$\begin{equation} H = \sum_i \frac{p_i^2}{2m} = L^{-2} \sum_i \frac{p_{ui}^2}{2m} \end{equation}$$ and $$\begin{equation} -\frac{\partial}{\partial V} H = -\frac{\partial L}{\partial V} \frac{\partial}{\partial L} H = \frac{2}{3L} \sum_i\frac{p_{ui}^2}{2m} = \frac{2}{3V} H \end{equation}$$ which gives the standard result $$P = \frac{2E}{3V}$$.

For the photon gas, the Hamiltonian is $$\begin{equation} H = \sum_{\vec k \lambda} \hbar k c \left [ N_{\vec k\lambda}+\frac{1}{2}\right] \end{equation}$$ where $$N_{\vec k\lambda}$$ is the number of photons with wave vector $$\vec k$$ and polarization $$\lambda$$. With periodic boundary conditions, $$\vec k =\frac{2\pi}{L} \left [n_x \hat x + n_y \hat y + n_z\hat z\right]$$ with $$n_x$$, $$n_y$$, $$n_z$$ integers. So here the volume dependence is through $$\vec k$$. Taking the derivative as above $$\begin{equation} -\frac{\partial }{\partial V} H = \frac{H}{3V} \end{equation}$$ and we get the standard result for the photon gas $$P = \frac{E}{3V}$$.

Since this is in the grand-canonical ensemble, the derivatives are at constant $$T$$ and $$\mu$$, not constant $$S$$ and $$N$$, so the pressure is not $$-\left . \frac{\partial U}{\partial V} \right |_{\mu T}$$. Thermodynamically $$\ln \Xi = -\beta \Omega$$ where $$\begin{equation} d\Omega = -SdT-pdV-\mu dN \end{equation}$$ and from extensivity $$\Omega(T,V,\mu) = -p(T,\mu) V$$. In any case $$\begin{equation} \left \langle -\frac{\partial H}{\partial V} \right \rangle = -\frac{{\rm tr} e^{-\beta (H(V)-\mu N)} \frac{\partial H(V)}{\partial V}} {{\rm tr} e^{-\beta (H(V)-\mu N)}} = \frac{1}{\beta}\frac{\partial}{\partial V} \ln {\rm tr} e^{-\beta(H(V)-\mu N)} = \frac{1}{\beta} \frac{\partial}{\partial V} \ln \Xi \end{equation}$$ which is not equal to $$\begin{equation} -\frac{\partial}{\partial V} U = -\frac{\partial}{\partial V} \frac{{\rm tr} e^{-\beta (H(V)-\mu N)} H(V)} {{\rm tr} e^{-\beta (H(V)-\mu N)}}\,. \end{equation}$$

There are a couple of things here. First of all, your first equation $$p=-\langle \frac{\partial H}{\partial V}\rangle=\frac{1}{\beta}\frac{\partial}{\partial V} \ln\Xi$$ mixes two things that are better kept separate. The second half of this formula is the definition of pressure in the grand canonical ensmble $$p=\frac{1}{\beta}\frac{\partial}{\partial V} \ln\Xi(T,\mu,V)$$ where I have reinstated the thermodynamic variables. Note that $$\Phi(T,\mu,V)= -\frac{1}{\beta}\log\Xi(T,\mu,V)$$ satisfies $$\Phi(\mu,T,V)=-p(\mu,T)V$$, so the volume dependence is trivial.

The first half is the definition of pressure in the microcanonical ensemble, where we imagine that we are given the Hamiltonian of a gas in a volume $$V$$, $$H(p_i,q_i,V(t))$$, and now we compute the change in energy as the volume is changed. It is a text book excercise to verify that the two expressions are indeed equivalent (see, for example, Sect. 3.4.1 of Sethna).

The second issue is that we have to be more careful in keeping track of what is held constant when we take derivatives. We have $$p=-\left.\frac{\partial\Phi}{\partial V}\right|_{T,\mu}$$ You can calculate pressure from energy, but energy is a function of $$S,N$$, so $$p=-\left.\frac{\partial U}{\partial V}\right|_{S,N}$$ and you have to be careful when mixing derivatives with different things held constant. I also don't quite understand what you mean by setting $$\mu$$ to zero. For a classical gas, for example, $$\mu$$ is strictly negative.