Grand canonical ensemble


The grand canonical ensemble is an ensemble that is not isolated from the environment, but is in thermal and chemical equilibrium with a much larger heat and particle reservoir. As such, both energy and number of particles can fluctuate. The conserved quantities are the temperature TT and the chemical potential μ\mu. Its density function is

ρ(z,V,T)=zNQN(V,T)\rho(z,V,T)=z^{N}Q_{N}(V,T)

where z=eβμz=e^{\beta \mu} is the fugacity and QNQ_{N} is the canonical partition function. Its partition function is

Z(z,V,T)N=0zNQN(V,T)\mathcal{Z}(z,V,T)\equiv \sum_{N=0}^{\infty} z^{N}Q_{N}(V,T)

Derivation from the canonical ensemble

Let's consider a system and a particle and heat reservoir of particle numbers N1N_{1} and N2N_{2} bound by N2=NN1N_{2}=N-N_{1} and volumes V1V_{1} and V2=VV1V_{2}=V-V_{1}. Let's assume V2V1V_{2}\gg V_{1} and N2N1N_{2}\gg N_{1} and their Hamiltonians are separable:

H(q,p,N)=H1(q1,p1,N1)+H2(q2,p2,N2)H(\mathbf{q},\mathbf{p},N)=H_{1}(\mathbf{q}_{1},\mathbf{p}_{1},N_{1})+H_{2}(\mathbf{q}_{2},\mathbf{p}_{2},N_{2})

This implicitly means that we are neglecting interactions between the systems beyond the bare minimum required to exchange particles and heat, which generally means that the interaction range is short.

Note how the grand canonical is just an extended version of the canonical ensemble, so let's start from the canonical partition function:

QN=eβH(q,p,N)h3NN!dqdpQ_{N}=\int \frac{e^{\beta H(\mathbf{q},\mathbf{p},N)}}{h^{3N}N!}d\mathbf{q}\,d\mathbf{p}

NN is now a variable, so we also need to take every possible combination of N1N_{1} and N2N_{2} into account. At a fixed N1N_{1}, the number of states due to NN is given by the binomial theorem as

(NN1)=N!N1!(NN1)!=N!N1!N2!\begin{pmatrix}N \\ N_{1}\end{pmatrix}=\frac{N!}{N_{1}!(N-N_{1})!}=\frac{N!}{N_{1}!N_{2}!}

but N1N_{1} can go anywhere between 00 and NN, so the actual total is

N1=0N(NN1)=N1=0NN!N1!N2!\sum_{N_{1}=0}^{N}\begin{pmatrix}N \\ N_{1}\end{pmatrix} =\sum_{N_{1}=0}^{N} \frac{N!}{N_{1}!N_{2}!}

Since state combinations are found by multiplying, we can now state what our new ensemble average over the whole system looks like for a quantity regarding system 1:

O1(H1,N1)=1QNN1=0NN!N1!N2!QNO(H1,N1)(expand QN)=1QNN1=0NN!N1!N2!1h3(N1+N2)N! eβ[H1(q1,p1,N1)+H2(q2,p2,N2)]O(H1,N1) dqdp=N1=0NeβH1(q1,p1,N1)O(H1,N1)h3N1N1!dq1dp1eβH2(q2,p2,N2)h3N2N2!dq2dp2QN2=N1=0NQN2QNeβH1(q1,p1,N1)O(H1,N1)h3N1N1!dq1dp1=\begin{align} \langle O_{1}(H_{1},N_{1}) \rangle &=\frac{1}{Q_{N}} \sum_{N_{1}=0}^{N} \frac{N!}{N_{1}!N_{2}!}Q_{N}O(H_{1},N_{1}) \\ (\text{expand } Q_{N})&=\frac{1}{Q_{N}}\sum_{N_{1}=0}^{N} \frac{\cancel{ N! }}{N_{1}!N_{2}!}\frac{1}{h^{3(N_{1}+N_{2})}\cancel{ N! }}\int\ e^{-\beta[H_{1}(\mathbf{q}_{1},\mathbf{p}_{1},N_{1})+H_{2}(\mathbf{q}_{2},\mathbf{p}_{2},N_{2})]}O(H_{1},N_{1}) \ d\mathbf{q}d\mathbf{p} \\ &=\sum_{N_{1}=0}^{N}\int\frac{e^{-\beta H_{1}(\mathbf{q}_{1},\mathbf{p}_{1},N_{1})}O(H_{1},N_{1})}{h^{3N_{1}}N_{1}!} d\mathbf{q}_{1}d\mathbf{p}_{1}\underbrace{ \int \frac{e^{-\beta H_{2}(\mathbf{q}_{2},\mathbf{p}_{2},N_{2})}}{h^{3N_{2}}N_{2}!} d\mathbf{q}_{2}d\mathbf{p}_{2} }_{ Q_{N_{2}} }\\ &=\sum_{N_{1}=0}^{N} \frac{Q_{N_{2}}}{Q_{N}}\int\frac{e^{-\beta H_{1}(\mathbf{q}_{1},\mathbf{p}_{1},N_{1})}O(H_{1},N_{1})}{h^{3N_{1}}N_{1}!} d\mathbf{q}_{1}d\mathbf{p}_{1}=\ldots \end{align}

The ratio of partition functions is

QN2(V2,T)QN(V,T)=eβ[A(NN1,VV1,T)A(N,V,T)]\frac{Q_{N_{2}}(V_{2},T)}{Q_{N}(V,T)}=e^{-\beta[A(N-N_{1},V-V_{1},T)-A(N,V,T)]}

where AA is the Helmholtz free energy. Using the fact that N1N2N_{1}\ll N_{2} and V1V2V_{1}\ll V_{2}, which means N2NN_{2}\simeq N and V2VV_{2}\simeq V, we can use a Taylor series in two dimensions to approximate AA around NN and VV, so that we get a first order approximation

A(NN1,VV1,T)A(N,V,T)+ANV,T(NN1N)+AVN,T(VV1V)=A(N,V,T)μN1+PV1\begin{align} A(N-N_{1},V-V_{1},T)&\simeq A(N,V,T)+\left.\frac{ \partial A }{ \partial N }\right|_{V,T} (N-N_{1}-N)+ \left.{\frac{ \partial A }{ \partial V } }\right|_{N,T}(V-V_{1}-V) \\ &=A(N,V,T)-\mu N_{1}+PV_{1} \end{align}

where we got the chemical potential μ\mu from:

μ=A(NN1,VV1,T)NN2=N\mu=\left.{ \frac{ \partial A(N-N_{1},V-V_{1},T) }{ \partial N } }\right|_{N_{2}=N}

which is the rate of change of free energy with respect to number of particles, and the pressure PP from the Maxwell relations:

P=A(NN2,VV2,T)VV2=VP=- \left. \frac{ \partial A(N-N_{2},V-V_{2},T) }{ \partial V } \right|_{V_{2}=V}

Through this, our ratio looks like

QN2(V2,T)QN(V,T)=eβ(μN1PV1)\frac{Q_{N_{2}}(V_{2},T)}{Q_{N}(V,T)}=e^{\beta(\mu N_{1}-PV_{1})}

Back to the ensemble average

=N1=0Neβ(μN1PV1)eβH1(q1,p1,N1)O(H1,N1)h3N1N1!dq1dp1=eβPV1N1=0NeβμN1QN11QN1dq1dp1=\begin{align} \ldots&=\sum_{N_{1}=0}^{N} e^{\beta(\mu N_{1}-PV_{1})} \int\frac{e^{-\beta H_{1}(\mathbf{q}_{1},\mathbf{p}_{1},N_{1})}O(H_{1},N_{1})}{h^{3N_{1}}N_{1}!} d\mathbf{q}_{1}d\mathbf{p}_{1} \\ &=e^{-\beta PV_{1}}\sum_{N_{1}=0}^{N} e^{\beta\mu N_{1}} Q_{N_{1}} \frac{1}{Q_{N_{1}}} \int\ldots d\mathbf{q}_{1}d\mathbf{p}_{1} \\ &=\ldots \end{align}

The integral and the denominator QN1Q_{N_{1}} now make a canonical ensemble average:

=eβPV1N1=0NeβμN1QN1O1canon\begin{align} \ldots&=e^{-\beta PV_{1}}\sum_{N_{1}=0}^{N} e^{\beta \mu N_{1}}Q_{N_{1}}\langle O_{1} \rangle_\text{canon} \end{align}

Note how there no longer is any mention of the second system. It is either system 1 or the total NN. This justifies a thermodynamic limit, for which NN\to \infty:

O1(H1,N1)=eβPV1N1=0eβμN1QN1O1canon\langle O_{1}(H_{1},N_{1}) \rangle =e^{-\beta PV_{1}}\sum_{N_{1}=0}^{\infty} e^{\beta \mu N_{1}}Q_{N_{1}}\langle O_{1} \rangle_\text{canon}

Now that we only have mentions N1N_{1} and V1V_{1}, we can safely drop the index 11, since it is longer relevant, and define the fugacity as zeβμz\equiv e^{\beta \mu}:

O(H,N)grand=eβPVN=0zNQNOcanon\boxed{\langle O(H,N) \rangle_\text{grand} =e^{-\beta PV}\sum_{N=0}^{\infty} z^{N}Q_{N}\langle O \rangle_\text{canon}}

This is the ensemble average of the grand canonical ensemble. By comparing this to the discrete definition of ensemble average, we see

O=1Zρ O=1eβPVN=0zNQN O\langle O \rangle =\frac{1}{Z}\sum \rho\ O =\frac{1}{e^{\beta PV}}\sum_{N=0}^{\infty} z^{N}Q_{N}\ O

We intuit that the grand canonical density function must be

ρ(q,p,N)=zNQN\boxed{\rho(\mathbf{q},\mathbf{p},N)=z^{N}Q_{N}}

and that the grand canonical partition function must be

Z=eβPV\mathcal{Z}=e^{\beta PV}

There is a better statement for this. It can be found by taking OO to be the constant 11, which reduces the ensemble average to

1grand=1=eβPVN=0zNQNN=0zNQN=eβPV\langle 1 \rangle _\text{grand}=1=e^{-\beta PV}\sum_{N=0}^{\infty} z^{N}Q_{N}\qquad\Rightarrow \qquad \sum_{N=0}^{\infty} z^{N}Q_{N}=e^{\beta PV}

So evidently, the partition function must be

Z(z,V,T)=N=0zNQN\boxed{\mathcal{Z}(z,V,T)=\sum_{N=0}^{\infty} z^{N}Q_{N}}

Energy

Just like in the canonical ensemble, the energy is

U=H=βlnZ(Z,V,T)U=\langle H \rangle =-\frac{ \partial }{ \partial \beta } \ln \mathcal{Z}(Z,V,T)

Particle number fluctuations

Since NN varies, we can express the mean number of particles as the ensemble average

N=1ZN=0NzNQN(V,T)\langle N \rangle =\frac{1}{\mathcal{Z}}\sum_{N=0}^{\infty}Nz^{N}Q_{N}(V,T)

We employ the common method using a derivative to make a quantity (here NN) disappear:

NzN=zzzNNz^{N}=z\frac{ \partial }{ \partial z } z^{N}

so

N=1ZN=0zzzNQN(V,T)=zZzN=0zNQN(V,T)=zZzZ=zzlnZ\langle N \rangle =\frac{1}{\mathcal{Z}}\sum_{N=0}^{\infty} z\frac{ \partial }{ \partial z } z^{N}Q_{N}(V,T)=\frac{z}{\mathcal{Z}}\frac{ \partial }{ \partial z } \sum_{N=0}^{\infty} z^{N}Q_{N}(V,T)=\frac{z}{\mathcal{Z}}\frac{ \partial }{ \partial z } \mathcal{Z}=z\frac{ \partial }{ \partial z } \ln \mathcal{Z}

And so

N=zzlnZ(z,V,T)\boxed{\langle N \rangle =z\frac{ \partial }{ \partial z } \ln \mathcal{Z}(z,V,T)}

Now that we have the mean, we can also find the Variance. The trick is the same as before. If doing zzz\frac{ \partial }{ \partial z } gave us N\langle N \rangle, doing it twice should give us N2\langle N^{2} \rangle:

zzzzlnZ=zz1ZN=0NzNQN=z[1ZN=0N(zzN)QN+(z1Z)N=0NzNQN]=z[1Z1zN=0N2zNQN1Z21z(N=0NzNQN)(N=0NzNQN)]==N=0N2zNQNZ(N=0NzNQNZ)2=N2N2\begin{align} z\frac{ \partial }{ \partial z } z\frac{ \partial }{ \partial z } \ln \mathcal{Z}&=z\frac{ \partial }{ \partial z } \frac{1}{\mathcal{Z}} \sum_{N=0}^{\infty}Nz^{N}Q_{N} \\ &=z\left[ \frac{1}{\mathcal{Z}}\sum_{N=0}^{\infty} N\left( \frac{ \partial }{ \partial z } z^{N} \right)Q_{N}+ \left( \frac{ \partial }{ \partial z } \frac{1}{\mathcal{Z}} \right)\sum_{N=0}^{\infty} Nz^{N}Q_{N} \right] \\ &=z\left[ \frac{1}{\mathcal{Z}} \frac{1}{z}\sum_{N=0}^{\infty} N^{2}z^{N}Q_{N}- \frac{1}{\mathcal{Z}^{2}} \frac{1}{z}\left( \sum_{N=0}^{\infty} Nz^{N}Q_{N} \right)\left( \sum_{N=0}^{\infty} Nz^{N}Q_{N} \right) \right]= \\ &=\frac{\sum_{N=0}^{\infty}N^{2}z^{N}Q_{N}}{\mathcal{Z}}- \left( \frac{\sum_{N=0}^{\infty}Nz^{N}Q_{N}}{\mathcal{Z}} \right)^{2} \\ &=\langle N^{2} \rangle -\langle N \rangle ^{2} \end{align}

which is precisely the variance. However, though we understand what the variance is, the left hand side of the equation is still cryptic. To find the physics in it, we can express the ZZ derivative in terms of the chemical potential as

zz=zμzμ=z(zkBTlnz)μ=kBTμz\frac{ \partial }{ \partial z } =z\frac{ \partial \mu }{ \partial z } \frac{ \partial }{ \partial \mu } =z\left( \frac{ \partial }{ \partial z } k_{B}T\ln z \right)\frac{ \partial }{ \partial \mu } =k_{B}T\frac{ \partial }{ \partial \mu }

Plugging this back into the previous equation gives us a more interesting look on particle number fluctuations:

var(N)=N2N2=kB2T22μ2lnZ\boxed{\text{var}(N)=\langle N^{2} \rangle -\langle N \rangle ^{2}=k_{B}^{2}T^{2}\frac{ \partial ^{2} }{ \partial \mu ^{2} } \ln \mathcal{Z}}

Unsurprisingly, higher temperatures mean higher variances.

Canonical ensemble equivalence

We can use the previous result to our advantage to prove that the grand canonical and canonical ensembles are equivalent in the Thermodynamic limit. In fact, if we divide the particle variance by the square of the volume VV occupied the ensemble and we define the particle density n=N/Vn=N/V, we get

n2n2=kB2T2V22μ2lnZ\langle n^{2} \rangle -\langle n \rangle ^{2}=\frac{k_{B}^{2}T^{2}}{V^{2}}\frac{ \partial ^{2} }{ \partial \mu ^{2} } \ln \mathcal{Z}

When VV\to \infty in the limit, this equation goes to zero, which means that particle density fluctuations nullify, which in turn also means that particle number fluctuations are also zero.

Thermodynamics

To derive thermodynamics relations in the grand canonical, we can do something similar to keeping only the highest entropy state in the microcanonical ensemble. The grand canonical partition function is a sum:

Z=N=0zNQN\mathcal{Z}=\sum_{N=0}^{\infty} z^{N}Q_{N}

If one term (call it N\langle N \rangle) is considerably larger than all the others, we can keep only that one and approximate the sum away. This happens if the number variance is vanishingly small, which is to say in the thermodynamic limit. In this case, we can state

Z=N=0zNQNzNQN\mathcal{Z}=\sum_{N=0}^{\infty} z^{N}Q_{N}\simeq z^{\langle N \rangle}Q_{\langle N \rangle}

The logarithm simplifies considerably:

lnZln(zNQN)=Nlnz+lnQN=NβμβAN\ln \mathcal{Z}\simeq \ln(z^{\langle N \rangle}Q_{\langle N \rangle})=\langle N \rangle\ln z+\ln Q_{\langle N \rangle}=\langle N \rangle\beta\mu-\beta A_{\langle N \rangle}

where ANA_{\langle N \rangle} is the Helmholtz free energy in state N\langle N \rangle. We can state AN=Na(v,T)A_{N}=Na(v,T) by defining aa as the free energy per particle, using v=V/Nv=V/N as the specific volume of the ensemble. Doing this, we get

lnZNβμβNa(v,T)=Nβ(μa(v,T))\ln \mathcal{Z}\simeq \langle N \rangle\beta\mu-\beta\langle N \rangle a(\langle v \rangle,T)=\langle N \rangle\beta(\mu-a(\langle v \rangle,T))

where v=V/N\langle v \rangle=V/\langle N \rangle. Unfortunately, a(v,T)a(\langle v \rangle,T) is a somewhat cryptic quantity and it would be nice to express it in terms of better understood ones. Fortunately, this is possible by calculating a couple of thermodynamic quantities. Pressure is

P=(AV)N,T=Na(VT,T)V=avP=-\left( \frac{ \partial A }{ \partial V } \right)_{N,T}=-N\frac{ \partial a\left( \frac{V}{T},T \right) }{ \partial V } =-\frac{ \partial a }{ \partial v }

and the chemical potential is

μ=(AN)V,T=NNa+Na(VN,T)N=aNVN2av=avav=a+vP(1)\mu=\left( \frac{ \partial A }{ \partial N } \right)_{V,T}=\frac{ \partial N }{ \partial N } a+N\frac{ \partial a\left( \frac{V}{N},T \right) }{ \partial N } =a-N \frac{V}{N^{2}}\frac{ \partial a }{ \partial v }=a-v\frac{ \partial a }{ \partial v } =a+vP\tag{1}

Inverting this relation gives us a=μvPa=\mu-vP. If we put this back in the partition function, we find

lnZNβ(μμ+vP)=NβvP=NβVNP=βPV=PVkBT\ln \mathcal{Z}\simeq \langle N \rangle\beta(\mu-\mu+\langle v \rangle P)=\langle N \rangle\beta \langle v \rangle P=\langle N \rangle\beta \frac{V}{\langle N \rangle}P=\beta PV=\frac{PV}{k_{B}T}

Thus, in thermodynamic limit, we find an equation of state:

lnZ=PVkBT(2)\boxed{\ln \mathcal{Z}=\frac{PV}{k_{B}T}}\tag{2}

Note that it is independent from the number of particles N\langle N \rangle. Since N\langle N \rangle is also the only state that matters for the number of particles (as long as we are in the thermodynamic limit), we can write N=N\langle N \rangle=N without much loss.

Number fluctuations, again

Now that we have a sensible expression for lnZ\ln \mathcal{Z}, we can give a more satisfactory description of particle number fluctuations. In fact, we get

n2n2=(kBTV)22μ2(PVkBT)=kBTV2Pμ2\langle n^{2} \rangle -\langle n \rangle ^{2}=\left( \frac{k_{B}T}{V} \right)^{2}\frac{ \partial ^{2} }{ \partial \mu ^{2} } \left( \frac{PV}{k_{B}T} \right)=\frac{k_{B}T}{V}\frac{ \partial ^{2}P }{ \partial \mu ^{2} }

We can use the following relation

μv=v2a(v)v2=vPvPvvμ=1v\frac{ \partial \mu }{ \partial v } =-v\frac{ \partial ^{2}a(v) }{ \partial v^{2} } =v\frac{ \partial P }{ \partial v } \quad\to \quad \frac{ \partial P }{ \partial v } \frac{ \partial v }{ \partial \mu } =\frac{1}{v}

and so

Pμ=Pvvμ=1v\frac{ \partial P }{ \partial \mu }=\frac{ \partial P }{ \partial v } \frac{ \partial v }{ \partial \mu } =\frac{1}{v}

However, vv is itself dependent on μ\mu, which gives us

2Pμ2=1v2vμ=κTv2\frac{ \partial ^{2}P }{ \partial \mu ^{2} }= - \frac{1}{v^{2}}\frac{ \partial v }{ \partial \mu } =\frac{\kappa_{T}}{v^{2}}

where we defined the isothermal compressibility κT\kappa_{T}. As such, our fluctuations become

n2n2n2=kBTκTV\frac{\langle n^{2} \rangle -\langle n \rangle ^{2}}{\langle n \rangle ^{2}}=\frac{k_{B}T\kappa_{T}}{V}

In the thermodynamic limit, these again vanish.

Virial expansion

The equation of state (2)(2) can be rewritten using (1)(1) as

n=1VzzlnZ(z,V,T)n=\frac{1}{V}z\frac{ \partial }{ \partial z } \ln \mathcal{Z}(z,V,T)

If the temperature is sufficiently high and the particle density is sufficiently low, the equation in both forms can be expanded as a power series in zz:

PkBT=1λ3l=1blzl,n=1λ3l=1lblzl\frac{P}{k_{B}T}=\frac{1}{\lambda ^{3}}\sum_{l=1}^{\infty} b_{l}z^{l},\qquad n=\frac{1}{\lambda ^{3}}\sum_{l=1}^{\infty} lb_{l}z^{l}

using the de Broglie thermal wavelength λ\lambda. The coefficients blb_{l} are known as cluster integrals and represents the internal correlation of a group of ll particles due to interactions. By definition, b11b_{1}\equiv1.