# The canonical ensemble

Until now we have only considered systems with a fixed value of energy, for which we have seen that the phase space volume is related to the entropy. This kind of ensemble is however really restricting also because the computations made within it are quite complicated (in The monoatomic ideal gas we had to resort to the geometry of hyperspheres in order to compute the phase space volume of the ideal gas, which is the simplest system we can think of!). We therefore need to generalize our considerations to systems which have ${\displaystyle V}$ and ${\displaystyle N}$ fixed, but variable energy; in other words we want to see what happens when we remove the constraint of keeping the energy of a system fixed. This is the essence of the canonical ensemble. However, in order to determine the properties of this ensemble the only thing we can do is to use the tools that we already know, namely the microcanonical ensemble. What we are going to do therefore, in just a few words, is to consider an isolated system (for which the methods of the microncanonical ensemble apply) and see what happens if we consider a small portion of it.

Let us therefore consider a macroscopic isolated system, which we call the heat bath, at temperature ${\displaystyle T}$ composed of ${\displaystyle N_{\text{b}}}$ particles, and a small (but still macroscopic) subsystem of the bath containing ${\displaystyle N}$ particles (namely ${\displaystyle N_{\text{b}},N\gg 1}$ but ${\displaystyle N\ll N_{\text{b}}}$); for now ${\displaystyle N}$ and ${\displaystyle N_{\text{b}}}$ are fixed so the "walls" that enclose the small subsystem are fixed and impermeable and only allow the exchange of energy between the two; we also call ${\displaystyle E}$ the energy of the whole system.

The situation can be represented as follows:

Canonical ensemble

Now, since the total system (the heat bath and the small subsystem) is isolated we can apply to it the tools of the microcanonical ensemble; in particular the probability density in phase space of the whole system will be:

${\displaystyle \rho (\mathbb {Q} _{\text{b}},\mathbb {P} _{\text{b}},\mathbb {Q} ,\mathbb {P} )={\frac {1}{\Omega (E)}}\delta \left[{\mathcal {H}}_{\text{b}}(\mathbb {Q} _{\text{b}},\mathbb {P} _{\text{b}})+{\mathcal {H}}(\mathbb {Q} ,\mathbb {P} )+{\mathcal {V}}(\mathbb {Q} _{\text{b}},\mathbb {Q} )-E\right]}$
where ${\displaystyle {\mathcal {V}}(\mathbb {Q} _{\text{b}},\mathbb {Q} )}$ is the term containing the interaction between the heat bath and the subsystem. This term must exist if we want the two systems to exchange energy, but what we now suppose is that it is neglibigle with respect to the other terms (the energy ${\displaystyle E}$ and the Hamiltonians). Since we want to study the properties of the small subsystem we are interested in finding a probability density which does not contain any information about the heat bath; in other words we want to determine the so called marginalized probability density:
${\displaystyle \rho (\mathbb {Q} ,\mathbb {P} )=\int \rho (\mathbb {Q} _{\text{b}},\mathbb {P} _{\text{b}},\mathbb {Q} ,\mathbb {P} )d\Gamma _{\text{b}}}$
namely:
${\displaystyle \rho (\mathbb {Q} ,\mathbb {P} )={\frac {1}{\Omega (E)}}\int \delta \left[{\mathcal {H}}_{\text{b}}(\mathbb {Q} _{\text{b}},\mathbb {P} _{\text{b}})-\left(E-{\mathcal {H}}(\mathbb {Q} ,\mathbb {P} )\right)\right]d\Gamma _{\text{b}}}$
Now, by definition:
${\displaystyle \Omega _{\text{b}}(E')=\int \delta \left({\mathcal {H}}_{\text{b}}(\mathbb {Q} _{\text{b}},\mathbb {P} _{\text{b}})-E'\right)d\Gamma _{\text{b}}}$
so we can write:
${\displaystyle \rho (\mathbb {Q} ,\mathbb {P} )={\frac {\Omega _{\text{b}}(E-{\mathcal {H}}(\mathbb {Q} ,\mathbb {P} ))}{\Omega (E)}}}$
From the fundamental postulate of statistical mechanics, in terms of the entropy ${\displaystyle S_{\text{b}}}$ of the heat bath we have:
${\displaystyle \Omega _{\text{b}}(E-{\mathcal {H}})=e^{{\frac {1}{k_{B}}}S_{\text{b}}(E-{\mathcal {H}})}}$
Since the subsystem is much smaller than the heat bath we have[1]${\displaystyle {\mathcal {H}}\ll E}$ and so we can expand ${\displaystyle S_{\text{b}}}$ around ${\displaystyle E}$:
${\displaystyle \Omega _{\text{b}}(E-{\mathcal {H}})=e^{{\frac {1}{k_{B}}}\left(S_{\text{b}}(E)-{\mathcal {H}}{\frac {\partial }{\partial E}}S_{\text{b}}(E)+{\frac {{\mathcal {H}}^{2}}{2}}{\frac {\partial ^{2}}{\partial E^{2}}}S_{\text{b}}(E)+\cdots \right)}}$
Since:
${\displaystyle {\frac {\partial S_{\text{b}}}{\partial E}}={\frac {1}{T}}\quad \quad {\frac {\partial ^{2}S_{\text{b}}}{\partial E^{2}}}={\frac {\partial }{\partial E}}{\frac {1}{T}}=-{\frac {1}{T^{2}}}{\frac {\partial T}{\partial E}}=-{\frac {1}{T^{2}}}\left({\frac {\partial E}{\partial T}}\right)^{-1}=-{\frac {1}{T^{2}C_{V}^{\text{b}}}}}$
where ${\displaystyle C_{V}^{\text{b}}}$ is the specific heat of the bath at constant volume, then:
${\displaystyle \Omega _{\text{b}}(E-{\mathcal {H}})=e^{{\frac {1}{k_{B}}}\left(S_{\text{b}}(E)-{\frac {\mathcal {H}}{T}}-{\frac {{\mathcal {H}}^{2}}{2}}{\frac {1}{T^{2}C_{V}^{\text{b}}}}+\cdots \right)}}$
Now, ${\displaystyle {\mathcal {H}}\propto N}$ and ${\displaystyle {\mathcal {H}}^{2}/C_{V}^{\text{b}}\propto N^{2}/N_{\text{b}}=N(N/N_{\text{b}})\ll N}$: all the terms beyond the first order can be neglected[2]. Considering that ${\displaystyle \Omega (E)=\int d\Gamma d\Gamma _{\text{b}}\delta ({\mathcal {H}}_{\text{b}}+{\mathcal {H}}-E)=\int d\Gamma \Omega _{\text{b}}(E-{\mathcal {H}})}$, this leads to the following expression of the canonical probability density:
${\displaystyle \rho (\mathbb {Q} ,\mathbb {P} )={\frac {e^{-\beta {\mathcal {H}}(\mathbb {Q} ,\mathbb {P} )+{\frac {1}{k_{B}}}S_{\text{b}}(E)}}{\int d\Gamma e^{-\beta {\mathcal {H}}(\mathbb {Q} ,\mathbb {P} )+{\frac {1}{k_{B}}}S_{\text{b}}(E)}}}={\frac {e^{-\beta {\mathcal {H}}(\mathbb {Q} ,\mathbb {P} )}}{\int d\Gamma e^{-\beta {\mathcal {H}}(\mathbb {Q} ,\mathbb {P} )}}}}$
where:
${\displaystyle Z=\int d\Gamma e^{-\beta {\mathcal {H}}(\mathbb {Q} ,\mathbb {P} )}}$

is called partition function of the system. Sometimes ${\displaystyle e^{-\beta {\mathcal {H}}}}$ is called Boltzmann weight.
1. In fact, ${\displaystyle E\propto N+N_{\text{b}}}$ while ${\displaystyle {\mathcal {H}}\propto N\ll N_{\text{b}}\approx N+N_{\text{b}}}$, so indeed ${\displaystyle {\mathcal {H}}\ll E}$.
2. They are all terms that are smaller the bigger the heat bath is. This fact could also be justified saying that we can consider the limit where the dimensions of the heat bath tend to infinity, therefore ${\displaystyle C_{V}^{\text{b}}\to \infty }$ and we can neglect all the terms from the second order on.