The relation \(n_{j} \propto e^{-\varepsilon_{j} / k_{\mathrm{B}} T}\) can be
derived by starting with \(S=k_{B} \ln W\). Consider a gas with \(n_{0}\)
molecules in the ground state and \(n_{j}\) in the \(j\) th state. Now add an
energy \(\varepsilon_{j}-\varepsilon_{0}\) to this system so that a molecule is
promoted from the ground state to the \(j\) th state. If the volume of the gas
is kept constant, then no work is done, so \(d U=d q\),
$$
d S=\frac{d q}{T}=\frac{d U}{T}=\frac{\varepsilon_{j}-\varepsilon_{0}}{T}
$$
Now, assuming that \(n_{0}\) and \(n_{j}\) are large, show that
$$
\begin{aligned}
d S &=k_{B} \ln \left\\{\frac{N !}{\left(n_{0}-1\right) ! n_{1} !
\cdots\left(n_{j}+1\right) ! \cdots}\right\\}-k_{B} \ln \left\\{\frac{N
!}{\left(n_{0} ! n_{1} ! \cdots n_{j} ! \cdots\right.}\right\\} \\
&=k_{B} \ln \left\\{\frac{n_{j} !}{\left(n_{j}+1\right) !} \frac{n_{0}
!}{\left(n_{0}-1\right) !}\right\\}=k_{B} \ln \frac{n_{0}}{n_{j}}
\end{aligned}
$$
Equating the two expressions for \(d S\), show that
$$
\frac{n_{j}}{n_{0}}=e^{-\left(\varepsilon_{j}-\varepsilon_{0}\right) /
k_{\mathrm{B}} T}
$$