Category:
$\newcommand{\pp}[2][]{\frac{\partial #1}{\partial #2}}$
For an isolated system, all microstates, \(E,V,N\), are equally probable. For a system in equilibrium with a heat bath, energy is no longer a constant and the microstates are specified by \(T,V,N\). The probability that a \text{color}{blue}{microstate} will have energy \(E\) is given by the Boltzmann distribution. In this case all macroscopic properties of \textcolor{blue}{macriscopic} states can then be computed using the canonical partition function. Throughout this discussion it was system is a closed system, and therefore the number of particles, \(N\), remained constant.
it will be assumed that the system of interest can exchange energy as well particles with the environment. The system and environment together form an isolated system, \(S_0\), with total energy \(E_0\) and \(N_0\). The volume of the system, \(V\), is assumed to remain fixed. The number of particle in the system can vary. For a given \(N\), let the energy levels of the system be arranged in increasing order
\begin{equation}\label{EQ01}
E_{N1} \le E_{N2} \le \ldots \le E_{Nr}\le \ldots.
\end{equation}
Here the index \(Nr\) denotes the \(r^\text{th}\) energy level of the system when it has \(N\) particles. The environment occupies a volume \(V_0-V\) and has \(N_0-N\) particles. This specification of environment also specifies corresponding microstate, \(E_\text{Nr}, V, N\) of the system and the probability of system being in this microstate can now be written down in terms of the number of microstate \(\Omega_2\) of the environment as follows.
\begin{eqnarray}\nonumber
p_{Nr}
&=& \Omega_2(E_0-E_{Nr}, V_0-V, N_0-N)\\\label{EQ02}
&=&\text{const} \exp\left\{S_2(E_0-E_{Nr}, V_0-V, N_0-N)\right\}
\end{eqnarray}
Next we make use of the fact that the environment is very large compared to the system, and therefore \(E_0>> E, V_0>>V, N_0>> N\). A Taylor expansion of the entropy is made and we write
\begin{eqnarray}\nonumber
S_2&&(E_0-E_{Nr}, V_0-V, N_0-N)\\
&&\qquad =S_2(E_0,V_0,N_0) - \pp[S_2]{V_0}V - \pp[S_2]{E_{Nr}}E_{Nr} - \pp[S_2]{N_0} N\\\label{EQ03}
&&\qquad=\Big[S_2 - \pp[S_2]{V_0}V\Big] - \frac{E_{Nr}}{T} + \frac{mu N}{T}.
\end{eqnarray}
where introduced the {\tt chemical potential} \(\mu \) and the temperature \(T\) of the heat bath by means of the equations \begin{equation}\label{EQ04}
\mu \stackrel{\text{def}}{\equiv} - T \pp[S_2]{N_0}, \text{ and } \frac{1}{T} -\frac[S_2]{E_0}.
\end{equation}
In equilibrium, both the system and the environment have the same temperature and also the same chemical potential where \(S_2\) is the entropy of the environment. The required probability is given by \(p_{Nr}= \ln \Omega\) and where the number of microstates is \(\omega = \exp(k S_0(E_0-E_{Nr}, V_0-V, N_0-N))\). Making use of \eqref{EQ03}, we get
\begin{equation}\label{EQ05}
p_{Nr} = \text{const}. \exp[\beta(\mu N - E_{Nr}].
\end{equation}
The overall constant is fixed by demanding the the sum of all probabilities add up to unity. Thus we obtain \begin{eqnarray}\label{EQ06}
C \sum_{Nr}\exp[\beta(\mu N - E_{Nr}] =1.
\end{eqnarray}
Defining the grand canonical partition function \(\mathcal Z\) by
\begin{equation}\label{EQ07}
\mathcal Z \equiv \mathcal Z(T, \mu, V) = \sum_{Nr}\exp[\beta(\mu N - E_{Nr}],
\end{equation}
we rewrite the probability \(P_{Nr}\) as
\begin{equation}\label{EQ08}
p_{Nr} = \frac{\exp[\beta(\mu N - E_{Nr})]}{\mathcal Z}.
\end{equation}
This probability distribution is called, \eqref{EQ08}, the {\tt Gibbs distribution}, or the {\tt grand canonical distribution}. The function \(\mathcal Z\) is seen to be a function of \(T, V\) and \(\mu\). The Gibbs distribution function is the basic result for applications to open systems.