2.4.11 · D3Thermodynamics & Statistical Mechanics (Advanced)

Worked examples — Average energy from partition function

2,787 words13 min readBack to topic

This page is the drill floor for the parent formula Here is Boltzmann's constant (just a number that converts temperature into energy), and is "coldness" — big means cold, small means hot. Note the definition carefully: it means , a fact we lean on whenever a limit produces . Every symbol used below was earned in the parent note; if you need the derivation, go back there first. Here we only use the tool, across every situation it can face.


The scenario matrix

Before working anything, let us list every kind of problem this one formula can meet. The formula never changes — but (the sum of Boltzmann weights) looks different depending on the situation, and the limits we sanity-check depend on the situation too.

Cell Case class What makes it special Example
A Finite discrete sum = a handful of terms Ex. 1 (two-level), Ex. 2 (three-level)
B Degenerate levels one energy hit by several states → multiply by count Ex. 3
C Infinite discrete sum need a geometric/known series Ex. 4 (oscillator)
D Continuous integral = an integral, use a Gaussian Ex. 5 (equipartition)
E Cold limit () system freezes into ground state checks in Ex. 1, 4
F Hot limit () all states equally likely checks in Ex. 1, 3
G Shifted zero of energy add a constant to every Ex. 6
H Real-world word problem translate physics → energies → Ex. 7
I Exam twist (given , find ) second derivative / fluctuations Ex. 8

The rule of the game: six through eight worked examples that together touch every cell. Each one tells you which cell(s) it lands in.


Example 1 — Two-level system · cells A, E, F

Step 1 — Build . There are two microstates, so the sum has two terms: Why this step? is a sum over states, and here "all states" means exactly two.

Step 2 — Take the log and differentiate.

= -\frac{-\varepsilon e^{-\beta\varepsilon}}{1+e^{-\beta\varepsilon}} = \frac{\varepsilon\,e^{-\beta\varepsilon}}{1+e^{-\beta\varepsilon}}.$$ *Why this step?* $\partial_\beta \ln Z = \frac1Z\partial_\beta Z$, and $\partial_\beta e^{-\beta\varepsilon}=-\varepsilon e^{-\beta\varepsilon}$ — the minus in the exponent supplies the $-$ that cancels the formula's $-$, leaving a positive answer (energies are $\ge0$, so this *must* be positive). **Step 3 — Tidy.** Multiply top and bottom by $e^{\beta\varepsilon}$: $$\boxed{\;\langle E\rangle = \frac{\varepsilon}{e^{\beta\varepsilon}+1}\;}$$ *Why this step?* Multiplying by $e^{\beta\varepsilon}/e^{\beta\varepsilon}=1$ (no change to the value) clears the small exponential from the numerator, giving the tidy "Fermi-like" form $\varepsilon/(e^{\beta\varepsilon}+1)$ whose limits are easier to read by eye. > [!verify] Verify — the two forecasts > - **Cold, $\beta\to\infty$:** $e^{\beta\varepsilon}\to\infty$, so $\langle E\rangle\to 0$. ✓ (frozen in ground state) > - **Hot, $\beta\to 0$:** $e^{\beta\varepsilon}\to 1$, so $\langle E\rangle\to \varepsilon/2$. ✓ (average of the two states) > [!intuition] Reading the figure below > The figure plots $\langle E\rangle/\varepsilon$ (vertical axis, running $0$ to $\varepsilon/2$) against > temperature $k_BT/\varepsilon$ (horizontal axis, cold on the left, hot on the right). The **mint curve** > is our result $1/(e^{\varepsilon/k_BT}+1)$. Notice its two ends: on the far left (cold) the lavender > arrow marks it pinned near $0$ — the spin is frozen in the ground state; on the far right (hot) the > coral dashed line marks the ceiling $\varepsilon/2$ that the curve flattens toward — both states equally > likely. The whole graph is the two forecasts made visible: a smooth climb from $0$ to $\varepsilon/2$. ![[deepdives/dd-physics-2.4.11-d3-s01.png]] --- ## Example 2 — Three-level ladder · cell A > [!example] Statement > Energies $0,\ \varepsilon,\ 2\varepsilon$ (one state each). Find $\langle E\rangle$ at the special temperature > where $\beta\varepsilon = \ln 2$ (i.e. $e^{-\beta\varepsilon}=\tfrac12$). > [!intuition] Forecast > With weights $1,\ \tfrac12,\ \tfrac14$ the top level is least likely, so the average should sit **below** the middle energy $\varepsilon$. Expect something like $0.5\varepsilon$–$0.7\varepsilon$. **Step 1 — Build $Z$.** Three terms, and set $x=e^{-\beta\varepsilon}=\tfrac12$: $$Z = 1 + x + x^2 = 1 + \tfrac12 + \tfrac14 = \tfrac74.$$ *Why this step?* Each level of energy $n\varepsilon$ contributes weight $e^{-\beta n\varepsilon}=x^n$. **Step 2 — Average directly (cross-check of the derivative).** Since the states are $0,\varepsilon,2\varepsilon$ with weights $1,\tfrac12,\tfrac14$: $$\langle E\rangle = \frac{0\cdot 1 + \varepsilon\cdot\tfrac12 + 2\varepsilon\cdot\tfrac14}{7/4} = \frac{\varepsilon}{7/4} = \frac{4\varepsilon}{7}.$$ *Why this step?* $\langle E\rangle=\sum_i p_i E_i$ is always available; here it is quick and confirms the $Z$-method. > [!verify] Verify > $4/7 \approx 0.571$, which is below $\varepsilon$ — matches the forecast. Also below $\varepsilon$ makes sense: the cheap ground state pulls the mean down. --- ## Example 3 — Degenerate excited level + hot limit · cells B, F > [!example] Statement > Ground energy $0$ (one state) and an excited energy $\varepsilon$ that is **three-fold degenerate** > (three different states all share energy $\varepsilon$). Find $\langle E\rangle$ and its hot-limit value. > [!intuition] Forecast > Three doors lead to the excited level but only one to the ground level. So even the hot limit will > **not** split $50$–$50$; the excited level is favoured $3:1$, dragging the hot average toward $\tfrac34\varepsilon$. **Step 1 — Build $Z$ with a multiplicity.** $$Z = 1 + 3e^{-\beta\varepsilon}.$$ *Why this step?* Degeneracy $g$ means $g$ identical terms, so we just multiply that Boltzmann weight by $3$. **Step 2 — Differentiate.** $$\langle E\rangle = -\frac{\partial}{\partial\beta}\ln\!\big(1+3e^{-\beta\varepsilon}\big) = \frac{3\varepsilon\,e^{-\beta\varepsilon}}{1+3e^{-\beta\varepsilon}} = \frac{3\varepsilon}{e^{\beta\varepsilon}+3}.$$ *Why this step?* Same log-slope-flip; the $3$ rides along untouched by the derivative. > [!verify] Verify — hot limit > $\beta\to 0$: $e^{\beta\varepsilon}\to1$, so $\langle E\rangle\to \dfrac{3\varepsilon}{1+3}=\dfrac34\varepsilon$. ✓ matches the $3:1$ forecast (three excited doors vs one ground door). > Cold limit $\beta\to\infty$: $\langle E\rangle\to 0$ ✓ (ground state still wins when it is the only cheap option). See the [[Two-level system / Schottky anomaly]] for how degeneracy reshapes the heat-capacity bump. --- ## Example 4 — Quantum oscillator: infinite sum + cold freeze · cells C, E > [!example] Statement > A 1D quantum oscillator has levels $E_n = n\hbar\omega$, $n=0,1,2,\dots$ (infinitely many). > Find $\langle E\rangle$ and its behaviour as $T\to 0$. > [!intuition] Forecast > Infinitely many levels, but the high ones are exponentially unlikely. As $T\to0$ everything should > collapse to the ground level $n=0$, giving $\langle E\rangle\to 0$. **Step 1 — Sum the geometric series.** With $r=e^{-\beta\hbar\omega}$ and $|r|<1$: $$Z = \sum_{n=0}^{\infty} r^n = \frac{1}{1-r} = \frac{1}{1-e^{-\beta\hbar\omega}}.$$ *Why this step?* This is the only place we need a **known infinite sum**: $\sum r^n = 1/(1-r)$. It converges because $r<1$ (positive energies, positive $\beta$). **Step 2 — Log and differentiate.** $\ln Z = -\ln(1-e^{-\beta\hbar\omega})$, so $$\langle E\rangle = -\frac{\partial}{\partial\beta}\Big[-\ln(1-e^{-\beta\hbar\omega})\Big] = \frac{\hbar\omega\, e^{-\beta\hbar\omega}}{1-e^{-\beta\hbar\omega}} = \frac{\hbar\omega}{e^{\beta\hbar\omega}-1}.$$ *Why this step?* Chain rule on the log delivers the numerator $\hbar\omega e^{-\beta\hbar\omega}$. > [!verify] Verify > - **Cold, $\beta\to\infty$:** denominator $e^{\beta\hbar\omega}-1\to\infty$, so $\langle E\rangle\to 0$. ✓ > - **Hot, $\beta\to 0$:** $e^{\beta\hbar\omega}-1\approx\beta\hbar\omega$, so $\langle E\rangle\to \hbar\omega/(\beta\hbar\omega)=1/\beta=k_BT$. ✓ (classical [[Equipartition theorem]] value for an oscillator; deeper treatment in [[Quantum harmonic oscillator — thermal]]). --- ## Example 5 — Continuous quadratic mode (equipartition) · cell D > [!example] Statement > A degree of freedom with energy $E=\tfrac12 a x^2$, $x\in(-\infty,\infty)$ (a "spring" coordinate). > Find $\langle E\rangle$. > [!intuition] Forecast > This is the classic case that should give exactly $\tfrac12 k_BT$ per quadratic term — the equipartition result. **Step 1 — $Z$ is now an integral.** $$Z = \int_{-\infty}^{\infty} e^{-\beta a x^2/2}\,dx.$$ *Why this step?* Continuous states → the sum over microstates becomes an integral over the coordinate $x$. **Step 2 — Do the Gaussian integral by substitution.** Start from the master fact $\int_{-\infty}^{\infty} e^{-u^2}\,du=\sqrt{\pi}$. Our exponent is $-\tfrac12\beta a\,x^2$, so let $u = \sqrt{\tfrac{\beta a}{2}}\,x$, which gives $du = \sqrt{\tfrac{\beta a}{2}}\,dx$, i.e. $dx = \sqrt{\tfrac{2}{\beta a}}\,du$. Then $$Z = \int_{-\infty}^{\infty} e^{-u^2}\,\sqrt{\tfrac{2}{\beta a}}\,du = \sqrt{\tfrac{2}{\beta a}}\int_{-\infty}^{\infty} e^{-u^2}\,du = \sqrt{\tfrac{2}{\beta a}}\,\sqrt{\pi} = \sqrt{\frac{2\pi}{\beta a}}\ \propto\ \beta^{-1/2}.$$ *Why this step?* The substitution turns our integral into the standard one; the prefactor $\sqrt{2/(\beta a)}$ is exactly the $dx/du$ bookkeeping, which is why the answer is $\sqrt{2\pi/(\beta a)}$ and not just $\sqrt{\pi}$. **Step 3 — Only the $\beta$-dependence matters.** $\ln Z = -\tfrac12\ln\beta + \text{const}$, so $$\langle E\rangle = -\frac{\partial \ln Z}{\partial\beta} = -\left(-\frac{1}{2\beta}\right)=\frac{1}{2\beta}=\tfrac12 k_BT.$$ *Why this step?* Any $\beta$-independent constant (the $\ln(2\pi/a)/2$ part) vanishes under $\partial_\beta$ — we only ever needed the power of $\beta$. The last equality uses the definition $\beta\equiv 1/(k_BT)$, so $1/\beta = k_BT$ exactly (restated from the top of this page), turning $1/(2\beta)$ into $\tfrac12 k_BT$. > [!verify] Verify > At $T$ where $k_BT=4$ (in some energy unit), $\langle E\rangle = 2$. Units: $[k_BT]=$ energy ✓. Each quadratic term = $\tfrac12 k_BT$ — the [[Equipartition theorem]] in two lines. --- ## Example 6 — Shift the zero of energy · cell G > [!example] Statement > Take Example 1's two-level system but measure energies from a shifted origin: states have energies > $E_0$ and $E_0+\varepsilon$ (both raised by a constant $E_0$). Show $\langle E\rangle$ = (old answer) $+\,E_0$. > [!intuition] Forecast > Sliding every energy up by $E_0$ should slide the average up by exactly $E_0$ — nothing physical changed, only the ruler's zero. **Step 1 — New partition function.** $$Z' = e^{-\beta E_0} + e^{-\beta(E_0+\varepsilon)} = e^{-\beta E_0}\big(1 + e^{-\beta\varepsilon}\big) = e^{-\beta E_0} Z,$$ where $Z=1+e^{-\beta\varepsilon}$ is the old one. *Why this step?* A common factor $e^{-\beta E_0}$ pulls out of every term. **Step 2 — Logs turn products into sums.** $$\ln Z' = -\beta E_0 + \ln Z.$$ *Why this step?* This is exactly why the $\ln$ form is so powerful — the constant shift becomes an additive $-\beta E_0$ term. **Step 3 — Differentiate.** $$\langle E\rangle' = -\frac{\partial}{\partial\beta}\big(-\beta E_0 + \ln Z\big) = E_0 - \frac{\partial \ln Z}{\partial\beta} = E_0 + \frac{\varepsilon}{e^{\beta\varepsilon}+1}.$$ *Why this step?* $\partial_\beta(-\beta E_0)=-E_0$, and the formula's leading minus flips it to $+E_0$. > [!verify] Verify > With $E_0=5$, $\varepsilon$ such that $e^{\beta\varepsilon}=1$ (hot), old answer $=\varepsilon/2$; new $=5+\varepsilon/2$. The shift is exactly $E_0$. ✓ Also note $C_V$ is **unchanged** by a constant shift (the second derivative kills $-\beta E_0$). --- ## Example 7 — Word problem: two conformations of a molecule · cell H > [!example] Statement > A protein hinge has a **folded** state (energy $0$) and an **open** state (energy $\varepsilon = 2\,k_B T_{\text{room}}$, > i.e. $\beta\varepsilon=2$ at room temperature). What fraction of energy $\langle E\rangle/\varepsilon$ is stored at room $T$? > [!intuition] Forecast > The open state costs $2k_BT$ — noticeably more than thermal energy — so it should be fairly rare. Expect $\langle E\rangle/\varepsilon$ to be small, maybe around $0.1$. **Step 1 — Translate to energies.** Two states, $0$ and $\varepsilon$ — same shape as Example 1. *Why this step?* Word problems reduce to "list the states and their energies." **Step 2 — Use the Example 1 result** with $\beta\varepsilon = 2$: $$\frac{\langle E\rangle}{\varepsilon} = \frac{1}{e^{\beta\varepsilon}+1} = \frac{1}{e^{2}+1}.$$ *Why this step?* We already derived $\langle E\rangle=\varepsilon/(e^{\beta\varepsilon}+1)$; just plug in the number. **Step 3 — Evaluate.** $e^2\approx 7.389$, so $\dfrac{1}{7.389+1}=\dfrac{1}{8.389}\approx 0.119$. *Why this step?* We turn the symbolic fraction into a number so we can compare it to our forecast and to a measurable probability — a formula only becomes a *prediction* once it is a number. We need $e^2$ because $\beta\varepsilon=2$ sits in the exponent, and $e^2$ is just the fixed constant $\approx 7.389$. > [!verify] Verify > $\langle E\rangle/\varepsilon\approx 0.119$ — about $12\%$, small as forecast. Cross-check against the open-state Boltzmann probability: $p_{\text{open}}=\dfrac{e^{-\beta\varepsilon}}{1+e^{-\beta\varepsilon}}=\dfrac{e^{-2}}{1+e^{-2}}\approx 0.119$. These match because **only the open state carries energy** ($E_{\text{folded}}=0$), so $\langle E\rangle=\varepsilon\,p_{\text{open}}$, hence $\langle E\rangle/\varepsilon=p_{\text{open}}$. ✓ The prediction–verification cycle closes cleanly: the energy fraction *is* the open-state occupation probability. --- ## Example 8 — Exam twist: given $Z$, find the heat capacity · cell I > [!example] Statement > For the two-level system ($0,\varepsilon$), compute the heat capacity $C_V = \partial\langle E\rangle/\partial T$ > and find the temperature (in terms of $\varepsilon/k_B$) where it peaks — the **Schottky** peak. > [!intuition] Forecast > Heat capacity measures how much the average energy responds to a nudge in $T$. It must vanish at both > extremes (frozen at cold, saturated at hot) and therefore **peak somewhere in the middle**, at a > temperature of order $\varepsilon/k_B$. > [!definition] What is $\sigma_E^2$? > $\sigma_E^2$ is the **energy variance**: how much the energy jitters around its average. In symbols > $\sigma_E^2 \equiv \langle E^2\rangle - \langle E\rangle^2$, where $\langle E^2\rangle=\sum_i p_i E_i^2$ > is the average of the *squared* energy. It is always $\ge 0$ (a spread cannot be negative). > The parent note showed that the **second** $\beta$-derivative of $\ln Z$ manufactures exactly this > spread: differentiating twice pulls out an $E_i^2$ and an $(\sum E_i)^2$ piece, giving > $$\partial^2_\beta \ln Z = \langle E^2\rangle - \langle E\rangle^2 = \sigma_E^2.$$ > Feeding this into $C_V=\partial\langle E\rangle/\partial T$ and using $\beta=1/k_BT$ (so $\partial_T = -k_B\beta^2\partial_\beta$) gives the fluctuation identity > $$C_V = k_B\beta^2\,\sigma_E^2.$$ **Step 1 — Get $C_V$.** From Example 1, $\langle E\rangle=\varepsilon/(e^{\beta\varepsilon}+1)$. Differentiating in $T$ (or equivalently using $C_V=k_B\beta^2\sigma_E^2$ from the box) gives $$C_V = k_B\,(\beta\varepsilon)^2\,\frac{e^{\beta\varepsilon}}{(e^{\beta\varepsilon}+1)^2}.$$ *Why this step?* $\langle E\rangle$ depends on $T$ only through the combination $\beta\varepsilon$; the chain rule brings down the $(\beta\varepsilon)^2$ prefactor (this is the [[Heat capacity and energy fluctuations]] identity made concrete). **Step 2 — Find the peak.** Let $u=\beta\varepsilon$, so $C_V(u)=k_B\,u^2 e^{u}/(e^{u}+1)^2$. To locate the maximum we set $dC_V/du=0$. Carrying out that derivative (product + quotient rule) and dividing off the common positive factor $u\,e^{u}/(e^{u}+1)^2$ leaves the tidy condition $$u = 2\,\frac{e^{u}-1}{e^{u}+1} = 2\tanh(u/2).$$ *Why this step?* A peak is where the slope is zero, so we solve $dC_V/du=0$. The messy derivative factorises: the $\tfrac{e^u-1}{e^u+1}$ combination is exactly $\tanh(u/2)$ (definition of $\tanh$), which is why the condition collapses to $u=2\tanh(u/2)$. Solving numerically: $u^\ast \approx 2.399$, i.e. $k_BT^\ast \approx \varepsilon/2.399 \approx 0.417\,\varepsilon$. > [!verify] Verify > Peak at $k_BT^\ast\approx 0.417\,\varepsilon$ — of order $\varepsilon/k_B$ and firmly between the two zero limits, as forecast. Plugging $u^\ast=2.399$ back gives $C_V^\ast\approx 0.439\,k_B$. Both cold ($u\to\infty$) and hot ($u\to0$) limits give $C_V\to0$ ✓ — the hallmark [[Two-level system / Schottky anomaly]] bump. ✓ --- > [!recall]- Which cell did each example fill? > Ex.1 ::: A, E, F (finite discrete + both limits) > Ex.2 ::: A (three-level finite sum) > Ex.3 ::: B, F (degeneracy + hot limit) > Ex.4 ::: C, E (infinite geometric sum + cold freeze) > Ex.5 ::: D (continuous Gaussian integral, equipartition) > Ex.6 ::: G (shifted energy zero) > Ex.7 ::: H (real-world word problem) > Ex.8 ::: I (given $Z$ → heat capacity, Schottky peak) > [!mnemonic] The universal recipe > **"List → weight → sum → log → slope → flip."** List states, weight by $e^{-\beta E}$, sum into $Z$, > take $\ln$, take the $\beta$-slope, flip the sign: same six moves for every cell above. ## Active recall > [!recall] Self-test > quick-1 ::: Why does a three-fold degeneracy push the hot-limit energy above $\varepsilon/2$? Because the excited level has three doors vs one for the ground, so the hot average tends to $\tfrac34\varepsilon$. > quick-2 ::: Why does shifting all energies by $E_0$ leave $C_V$ unchanged? The shift adds $-\beta E_0$ to $\ln Z$, whose second $\beta$-derivative is zero. > quick-3 ::: In the oscillator, why does the hot limit give $k_BT$ not $\tfrac12 k_BT$? A vibrational mode has *two* quadratic terms (kinetic + potential), each $\tfrac12 k_BT$.