Boltzmann entropy of a two-box occupancy (source code)

= Boltzmann entropy of a two-box occupancy
{c}
{title2=$S(k)=k_B\ln\binom Nk$}

Take $N=20$ distinguishable, labeled particles and two boxes of equal <volume>. Retain only whether each particle is in the left or right box: use a <bit> $0$ for left and $1$ for right. Each length-20 string is one coarse <microstate> of this toy model. Assume the labels make <independent> side choices with equal <probability>, so the $2^{20}=1\,048\,576$ strings are equiprobable. Equal <volumes> motivate these weights for noninteracting particles with no preference for either box; equal <volumes> alone would not establish them for an arbitrary interacting <gas>.

Now retain only the number $k$ in the left box as the <macrostate>. Choosing which $k$ labels are left gives a <binomial coefficient>, so
$$
\Omega(k)=\binom{20}{k}=\frac{20!}{k!(20-k)!},\qquad
S(k)=k_B\ln\binom{20}{k},\qquad
P(k)=\frac{\binom{20}{k}}{2^{20}}.
$$
The <factorials> count assignments to labels; the <probability> of a <macrostate> sums the <probabilities> of its constituent <microstates>. This is the <binomial distribution> with parameters $20$ and $1/2$. The same <binomial coefficient> appears in the counting of distinguishable <two-level systems>, although here the <macrostate> records occupancy rather than <energy>. https://ocw.mit.edu/courses/8-333-statistical-mechanics-i-statistical-mechanics-of-particles-fall-2013/0cb99318c2ed889316cdcff839759e8d_MIT8_333F13_Lec12.pdf[Mehran Kardar, MIT 8.333 (2013), lecture 12, §IV.C, equations IV.17–18: binomial microstate counts]{ref}

The largest <binomial coefficient> occurs at $k=10$, the balanced <macrostate>. All-left means $k=20$ and supplies just one string. Thus
$$
\begin{aligned}
\Omega(10)&=184\,756,& S(10)/k_B&=\ln184\,756\approx12.126791,\\
\Omega(20)&=1,& S(20)/k_B&=0,\\
P(10)&\approx0.176197,& P(20)&=2^{-20}\approx9.53674\times10^{-7}.
\end{aligned}
$$
There are $184\,756$ balanced strings for every all-left string, even though each individual string has the same <probability>. Exact balance has about $17.6\%$ of the total <probability>; equilibrium reasoning concerns the many <macrostates> near balance too, rather than certainty of exactly ten particles on each side. The diagram compares the counts with their <natural logarithms>.

\Image[/boltzmann-entropy-binomial-macrostates.png]
{title=Counts and Boltzmann entropies of the occupancy macrostates of twenty labeled particles}

Four fair, <independent> coins give a smaller worked example with the same <binomial distribution>. If $k$ is the number of heads, the five <macrostates> $k=0,1,2,3,4$ contain respectively $1,4,6,4,1$ <microstates>. Their <probabilities> are respectively $1/16,4/16,6/16,4/16,1/16$. In particular, two heads is one <macrostate> containing six ordered coin sequences, with <Boltzmann entropy> $k_B\ln6$ in this counting analogy. A prescribed ordered sequence has one realization. The next diagram enumerates the same sixteen strings as left/right assignments.