summaryrefslogtreecommitdiff
path: root/source/know/concept/canonical-ensemble/index.md
blob: aca2a3318aca2a7cd0ac776757c9a8732444b12f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
---
title: "Canonical ensemble"
date: 2021-07-10
categories:
- Physics
- Thermodynamics
- Thermodynamic ensembles
layout: "concept"
---

The **canonical ensemble** or **NVT ensemble** builds on
the [microcanonical ensemble](/know/concept/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](/know/concept/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} \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](/know/concept/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{
        F
        \equiv - k T \ln{Z}
        = \Expval{U_A} - T S_A
    }
\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".



## References
1.  H. Gould, J. Tobochnik,
    *Statistical and thermal physics*, 2nd edition,
    Princeton.