---
title: "Counting states: multiplicity and the binary model system"
heading: Why large systems behave predictably
eyebrow: "B11 · Lesson 1 · Counting states: multiplicity and the binary model system"
xp: 40
---

::: hook
A transistor's leakage current doubles every 10 °C or so. A resistor's noise voltage grows as the square root of its temperature. A semiconductor's carrier density depends on $e^{-E_g/2kT}$. All of these come from one idea: a large system wanders at random among all the quantum states it can reach, and almost all of those states look the same from outside. Thermal physics is the art of counting them. This course builds temperature, entropy and the Boltzmann factor from counting, then uses them for noise, radiation, heat flow, thermoelectrics and semiconductor statistics. It starts with the simplest system worth counting: N independent spins, each up or down.
:::

::: play
- N spins, each up or down at random. The stems count the **multiplicity**, the number of arrangements with m spins up, divided by its largest value; the dashed curve is the Gaussian approximation.
- Raise N: the peak's width grows only as √N while the range grows as N, so as a fraction of the range the peak gets sharper and sharper.
- At $N = 10^{20}$ the fractional width would be $10^{-10}$: the system is essentially certain to have half its spins up. That certainty about a random system is what makes thermodynamics work.
:::
:::

```sim plot
view: graph
x: m = 0..60
y: g = 0..1.1
slider: N = 2..60 step 2 = 20
plot: N!/(m!*(N - m)!)/(N!/((N/2)!*(N/2)!))*step(N - m + 0.5) | stems | label: multiplicity ÷ largest
plot: exp(-2*(m - N/2)^2/N) | dashed | samples: 600 | label: Gaussian
readout: total states, 2^N = 2^N
readout: share of states with half up = N!/((N/2)!*(N/2)!)/2^N
readout: fractional width, 1/√N = 1/sqrt(N)
```

::: predict
## Toss 100 fair coins. Which is more likely: exactly 50 heads, or any particular ordered sequence like HTHH...T?

- [x] Exactly 50 heads, by a factor of about 10²⁹
- [ ] They're equally likely
- [ ] The particular sequence
- [ ] Exactly 50 heads, by a factor of 2

::: reveal
Every particular sequence has probability $2^{-100}$, the same as any other. But "50 heads" is a **macrostate** made of $\binom{100}{50} = 1.0 \times 10^{29}$ sequences (**microstates**), so it's that many times more likely, about 8% in all. Thermal physics always works this way: microstates are equally likely, and macrostates differ only in how many microstates they contain.
:::
:::

::: nameit
## Microstates and macrostates

A **microstate** is a complete quantum state of the system; a **macrostate** is what you measure (total magnetization, energy, pressure). The **multiplicity** g is the number of microstates in a macrostate.

## The fundamental assumption

A closed system in equilibrium is equally likely to be in any of its accessible microstates. Everything else in the course follows from this and from counting.

## The binary model system

N independent spins, each with moment ±m along a field. With $N/2 + s$ up and $N/2 - s$ down (spin excess 2s),

$$g(N, s) = \frac{N!}{(N/2 + s)!\,(N/2 - s)!}, \qquad \sum_sg(N, s) = 2^N$$

For large N, Stirling's approximation turns this into a Gaussian:

$$g(N, s) \approx g(N, 0)\,e^{-2s^2/N}, \qquad g(N, 0) \approx 2^N\sqrt{\frac{2}{\pi N}}$$

so s has standard deviation $\frac{\sqrt N}{2}$, and the *fractional* spread of the magnetization is about $\frac{1}{\sqrt N}$.

## Why it matters

A gram of material has about $10^{22}$ particles. Fractional fluctuations of $10^{-11}$ are invisible, so the most probable macrostate is, to any measurement, the only one. That's why thermodynamic quantities have definite values. In small systems, like a few electrons on a nanoscale capacitor or the charge on a single transistor's gate, the fluctuations come back, as noise.
:::

::: example
## Ten spins: how many microstates have exactly five up, and what fraction of all states is that?

::: solution
1. **Count the microstates with five up.**
   $$\binom{10}{5} = 252$$
2. **Divide by all the states.**
   $$\begin{aligned} \frac{252}{2^{10}} &= \frac{252}{1024} \\ &= 24.6\% \end{aligned}$$
3. **Compare with the Gaussian formula.** It's already close at N = 10:
   $$\sqrt{\frac{2}{10\pi}} = 25.2\%$$
4. **At N = 100.** The exact share is 7.96% and the approximation 7.98%.

**Answer:** 252 of the 1024 microstates have exactly five up, 24.6% of all states.
:::
:::

::: example
## A million spins: how likely is the magnetization to be off from zero by more than 0.1% of its maximum?

::: solution
1. **Turn the question into s.** 0.1% of N is 1000, so the question is whether |2s| > 1000, or |s| > 500.
2. **Compare with the spread.** That's exactly one standard deviation:
   $$\begin{aligned} \sigma_s &= \frac{\sqrt N}{2} \\ &= 500 \end{aligned}$$
3. **Probability.**
   $$\begin{aligned} P &= \text{erfc}\left(500\sqrt{2/10^6}\right) \\ &= \text{erfc}(0.707) \\ &= 0.32 \end{aligned}$$
4. **A gram of material.** For N = $10^{22}$, the same 0.1% is $10^8$ standard deviations, and the probability is erfc(7 × 10⁷): zero for every practical purpose.

**Answer:** about 0.32, since for a million spins 0.1% of the maximum is exactly one standard deviation.
:::
:::

::: example
## How good is Stirling's approximation? Compare ln N! with N ln N − N, and with the corrected form N ln N − N + ½ ln(2πN), for N = 10 and N = 100.

::: solution
1. **N = 10, exact.**
   $$\begin{aligned} \ln 10! &= \ln 3\,628\,800 \\ &= 15.104 \end{aligned}$$
2. **N = 10, plain form.** This comes out 13.8% low:
   $$10\ln 10 - 10 = 13.026$$
3. **N = 10, corrected form.** Adding ½ ln(20π) = 2.070 brings it within 0.06%:
   $$13.026 + 2.070 = 15.096$$
4. **N = 100, exact.**
   $$\ln 100! = 363.739$$
5. **N = 100, both forms.** The plain form gives 360.517, now only 0.89% low, and the corrected form gives 363.739 to six figures.
6. **Why the plain form is good enough.** Its error is the ½ ln(2πN) term, which grows only as a logarithm while ln N! grows as N ln N. For a mole of spins the plain form is wrong in about the twenty-second figure, which is why thermal physics can use it without a second thought.

**Answer:** the plain form is 13.8% low at N = 10 and 0.89% low at N = 100; the corrected form is within 0.06% at N = 10 and matches to six figures at N = 100.
:::
:::

::: check
given: N = 8 | 12 | 20; s = 1 | 2 | 3
answer: N!/((N/2 + s)!*(N/2 - s)!)
tolerance: 0.4

## How many microstates of {N} spins have spin excess 2s = 2 × {s}?

::: right
Right. $\frac{N!}{(N/2 + s)!(N/2 - s)!}$ = {answer}.
:::

::: misses
- [N!/((N/2)!*(N/2)!)] That's for s = 0.
- [any] Not yet. Choose which N/2 + s spins point up.
:::
:::

::: check
given: N = 400 | 2000 | 10000; s = 20 | 40 | 60
answer: exp(-2*s^2/N)
tolerance: 1%

## Using the Gaussian approximation, what's g(N, s)/g(N, 0) for N = {N} and s = {s}?

::: right
Right. $e^{-2s^2/N}$ = {answer}.
:::

::: misses
- [exp(-s^2/N)] The exponent is $-2s^2/N$.
- [any] Not yet. Expand ln g to second order in s.
:::
:::

::: check
given: N = 10 | 100 | 1000
answer: sqrt(2/(pi*N))
tolerance: 0.5%

## For large N, what fraction of all $2^N$ microstates have exactly half the spins up? (N = {N}, Gaussian approximation.)

::: right
Right. $\sqrt{\frac{2}{\pi N}}$ = {answer}.
:::

::: misses
- [0.5] The single most likely macrostate still holds only a small share when N is large.
- [any] Not yet. $g(N, 0)/2^N$.
:::
:::

::: check
given: N = 10000 | 1000000 | 100000000
answer: sqrt(N)/2
tolerance: 0.5%

## What's the standard deviation of s for N = {N} spins?

::: right
Right. $\frac{\sqrt N}{2}$ = {answer}.
:::

::: misses
- [sqrt(N)] That's the spread of 2s, the spin excess.
- [any] Not yet. Match $e^{-2s^2/N}$ to $e^{-s^2/2\sigma^2}$.
:::
:::

::: check
given: N = 10000 | 1000000; f = 0.005 | 0.01 | 0.002
answer: erfc(f*N/2*sqrt(2/N))
tolerance: 1%

## What's the probability that the magnetization of N = {N} spins differs from zero by more than a fraction {f} of its maximum (|2s| > fN)?

::: right
Right. erfc$\left(s_0\sqrt{2/N}\right)$ with $s_0 = fN/2$: {answer}.
:::

::: misses
- [erfc(f*N*sqrt(2/N))] The threshold on s is half that on 2s: $s_0 = fN/2$.
- [any] Not yet. s is Gaussian with σ = √N/2.
:::
:::

::: check
given: N = 3 | 4 | 10; n = 2 | 4 | 6
answer: (N + n - 1)!/(n!*(N - 1)!)
tolerance: 0.4

## In how many ways can n = {n} identical energy quanta be shared among N = {N} oscillators?

::: right
Right. $\binom{N + n - 1}{n}$ = {answer}: stars and bars.
:::

::: misses
- [N^n] The quanta are identical, so order doesn't matter.
- [any] Not yet. Arrange n quanta and N − 1 dividers in a row.
:::
:::

::: check
kind: parts
given: N = 20 | 40 | 60

## {N} spins point up or down at random.

::: part
answer: N!/((N/2 + 2)!*(N/2 - 2)!)/2^N
tolerance: 0.5%

### What's the exact probability that N/2 + 2 of them point up?

::: misses
- [any] $\frac{1}{2^N}\binom{N}{N/2 + 2}$.
:::
:::

::: part
answer: sqrt(2/(pi*N))*exp(-8/N)
tolerance: 0.5%

### What does the Gaussian approximation give for the same probability?

::: misses
- [sqrt(2/(pi*N))] Include the factor $e^{-2s^2/N}$ with s = 2.
- [any] $\sqrt{\frac{2}{\pi N}}e^{-2s^2/N}$.
:::
:::
:::

::: check
kind: derivation
vars: N = 100..1000000, s = 0..100

## N spins with spin excess 2s, in the Gaussian approximation.

::: step
answer: N*ln(2) + 0.5*ln(2/(pi*N)) - 2*s^2/N

### What is ln g(N, s)?
:::

::: step
answer: sqrt(N/2)

### At what s has g fallen to 1/e of its peak?
:::

::: right
Right. The peak's width grows as $\sqrt N$ while the range of s grows as N, so the relative width shrinks as $1/\sqrt N$.
:::
:::

::: explain
## Why can a system that changes microstate at random still have a definite temperature, pressure and magnetization?

::: model
Each measurable quantity is shared by an enormous number of microstates, and for a large system nearly all the accessible microstates give nearly the same value. Counting them shows the multiplicity is a peak whose width, as a fraction of the range, shrinks as $1/\sqrt N$. With $10^{22}$ particles the system almost never visits microstates whose measured values differ noticeably from the peak, so the quantity behaves as if it were fixed even though the microstate keeps changing. Only in small systems do the fluctuations become large enough to see, and then they appear as noise.
:::
:::

::: practice

::: check
given: N = 6 | 16; s = 1 | 2
answer: N!/((N/2 + s)!*(N/2 - s)!)
tolerance: 0.4

## g(N = {N}, s = {s})?

::: misses
- [any] $\frac{N!}{(N/2 + s)!(N/2 - s)!}$.
:::
:::

::: check
given: N = 400 | 4000; s = 10 | 30
answer: exp(-2*s^2/N)
tolerance: 1%

## g(s)/g(0) for N = {N}, s = {s}?

::: misses
- [any] $e^{-2s^2/N}$.
:::
:::

::: check
given: N = 5 | 8; n = 3 | 5
answer: (N + n - 1)!/(n!*(N - 1)!)
tolerance: 0.4

## Ways to share {n} quanta among {N} oscillators?

::: misses
- [any] $\binom{N + n - 1}{n}$.
:::
:::
:::
