Grand Canonical Ensemble

Fix a temperature and you get the canonical ensemble: a system trades energy with a heat bath, and the number of particles NN stays locked. But a great many systems of interest do not keep NN fixed. A patch of gas inside a larger container leaks molecules across its imaginary boundary; a metal surface adsorbs and desorbs atoms; a mode of the electromagnetic field is created and destroyed; the electrons in a metal are best described by letting each energy level fill and empty freely. For all of these, holding NN rigidly is not just unphysical — it is computationally disastrous, because the constraint ∑knk=N\sum_k n_k = N tangles every occupation number together. The grand canonical ensemble cuts that knot. We let the system exchange both energy and particles with a vast reservoir. The reservoir now fixes two intensive parameters: the temperature TT (the price of energy) and the chemical potential μ\mu (the price of a particle). Each microstate with NN particles and energy EE carries the Gibbs weight e−β(E−μN)e^{-\beta(E-\mu N)} — the Boltzmann factor with an extra term that rewards or penalizes holding particles, depending on the sign of μ\mu. The particle number is no longer fixed; it fluctuates, and only its mean ⟨N⟩\langle N\rangle is pinned down by μ\mu. This article builds the ensemble from first principles — deriving the Gibbs weight by expanding the reservoir's entropy in both energy and particle number simultaneously (the article's owned result), a two-dimensional version of the canonical derivation — and shows why trading a hard constraint for a chemical potential is the single most useful move in statistical mechanics. The grand partition function Ξ\Xi and grand potential Ω\Omega that it generates are developed fully in their own articles; here we lay the framework and its payoff. Every claim is python-verified.

Key takeaways
  • The grand canonical ensemble describes a system exchanging both energy and particles with a reservoir at fixed TT, VV, and chemical potential μ\mu — the number NN fluctuates.
  • Each microstate of NN particles and energy EE carries the Gibbs weight e−β(E−μN)e^{-\beta(E-\mu N)}; this generalizes the Boltzmann factor e−βEe^{-\beta E} to open systems.
  • The weight is derived, not assumed: expand the reservoir entropy to first order in both EE and NN, identifying 1T=∂SR/∂ER\tfrac1T=\partial S_R/\partial E_R and −μT=∂SR/∂NR-\tfrac{\mu}{T}=\partial S_R/\partial N_R.
  • Because the sum over NN is now unconstrained, the machinery factorizes over independent single-particle modes — the reason ideal quantum gases are treated grand-canonically.
  • The mean number is ⟨N⟩=z ∂zln⁡Ξ\langle N\rangle=z\,\partial_z\ln\Xi where z=eβμz=e^{\beta\mu} is the fugacity; number fluctuations ⟨ΔN2⟩=kBT ∂μ⟨N⟩\langle\Delta N^2\rangle=k_BT\,\partial_\mu\langle N\rangle vanish relative to ⟨N⟩\langle N\rangle as N−1/2N^{-1/2}, giving ensemble equivalence.
  • Key idea: trade the hard constraint of fixed NN for a chemical potential μ\mu that fixes only the mean; every microstate is then weighted by the Gibbs factor e−β(E−μN)e^{-\beta(E-\mu N)}.
The core insight

The grand canonical ensemble lets a system exchange energy and particles with a reservoir at fixed T,V,μT,V,\mu. Each microstate is weighted by the Gibbs factor e−β(E−μN)e^{-\beta(E-\mu N)}, a factor forced by expanding the reservoir entropy to first order in both EE and NN. Releasing the fixed-NN constraint is the key computational simplification: the sum over states factorizes over independent modes, which is why ideal quantum gases live here.

Where this lives today

The grand-canonical ensemble is one of the standard frameworks of quantum many-body physics and computational statistical mechanics. Ideal quantum gases — the electrons in a metal or a white dwarf, the photons in a blackbody cavity, the ultracold rubidium atoms in a magneto-optical trap that condense into a Bose–Einstein condensate — are all treated by letting each single-particle level fill and empty freely at fixed μ\mu, then integrating the mean occupation over the density of states. This is not a convenience; for indistinguishable particles the fixed-NN canonical sum is genuinely intractable, while in the grand-canonical ensemble the partition function factorizes into independent single-particle modes. The chemical potential μ\mu is an experimentally controllable thermodynamic variable: in semiconductors it coincides with the Fermi level set by doping and gate voltage; in electrochemistry it is directly related to the electrode potential; in ultracold-atom experiments it is controlled through the trapping potential and the total atom number. Beyond equilibrium gases, the grand-canonical ensemble is a central tool for the theoretical and numerical study of condensed matter. Grand-canonical Monte Carlo inserts and deletes particles to sample systems at fixed μ\mu — the method of choice for adsorption in porous materials, phase coexistence, and the equation of state of fluids. In lattice quantum chromodynamics, the partition function of nuclear matter at finite baryon density is a grand-canonical object with a chemical potential for baryon number (whose numerical treatment, the "sign problem," is one of the field's grand challenges). And the same mathematics — a reservoir fixing the mean of a conserved quantity through a conjugate potential — reappears whenever a system is open: in the statistics of complex networks, in population dynamics, and in the maximum-entropy inference that underlies much of modern machine learning. Gibbs's grand ensemble, invented to complete a formal scheme, turned out to be the natural description of nearly everything that exchanges particles with its surroundings.

The physical picture

Draw an imaginary box inside a much larger gas. Molecules drift across its walls in both directions, and so does energy. The remainder of the gas acts as a reservoir. Because it is macroscopically larger than the subsystem, exchanging a small amount of energy or a few particles changes its temperature and chemical potential by negligible amounts, so both may be treated as constant. The chemical potential μ\mu is what quantifies the reservoir's "willingness" to give up a particle. Thermodynamically, μ=(∂U/∂N)S,V=(∂F/∂N)T,V\mu=(\partial U/\partial N)_{S,V}=(\partial F/\partial N)_{T,V}, the change in the system's energy (or Helmholtz free energy at fixed T,VT,V) when one particle is added.

Figure
An open system inside a reservoir exchanges both energy E and particles N. The reservoir fixes T (through energy flow) and μ (through particle flow); the little box's N fluctuates around ⟨N⟩.
reservoir (fixes T, μ) system V fixed N fluctuates energy E particles N

The Gibbs weight e−β(E−μN)e^{-\beta(E-\mu N)} reflects the competition between energy minimization and particle exchange with the reservoir. The −βE-\beta E term penalizes energy exactly as in the canonical ensemble. The new +βμN+\beta\mu N term is a bookkeeping reward for holding particles: raise μ\mu and states with more particles become more probable; lower it and the box empties out. The chemical potential is the price the reservoir charges per particle, measured in units of kBTk_BT, and equilibrium is where the box's own energetic and entropic accounting balances that price. Why go to the trouble? Because letting NN float is a computational gift. In the canonical ensemble the constraint that the occupation numbers of all the single-particle levels must add up to a fixed NN couples them together — you cannot sum over one mode without worrying about all the others. The grand ensemble sums over NN from zero to infinity, which removes that constraint entirely, and the whole calculation factorizes mode by mode. This is why quantum statistics is almost trivial grand-canonically and a nightmare canonically. And because number fluctuations are tiny — of order N\sqrt{N} out of NN — the grand ensemble predicts the same densities and pressures as if NN were rigidly fixed. The punchline plot below shows the payoff for a single adsorption site: the mean occupancy ⟨N⟩\langle N\rangle rises smoothly from empty to full as μ\mu sweeps through the site's binding energy, a curve you can read off directly from the Gibbs weight.

Figure
Mean occupancy ⟨N⟩ of a single site vs chemical potential μ. It rises smoothly through the binding energy ε: ⟨N⟩ = 1/(e^{β(ε−μ)}+1), half-filled at μ = ε. The reservoir's μ sets the fill.
μ − ε⟨N⟩ 10 half-filled at μ = ε empty (μ ≪ ε) full (μ ≫ ε)

The core equations

The reservoir fixes TT and μ\mu, and every microstate of the open system — labelled by its particle number NN and, given NN, its internal microstate ss — is weighted by the Gibbs factor. The probability of finding the system in a particular microstate is the normalized Gibbs weight:

pN,s=1Ξ e−β(Es(N)−μN),β=1kBT(1)p_{N,s}=\frac{1}{\Xi}\,e^{-\beta(E_{s}^{(N)}-\mu N)},\qquad \beta=\frac{1}{k_BT} \qquad (1)

where: pN,sp_{N,s} — probability of the microstate with NN particles and energy Es(N)E_s^{(N)}; μ\mu — chemical potential set by the reservoir; Ξ\Xi — grand partition function (the normalization). Setting μ=0\mu=0 and forbidding number changes recovers the canonical ps=e−βEs/Zp_s=e^{-\beta E_s}/Z. The additional term +βμN+\beta\mu N accounts for particle exchange with the reservoir: for two otherwise identical microstates differing by one particle, their statistical weights differ by a factor eβμe^{\beta\mu}. The normalization is a double sum — over all particle numbers and, for each, over all microstates. Grouping by NN shows that it is a power series in the fugacity z=eβμz=e^{\beta\mu} whose coefficients are the canonical partition functions:

Ξ(T,V,μ)=∑N=0∞∑se−β(Es(N)−μN)=∑N=0∞zN ZN(T,V)(2)\Xi(T,V,\mu)=\sum_{N=0}^{\infty}\sum_{s}e^{-\beta(E_s^{(N)}-\mu N)}=\sum_{N=0}^{\infty}z^{N}\,Z_N(T,V) \qquad (2)

where: z=eβμz=e^{\beta\mu} — fugacity (activity), the "particle-counting bookmark"; ZNZ_N — the canonical partition function for exactly NN particles. Equation (2) is the bridge between the two ensembles: the grand partition function is the generating function of the canonical ones. Its full development — including the mode factorization for quantum gases — is the subject of the Grand Partition Function article; here it is the object our framework produces. The mean particle number is the first fugacity-derivative of ln⁡Ξ\ln\Xi — the same generating-function logic that gave energy from ln⁡Z\ln Z, now applied to number:

⟨N⟩=z ∂ln⁡Ξ∂z=kBT ∂ln⁡Ξ∂μ∣T,V(3)\langle N\rangle=z\,\frac{\partial\ln\Xi}{\partial z}=k_BT\,\frac{\partial\ln\Xi}{\partial\mu}\bigg|_{T,V} \qquad (3)

where: ⟨N⟩\langle N\rangle — ensemble-averaged particle number, the quantity μ\mu actually controls. Because μ\mu fixes only the mean, NN itself fluctuates; the size of that fluctuation is the second μ\mu-derivative. Differentiating once more gives the number variance — a fluctuation equal to a response, exactly as energy fluctuations equalled the heat capacity:

⟨ΔN2⟩=⟨N2⟩−⟨N⟩2=kBT(∂⟨N⟩∂μ)T,V(4)\langle\Delta N^2\rangle=\langle N^2\rangle-\langle N\rangle^2=k_BT\left(\frac{\partial\langle N\rangle}{\partial\mu}\right)_{T,V} \qquad (4)

where: ⟨ΔN2⟩\langle\Delta N^2\rangle — variance of the particle number. Since a variance is non-negative, ∂⟨N⟩/∂μ≥0\partial\langle N\rangle/\partial\mu\ge0: adding chemical potential can only increase the mean occupancy. The relative fluctuation ⟨ΔN2⟩/⟨N⟩\sqrt{\langle\Delta N^2\rangle}/\langle N\rangle scales as N−1/2N^{-1/2}; its connection to the compressibility is the Particle-Number Fluctuations article. Finally, the thermodynamic potential associated with the grand-canonical ensemble is the grand potential, which is related to the grand partition function by:

Ω(T,V,μ)=−kBTln⁡Ξ=−pV(5)\Omega(T,V,\mu)=-k_BT\ln\Xi=-pV \qquad (5)

where: Ω\Omega — grand potential (Landau potential); pp — pressure. Its differential is dΩ=−S dT−p dV−N dμ\mathrm d\Omega=-S\,\mathrm dT-p\,\mathrm dV-N\,\mathrm d\mu, so SS, pp, and ⟨N⟩\langle N\rangle are its first derivatives. The full development of Ω\Omega, and the proof that it equals −pV-pV, belong to the Grand Potential article.

Derivation AThe Gibbs weight from a reservoir exchanging energy and particles

The Gibbs factor e−β(E−μN)e^{-\beta(E-\mu N)} is derived by treating the system and reservoir as a single isolated microcanonical system and expanding the reservoir entropy to first order in the subsystem energy EE and particle number NN. This generalizes the canonical derivation, which expands only in the subsystem energy, by including the subsystem particle number. The same entropy expansion therefore yields both coefficients: −β-\beta multiplying EE and +βμ+\beta\mu multiplying NN. The strategy: count reservoir microstates, write them as eSR/kBe^{S_R/k_B}, Taylor-expand SRS_R in the two small variables, and read off the coefficients as 1/T1/T and −μ/T-\mu/T.

Step 1. By the equal-a-priori postulate, the probability that the system sits in a definite microstate with energy EE and number NN is proportional to the number of reservoir microstates compatible with it: pN,s∝ΩR(Etot−E, Ntot−N)p_{N,s}\propto\Omega_R(E_{\text{tot}}-E,\,N_{\text{tot}}-N), where Etot,NtotE_{\text{tot}},N_{\text{tot}} are conserved totals. Why: the composite is isolated, so all its microstates are equally likely; fixing the system's state leaves the reservoir free to be in any of ΩR\Omega_R compatible states.

Step 2. Write the reservoir multiplicity as an exponential of its entropy, ΩR=eSR/kB\Omega_R=e^{S_R/k_B}, so pN,s∝exp⁡ ⁣[SR(Etot−E, Ntot−N)/kB]p_{N,s}\propto\exp\!\big[S_R(E_{\text{tot}}-E,\,N_{\text{tot}}-N)/k_B\big]. Why: Boltzmann's S=kBln⁡ΩS=k_B\ln\Omega turns the astronomically large multiplicity into a smooth, expandable entropy — the only function that behaves gently as the tiny system nibbles at the reservoir.

Step 3. Taylor-expand SRS_R to first order in the two small quantities EE and NN: SR(Etot−E,Ntot−N)≈SR0−E (∂SR/∂ER)−N (∂SR/∂NR)S_R(E_{\text{tot}}-E,N_{\text{tot}}-N)\approx S_R^{0}-E\,(\partial S_R/\partial E_R)-N\,(\partial S_R/\partial N_R). Why: because E≪EtotE\ll E_{\text{tot}} and N≪NtotN\ll N_{\text{tot}}, the leading behaviour is linear; this is the crucial two-variable step that distinguishes the grand from the canonical case.

Step 4. Identify the derivatives with reservoir intensive parameters using the fundamental thermodynamic relation dS=1T dE−μT dN\mathrm dS=\tfrac1T\,\mathrm dE-\tfrac{\mu}{T}\,\mathrm dN (at fixed volume): ∂SR/∂ER=1/T\partial S_R/\partial E_R=1/T and ∂SR/∂NR=−μ/T\partial S_R/\partial N_R=-\mu/T. Why: these are the definitions of temperature and chemical potential; the reservoir imposes its TT and μ\mu on the system through exactly these two slopes of its entropy.

Step 5. Assemble the weight: pN,s∝exp⁡ ⁣[(SR0−E/T+μN/T)/kB]=e−β(E−μN)p_{N,s}\propto\exp\!\big[(S_R^0-E/T+\mu N/T)/k_B\big]=e^{-\beta(E-\mu N)}, with the constant SR0S_R^0 absorbed into the normalization Ξ\Xi. The second-order terms carry coefficients like ∂2SR/∂ER2=−1/(T2CR)\partial^2 S_R/\partial E_R^2=-1/(T^2 C_R) with CR∝NRC_R\propto N_R, so they scale as 1/NR→01/N_R\to0 in the reservoir limit — the expansion is exact. Why: the linear terms give the physics, and the reservoir's macroscopic size makes every correction vanish, so the Gibbs weight is not an approximation but the exact equilibrium distribution. *The first-order expansion reproduces the exponent −β(E−μN)-\beta(E-\mu N) exactly; the second-order coefficient →0\to0 as NR→∞N_R\to\infty; and setting the NN-derivative to zero recovers the canonical Boltzmann factor.*

Go deeper · Derivation B · 1 minMean number and number fluctuations as fugacity derivatives
Derivation BMean number and number fluctuations as fugacity derivatives

The goal is to show that both the mean particle number and its variance are derivatives of the single scalar ln⁡Ξ\ln\Xi — the grand-ensemble analogue of getting energy and its fluctuations from ln⁡Z\ln Z — so that μ\mu (or the fugacity z=eβμz=e^{\beta\mu}) plays the role β\beta played for energy. The strategy is to differentiate ln⁡Ξ\ln\Xi with respect to μ\mu once for the mean and twice for the variance, recognizing the ensemble averages that appear.

Step 1. First μ\mu-derivative gives the mean: kBT ∂μln⁡Ξ=1Ξ∑N,sN e−β(E−μN)=⟨N⟩k_BT\,\partial_\mu\ln\Xi=\dfrac{1}{\Xi}\sum_{N,s}N\,e^{-\beta(E-\mu N)}=\langle N\rangle, since ∂μ\partial_\mu brings down βN\beta N and the kBTk_BT cancels the β\beta. Equivalently ⟨N⟩=z ∂zln⁡Ξ\langle N\rangle=z\,\partial_z\ln\Xi. Why: each derivative in μ\mu pulls a factor NN into the sum and divides by Ξ\Xi — exactly the ensemble average of the number.

Step 2. Second μ\mu-derivative gives the variance. Differentiating ⟨N⟩=Ξ−1∑Ne−β(E−μN)\langle N\rangle=\Xi^{-1}\sum N e^{-\beta(E-\mu N)} once more, the quotient rule yields ∂μ⟨N⟩=β(⟨N2⟩−⟨N⟩2)=β ⟨ΔN2⟩\partial_\mu\langle N\rangle=\beta\big(\langle N^2\rangle-\langle N\rangle^2\big)=\beta\,\langle\Delta N^2\rangle. Hence ⟨ΔN2⟩=kBT ∂μ⟨N⟩\langle\Delta N^2\rangle=k_BT\,\partial_\mu\langle N\rangle. Why: the first term β⟨N2⟩\beta\langle N^2\rangle comes from differentiating the numerator, the second −β⟨N⟩2-\beta\langle N\rangle^2 from differentiating Ξ\Xi in the denominator — their difference is the variance, by definition.

Step 3. Read off two consequences. First, ∂μ⟨N⟩=⟨ΔN2⟩/kBT≥0\partial_\mu\langle N\rangle=\langle\Delta N^2\rangle/k_BT\ge0: raising the chemical potential can only raise the mean occupancy, a stability statement guaranteed by the non-negativity of a variance. Second, for a normal system ⟨N⟩∝N\langle N\rangle\propto N and ⟨ΔN2⟩∝N\langle\Delta N^2\rangle\propto N, so ⟨ΔN2⟩/⟨N⟩∼N−1/2→0\sqrt{\langle\Delta N^2\rangle}/\langle N\rangle\sim N^{-1/2}\to0. Why: extensivity makes the relative number spread shrink as 1/N1/\sqrt N, which is why the fluctuating grand-canonical NN behaves like the fixed canonical NN for macroscopic systems — the seed of ensemble equivalence. *On an explicit finite spectrum, ⟨N⟩=z ∂zln⁡Ξ\langle N\rangle=z\,\partial_z\ln\Xi and ⟨ΔN2⟩=kBT ∂μ⟨N⟩\langle\Delta N^2\rangle=k_BT\,\partial_\mu\langle N\rangle reproduce the direct ensemble averages; the single-site model gives ⟨N⟩=1/(eβ(ε−μ)+1)\langle N\rangle=1/(e^{\beta(\varepsilon-\mu)}+1).*

Limiting cases

The ensemble interpolates between regimes set by the fugacity z=eβμz=e^{\beta\mu}:

CaseResultMeaning
Particle exchange forbiddenμN\mu N term dropped: p→e−βE/Zp\to e^{-\beta E}/ZRecovers the canonical ensemble; NN is fixed again.
Dilute / classicalz=eβμ≪1z=e^{\beta\mu}\ll1Few particles per mode; occupations →ze−βε\to z e^{-\beta\varepsilon} (Maxwell–Boltzmann), ln⁡Ξ→zZ1\ln\Xi\to z Z_1.
Thermodynamic limitN,V→∞N,V\to\infty, N/VN/V fixedRelative number fluctuation →0\to0; grand, canonical, microcanonical agree (ensemble equivalence).
Near a critical point∂⟨N⟩/∂μ→∞\partial\langle N\rangle/\partial\mu\to\infty⟨ΔN2⟩\langle\Delta N^2\rangle diverges (via κT→∞\kappa_T\to\infty); ensemble equivalence can break — critical opalescence.

Worked examples

1 · A single adsorption site — coverage versus chemical potential (a real number)

A surface site binds one gas atom with energy ε\varepsilon (state occupied) or sits empty (energy 00). The site is in equilibrium with the gas, which fixes the chemical potential μ\mu. Enumerate the states, build Ξ\Xi, and find the mean occupancy ⟨N⟩\langle N\rangle; then evaluate it at T=300T=300 K when μ\mu equals the binding energy and when μ\mu is one kBTk_BT above it.

Step 1. Enumerate: the site has exactly two microstates — empty (N=0N=0, E=0E=0) and occupied (N=1N=1, E=εE=\varepsilon). The grand partition function is the sum of their Gibbs weights: Ξ=e−β(0−μ⋅0)+e−β(ε−μ⋅1)=1+e−β(ε−μ)=1+z e−βε\Xi=e^{-\beta(0-\mu\cdot0)}+e^{-\beta(\varepsilon-\mu\cdot1)}=1+e^{-\beta(\varepsilon-\mu)}=1+z\,e^{-\beta\varepsilon}.

Step 2. Apply ⟨N⟩=z ∂zln⁡Ξ\langle N\rangle=z\,\partial_z\ln\Xi. Differentiating, ⟨N⟩=ze−βε1+ze−βε=1eβ(ε−μ)+1\langle N\rangle=\dfrac{z e^{-\beta\varepsilon}}{1+z e^{-\beta\varepsilon}}=\dfrac{1}{e^{\beta(\varepsilon-\mu)}+1}. This is a Fermi–Dirac-like occupation, and it arises here purely as grand-canonical bookkeeping (a site holds 00 or 11), independent of any quantum statistics of the atoms.

Step 3. Half-filling. The occupancy is exactly 12\frac12 when eβ(ε−μ)=1e^{\beta(\varepsilon-\mu)}=1, i.e. μ=ε\mu=\varepsilon. At this point the chemical potential equals the site energy, so the occupied and empty states have equal statistical weight. It is also the inflection point of the occupation curve.

Step 4. Increasing the chemical potential by kBTk_BT gives β(ε−μ)=−1\beta(\varepsilon-\mu)=-1 and ⟨N⟩=e/(e+1)=0.731\langle N\rangle=e/(e+1)=0.731. Decreasing it by kBTk_BT gives β(ε−μ)=1\beta(\varepsilon-\mu)=1 and ⟨N⟩=1/(e+1)=0.269\langle N\rangle=1/(e+1)=0.269. Thus changing μ\mu by only 2kBT2k_BT moves the occupation from about one-quarter to three-quarters, illustrating how the chemical potential controls adsorption.

2 · The classical ideal gas grand-canonically — recovering Poisson statistics (exam level)

Show that for a classical ideal gas the grand partition function is Ξ=ezZ1\Xi=e^{zZ_1}, find ⟨N⟩\langle N\rangle, and show that the particle number is Poisson-distributed with ⟨ΔN2⟩=⟨N⟩\langle\Delta N^2\rangle=\langle N\rangle.

Step 1. Each canonical coefficient is ZN=Z1N/N!Z_N=Z_1^N/N! (independent particles, Gibbs factor). Summing the fugacity series, Ξ=∑N=0∞zNZ1NN!=∑N(zZ1)NN!=ezZ1\Xi=\sum_{N=0}^{\infty}z^N\dfrac{Z_1^N}{N!}=\sum_N\dfrac{(zZ_1)^N}{N!}=e^{zZ_1} — the exponential series closes exactly.

Step 2. Mean number: ⟨N⟩=z ∂zln⁡Ξ=z ∂z(zZ1)=zZ1\langle N\rangle=z\,\partial_z\ln\Xi=z\,\partial_z(zZ_1)=zZ_1. So ln⁡Ξ=zZ1=⟨N⟩\ln\Xi=zZ_1=\langle N\rangle, and the probability of exactly NN particles is P(N)=zNZN/Ξ=⟨N⟩Ne−⟨N⟩N!P(N)=z^N Z_N/\Xi=\dfrac{\langle N\rangle^N e^{-\langle N\rangle}}{N!} — the Poisson distribution.

Step 3. Fluctuations: ⟨ΔN2⟩=kBT ∂μ⟨N⟩=z ∂z(zZ1)=zZ1=⟨N⟩\langle\Delta N^2\rangle=k_BT\,\partial_\mu\langle N\rangle=z\,\partial_z(zZ_1)=zZ_1=\langle N\rangle. For a classical ideal gas the number variance equals the mean, ⟨ΔN2⟩=⟨N⟩\langle\Delta N^2\rangle=\langle N\rangle — the hallmark of Poisson statistics. The relative fluctuation is ⟨N⟩/⟨N⟩=1/⟨N⟩\sqrt{\langle N\rangle}/\langle N\rangle=1/\sqrt{\langle N\rangle}: for a cubic micron of air at STP holding ⟨N⟩≈2.5×107\langle N\rangle\approx2.5\times10^{7} molecules, that is about 2×10−42\times10^{-4} — utterly negligible, which is precisely why fixing μ\mu (grand) and fixing NN (canonical) give the same thermodynamics.

Origins · 1 mingrand canonical ensemble and how this was discovered
GC
grand canonical ensemble
introduced by J. W. Gibbs · Elementary Principles 1902

The grand canonical ensemble — Gibbs called it the "grand ensemble" — was introduced by J. Willard Gibbs in his 1902 treatise Elementary Principles in Statistical Mechanics, the book that founded the ensemble formulation of the subject. Gibbs had already defined the microcanonical ("microcanonical") and canonical ensembles; the grand ensemble was his systematic extension to systems whose particle number is not fixed, weighting each phase-space region by e(Ω+μN−E)/kBTe^{(\Omega+\mu N-E)/k_BT} in his notation. His motivation was partly foundational — a complete calculus of ensembles — and partly practical: the grand ensemble is the natural language for chemical equilibrium and for any system in diffusive contact with a reservoir. The construction lay somewhat dormant until the quantum era, when it became indispensable: Fermi (1926), Dirac (1926), Bose (1924), and Einstein (1924–25) built the statistics of ideal quantum gases most cleanly by letting each single-particle level exchange particles with a reservoir — exactly the grand-canonical move. Today the grand ensemble underlies the theory of metals, superconductors, ultracold atomic gases, and lattice-gauge simulations of nuclear matter at finite density. Gibbs's insight, that trading a hard constraint for a Lagrange-multiplier-like chemical potential simplifies rather than complicates, is one of the most reused ideas in physics.

History
1875
— Gibbs defines the chemical potential in On the Equilibrium of Heterogeneous Substances.
1902
— Gibbs's Elementary Principles in Statistical Mechanics introduces and names the grand ensemble.
1924
— Bose and then Einstein apply grand-canonical counting to derive the statistics of light quanta and ideal gases.
1926
— Fermi and Dirac give the exclusion-obeying occupation statistics, most naturally framed grand-canonically.
1927
— Ursell's cluster expansion organizes the fugacity series of the grand partition function.

Going further

References. Pathria & Beale, Statistical Mechanics, 4th ed., Ch. 4 · Kardar, Statistical Physics of Particles, Ch. 4 · Reif, Fundamentals of Statistical and Thermal Physics, §6.9 · Sethna, Statistical Mechanics, Ch. 6 · Landau & Lifshitz, Statistical Physics Part 1, §35–36 · Gibbs, Elementary Principles in Statistical Mechanics (1902). Key results collected here for reference: the two-variable reservoir-entropy expansion yields e−β(E−μN)e^{-\beta(E-\mu N)} with the second-order term →0\to0; the grand partition function satisfies Ξ=∑NzNZN\Xi=\sum_N z^N Z_N; the mean and variance are ⟨N⟩=z ∂zln⁡Ξ\langle N\rangle=z\,\partial_z\ln\Xi and ⟨ΔN2⟩=kBT ∂μ⟨N⟩\langle\Delta N^2\rangle=k_BT\,\partial_\mu\langle N\rangle; the single-site occupation is ⟨N⟩=1/(eβ(ε−μ)+1)\langle N\rangle=1/(e^{\beta(\varepsilon-\mu)}+1) (half-filled at μ=ε\mu=\varepsilon, with values 0.7310.731 and 0.2690.269 at μ=ε±kBT\mu=\varepsilon\pm k_BT); and the classical ideal gas gives Ξ=ezZ1\Xi=e^{zZ_1} with Poisson ⟨ΔN2⟩=⟨N⟩\langle\Delta N^2\rangle=\langle N\rangle. The full development of Ξ\Xi and Ω\Omega belongs to the Grand Partition Function and Grand Potential articles; the connection of ⟨ΔN2⟩\langle\Delta N^2\rangle to the compressibility to Particle-Number Fluctuations.

Builds on: Canonical Ensemble · Derivation of the Canonical Distribution from the Microcanonical Ensemble · Gibbs Factor and Chemical Potential · Thermodynamic Quantities from the Partition Function. Leads to: Grand Partition Function · Grand Potential · Fermi-Dirac and Bose-Einstein statistics.

Why introduce a chemical potential at all, instead of just fixing the number of particles?

Because fixing the number is what makes the calculation hard. In a system of non-interacting particles spread over single-particle levels, a many-body state is a list of occupation numbers {nk}\{n_k\}, and fixing NN means demanding ∑knk=N\sum_k n_k=N. That one constraint couples every level to every other — you cannot sum over one mode's occupation without knowing all the rest. Trading the constraint for a chemical potential removes it: the grand sum runs over all NN, so the sum over each nkn_k becomes independent and the whole partition function factorizes, Ξ=∏kΞk\Xi=\prod_k\Xi_k. You pay a small price — NN now fluctuates instead of being exact — but the fluctuations are of order N\sqrt N out of NN, so for a macroscopic system the density you compute is identical to the fixed-NN answer. It is the classic move of trading a hard constraint for a Lagrange multiplier, and here the multiplier has a direct physical meaning: it is the chemical potential the reservoir imposes.

What exactly is the chemical potential μ, physically?

The chemical potential is the energy cost (or gain) of adding one particle to the system while holding entropy and volume fixed — equivalently, it is μ=(∂G/∂N)T,p=(∂F/∂N)T,V\mu=(\partial G/\partial N)_{T,p}=(\partial F/\partial N)_{T,V}, the change in free energy per added particle. In the reservoir picture it emerges as μ=−T(∂SR/∂NR)\mu=-T(\partial S_R/\partial N_R): it measures how much entropy the reservoir loses when it gives up a particle, times the temperature. Two systems in diffusive contact reach equilibrium when their chemical potentials are equal — particles flow from high μ\mu to low μ\mu just as heat flows from high TT to low TT. This is why μ\mu controls everything from which way a chemical reaction runs (compare ∑μi\sum\mu_i of reactants and products) to the direction of osmosis, to the filling of electronic states in a semiconductor (where μ\mu is the Fermi level). It can be negative — for a classical ideal gas μ=kBTln⁡(nλ3)\mu=k_BT\ln(n\lambda^3) is negative whenever the gas is dilute (nλ3<1n\lambda^3<1), simply because adding a particle to a dilute gas increases entropy so much that the free-energy cost is negative.

The particle number fluctuates — doesn't that contradict everyday experience that a gas has a definite amount of matter?

It fluctuates by an amount too small to notice. For a normal system the variance ⟨ΔN2⟩\langle\Delta N^2\rangle is proportional to ⟨N⟩\langle N\rangle (for a classical gas it equals it, the Poisson result), so the relative fluctuation is 1/⟨N⟩1/\sqrt{\langle N\rangle}. A visible speck of gas holds perhaps 101810^{18} molecules, giving relative fluctuations of 10−910^{-9}. So "definite amount of matter" is an excellent approximation, not an exact law: what is exactly fixed is the chemical potential, and the number tracks it with imperceptible jitter. The one place the jitter becomes visible is near a critical point, where ∂⟨N⟩/∂μ\partial\langle N\rangle/\partial\mu (and the compressibility) diverges, the fluctuations grow to macroscopic size, and a normally transparent fluid scatters light and turns milky — critical opalescence.

When can I use the grand ensemble instead of the canonical one, and will I get the same answer?

You can always choose the grand ensemble if the system can, even in principle, exchange particles with a reservoir — and for computing intensive thermodynamics (density, pressure, energy per particle) you will get the same answer as the canonical ensemble whenever you are in the thermodynamic limit and away from a critical point. This is ensemble equivalence, and it rests on the number fluctuations being negligible (∼1/N\sim1/\sqrt N): if NN is sharply peaked at ⟨N⟩\langle N\rangle, fixing μ\mu and fixing NN describe the same physical state. In practice one picks whichever ensemble makes the sum easiest — usually the grand ensemble for quantum gases (because it factorizes) and the canonical for systems where NN is naturally fixed and small. Equivalence fails in two situations worth knowing: at a critical point, where κT→∞\kappa_T\to\infty makes the fluctuations macroscopic, and for the ideal Bose gas at condensation, where the grand ensemble's ground-state number fluctuations become pathologically large (the "grand-canonical catastrophe") and one must be careful about which ensemble represents the experiment.

Where does the grand partition function Ξ = Σ z^N Z_N come from?

It comes from simply grouping the double sum in the normalization by particle number. The grand partition function is Ξ=∑N,se−β(Es(N)−μN)\Xi=\sum_{N,s}e^{-\beta(E_s^{(N)}-\mu N)}, a sum over all particle numbers and, for each, all internal microstates. Because the μN\mu N part of the exponent depends only on NN (not on the internal state ss), you can factor it out of the inner sum: Ξ=∑NeβμN(∑se−βEs(N))\Xi=\sum_N e^{\beta\mu N}\big(\sum_s e^{-\beta E_s^{(N)}}\big). The inner sum over states of fixed NN is exactly the canonical partition function ZN(T,V)Z_N(T,V), and eβμN=zNe^{\beta\mu N}=z^N with z=eβμz=e^{\beta\mu} the fugacity. So Ξ=∑NzNZN\Xi=\sum_N z^N Z_N — the grand partition function is a power series in the fugacity whose coefficients are the canonical partition functions. This makes Ξ\Xi a generating function for the ZNZ_N: expand it in zz and the coefficient of zNz^N tells you the NN-particle canonical partition function. The full exploitation of this structure — including the mode factorization for quantum gases — is developed in the Grand Partition Function article.

Why is the grand potential Ω the natural potential here, and why does Ω = −pV?

Each ensemble has a "natural" thermodynamic potential — the quantity that is minimized at equilibrium given the variables that ensemble holds fixed, and whose logarithm is the partition function. The canonical ensemble (fixed T,V,NT,V,N) has the Helmholtz free energy F=−kBTln⁡ZF=-k_BT\ln Z. The grand ensemble fixes T,V,μT,V,\mu — all intensive except the volume — so its natural potential is Ω=−kBTln⁡Ξ\Omega=-k_BT\ln\Xi, with differential dΩ=−S dT−p dV−N dμ\mathrm d\Omega=-S\,\mathrm dT-p\,\mathrm dV-N\,\mathrm d\mu; from it S=−∂TΩS=-\partial_T\Omega, p=−∂VΩp=-\partial_V\Omega, and ⟨N⟩=−∂μΩ\langle N\rangle=-\partial_\mu\Omega all follow. That Ω=−pV\Omega=-pV is a consequence of extensivity: Ω\Omega is a function of two intensive variables (T,μT,\mu) and one extensive one (VV), so by the Euler relation it must be proportional to VV, and the proportionality constant is exactly −p-p. This is why ln⁡Ξ=pV/kBT\ln\Xi=pV/k_BT directly gives the equation of state. The full derivation of Ω=−pV\Omega=-pV and its consequences is the subject of the Grand Potential article; here it is the potential our ensemble produces.

Before this

Where this leads