Consider a system held at a temperature T, whose energy U and number of particles N are allowed to vary. Imagine for example a system connected by a copper pipe to a large reservoir at fixed temperature.
Instead of fixing the number of particles, we fix the chemical potential μ. We define it analogously to temperature, such that
∂N∂S=−Tμ.
Let U be the total combined energy of the system and reservoir, N the combined number of particles.
We then consider the probability that the system is in a specific microstate j. P(Ej,Nj) depends on both the energy of the microstate and the number of particles. We argue
Pj(Ej,Nj)∝degeneracyΓS(j)⋅ΓR(U−Ej,N−Nj).
Where ΓS is the multiplicity of the system and ΓR is the multiplicity of the reservoir. Since we are specifying a specific microstate j, ΓS(j) is the degeneracy. We can write
Where β=1/kT and ξ is the Grand Partition Function, analogous to Z in the canonical ensemble. Taking derivatives we find interesting relations to thermodynamic quantities.