Categories: Physics, Thermodynamic ensembles, Thermodynamics.

The **canonical ensemble** or **NVT ensemble** builds on the microcanonical ensemble, by allowing the system to exchange energy with a very large heat bath, such that its temperature \(T\) remains constant, but internal energy \(U\) does not. The conserved state functions are the temperature \(T\), the volume \(V\), and the particle count \(N\).

We refer to the system of interest as \(A\), and the heat bath as \(B\). The combination \(A\!+\!B\) forms a microcanonical ensemble, i.e. it has a fixed total energy \(U\), and eventually reaches an equilibrium with a uniform temperature \(T\) in both \(A\) and \(B\).

Assuming that this equilibrium has been reached, we want to know which microstates \(A\) prefers in that case. Specifically, if \(A\) has energy \(U_A\), and \(B\) has \(U_B\), which \(U_A\) does \(A\) prefer?

Let \(c_B(U_B)\) be the number of \(B\)-microstates with energy \(U_B\). Then the probability that \(A\) is in a specific microstate \(s_A\) is as follows, where \(U_A(s_A)\) is the resulting energy:

\[\begin{aligned} p(s_A) = \frac{c_B(U - U_A(s_A))}{D} \qquad \quad D \equiv \sum_{s_A} c_B(U - U_A(s_A)) \end{aligned}\]

In other words, we choose an \(s_A\), and count the number \(c_B\) of compatible \(B\)-microstates.

Since the heat bath is large, let us assume that \(U_B \gg U_A\). We thus approximate \(\ln{p(s_A)}\) by Taylor-expanding \(\ln{c_B(U_B)}\) around \(U_B = U\):

\[\begin{aligned} \ln{p(s_A)} &= -\ln{D} + \ln\!\big(c_B(U - U_A(s_A))\big) \\ &\approx - \ln{D} + \ln{c_B(U)} - \bigg( \dv{(\ln{c_B})}{U_B} \bigg) \: U_A(s_A) \end{aligned}\]

Here, we use the definition of entropy \(S_B \equiv k \ln{c_B}\), and that its \(U_B\)-derivative is \(1/T\):

\[\begin{aligned} \ln{p(s_A)} &\approx - \ln{D} + \ln{c_B(U)} - \frac{U_A(s_A)}{k} \Big( \pdv{S_B}{U_B} \Big) \\ &\approx - \ln{D} + \ln{c_B(U)} - \frac{U_A(s_A)}{k T} \end{aligned}\]

We now define the **partition function** or **Zustandssumme** \(Z\) as follows, which will act as a normalization factor for the probability:

\[\begin{aligned} \boxed{ Z \equiv \sum_{s_A}^{} \exp\!(- \beta U_A(s_A)) } = \frac{D}{c_B(U)} \end{aligned}\]

Where \(\beta \equiv 1/ (k T)\). The probability of finding \(A\) in a microstate \(s_A\) is thus given by:

\[\begin{aligned} \boxed{ p(s_A) = \frac{1}{Z} \exp\!(- \beta U_A(s_A)) } \end{aligned}\]

This is the **Boltzmann distribution**, which, as it turns out, maximizes the entropy \(S_A\) for a fixed value of the average energy \(\expval{U_A}\), i.e. a fixed \(T\) and set of microstates \(s_A\).

Because \(A\!+\!B\) is a microcanonical ensemble, we know that its thermodynamic potential is the entropy \(S\). But what about the canonical ensemble, just \(A\)?

The solution is a bit backwards. Note that the partition function \(Z\) is not a constant; it depends on \(T\) (via \(\beta\)), \(V\) and \(N\) (via \(s_A\)). Using the same logic as for the microcanonical ensemble, we define “equilibrium” as the set of microstates \(s_A\) that \(A\) is most likely to occupy, which must be the set (as a function of \(T,V,N\)) that maximizes \(Z\).

However, \(T\), \(V\) and \(N\) are fixed, so how can we maximize \(Z\)? Well, as it turns out, the Boltzmann distribution has already done it for us! We will return to this point later.

Still, \(Z\) does not have a clear physical interpretation. To find one, we start by showing that the ensemble averages of the energy \(U_A\), pressure \(P_A\) and chemical potential \(\mu_A\) can be calculated by differentiating \(Z\). As preparation, note that:

\[\begin{aligned} \pdv{Z}{\beta} = - \sum_{s_A} U_A \exp\!(- \beta U_A) \end{aligned}\]

With this, we can find the ensemble averages \(\expval{U_A}\), \(\expval{P_A}\) and \(\expval{\mu_A}\) of the system:

\[\begin{aligned} \expval{U_A} &= \sum_{s_A} p(s_A) \: U_A = \frac{1}{Z} \sum_{s_A} U_A \exp\!(- \beta U_A) = - \frac{1}{Z} \pdv{Z}{\beta} \\ \expval{P_A} &= - \sum_{s_A} p(s_A) \pdv{U_A}{V} = - \frac{1}{Z} \sum_{s_A} \exp\!(- \beta U_A) \pdv{U_A}{V} \\ &= \frac{1}{Z \beta} \pdv{V} \sum_{s_A} \exp\!(- \beta U_A) = \frac{1}{Z \beta} \pdv{Z}{V} \\ \expval{\mu_A} &= \sum_{s_A} p(s_A) \pdv{U_A}{N} = \frac{1}{Z} \pdv{N} \sum_{s_A} \exp\!(- \beta U_A) \pdv{U_A}{N} \\ &= - \frac{1}{Z \beta} \pdv{N} \sum_{s_A} \exp\!(- \beta U_A) = - \frac{1}{Z \beta} \pdv{Z}{N} \end{aligned}\]

It will turn out more convenient to use derivatives of \(\ln{Z}\) instead, in which case:

\[\begin{aligned} \expval{U_A} = - \pdv{\ln{Z}}{\beta} \qquad \quad \expval{P_A} = \frac{1}{\beta} \pdv{\ln{Z}}{V} \qquad \quad \expval{\mu_A} = - \frac{1}{\beta} \pdv{\ln{Z}}{N} \end{aligned}\]

Now, to find a physical interpretation for \(Z\). Consider the quantity \(F\), in units of energy, whose minimum corresponds to a maximum of \(Z\):

\[\begin{aligned} F \equiv - k T \ln{Z} \end{aligned}\]

We rearrange the equation to \(\beta F = - \ln{Z}\) and take its differential element:

\[\begin{aligned} \dd{(\beta F)} = - \dd{(\ln{Z})} &= - \pdv{\ln{Z}}{\beta} \dd{\beta} - \pdv{\ln{Z}}{V} \dd{V} - \pdv{\ln{Z}}{N} \dd{N} \\ &= \expval{U_A} \dd{\beta} - \beta \expval{P_A} \dd{V} + \beta \expval{\mu_A} \dd{N} \\ &= \expval{U_A} \dd{\beta} + \beta \dd{\expval{U_A}} - \beta \dd{\expval{U_A}} - \beta \expval{P_A} \dd{V} + \beta \expval{\mu_A} \dd{N} \\ &= \dd{(\beta \expval{U_A})} - \beta \: \big( \dd{\expval{U_A}} + \expval{P_A} \dd{V} - \expval{\mu_A} \dd{N} \big) \end{aligned}\]

Rearranging and substituting the fundamental thermodynamic relation then gives:

\[\begin{aligned} \dd{(\beta F - \beta \expval{U_A})} &= - \beta \: \big( \dd{\expval{U_A}} + \expval{P_A} \dd{V} - \expval{\mu_A} \dd{N} \big) = - \beta T \dd{S_A} \end{aligned}\]

We integrate this and ignore the integration constant, leading us to the desired result:

\[\begin{aligned} - \beta T S_A &= \beta F - \beta \expval{U_A} \quad \implies \quad F = \expval{U_A} - T S_A \end{aligned}\]

As was already suggested by our notation, \(F\) turns out to be the **Helmholtz free energy**:

\[\begin{aligned} \boxed{ \begin{aligned} F &\equiv - k T \ln{Z} \\ &= \expval{U_A} - T S_A \end{aligned} } \end{aligned}\]

We can therefore reinterpret the partition function \(Z\) and the Boltzmann distribution \(p(s_A)\) in the following “more physical” way:

\[\begin{aligned} Z = \exp\!(- \beta F) \qquad \quad p(s_A) = \exp\!\Big( \beta \big( F \!-\! U_A(s_A) \big) \Big) \end{aligned}\]

Finally, by rearranging the expressions for \(F\), we find the entropy \(S_A\) to be:

\[\begin{aligned} S_A = k \ln{Z} + \frac{\expval{U_A}}{T} \end{aligned}\]

This is why \(Z\) is already maximized: the Boltzmann distribution maximizes \(S_A\) for fixed values of \(T\) and \(\expval{U_A}\), leaving \(Z\) as the only “variable”.

- H. Gould, J. Tobochnik,
*Statistical and thermal physics*, 2nd edition, Princeton.

© Marcus R.A. Newman, a.k.a. "Prefetch".
Available under CC BY-SA 4.0.