Solution (source code)

= Solution

The appropriate quantity to minimize is the <energy> including exchange of particles with the <Electron> reservoir, $\mathcal E=E-\mu N$. The <occupation of an interacting localized electron level> follows from
$$
\begin{array}{c|c|c|c}
N&E&\text{number of spin states}&E-\mu N\\\hline
0&0&1&0\\
1&\epsilon&2&\epsilon-\mu\\
2&2\epsilon+U&1&2\epsilon+U-2\mu
\end{array}
$$
\b[For repulsion $U>0$], the first <Electron> costs $\epsilon$ and the second costs $\epsilon+U$. Comparing all three grand <energies> gives
$$
\boxed{N(\mu)=\begin{cases}0,&\mu<\epsilon,\\1,&\epsilon<\mu<\epsilon+U,\\2,&\mu>\epsilon+U.\end{cases}}
$$
\b[For attraction $U<0$], the singly occupied state never minimizes the grand <energy>. At the crossing of the empty and doubly occupied states, $\mu_*=\epsilon+U/2$, its grand <energy> is $-U/2>0$, while both competing states have zero grand <energy>. Hence
$$
\boxed{N(\mu)=\begin{cases}0,&\mu<\epsilon+U/2,\\2,&\mu>\epsilon+U/2.\end{cases}}
$$
For $U=0$ the two thresholds coincide at $\mu=\epsilon$, giving a direct $0\to2$ step. At a threshold, distinct occupations are degenerate; zero-<temperature> minimization alone does not select a unique occupation. A <grand canonical ensemble> at small positive <temperature> smooths the steps, with
$$
\Xi=1+2e^{-\beta(\epsilon-\mu)}+e^{-\beta(2\epsilon+U-2\mu)},\qquad
\langle N\rangle=\frac{2e^{-\beta(\epsilon-\mu)}+2e^{-\beta(2\epsilon+U-2\mu)}}{\Xi}.
$$
In particular, the equal-weight empty/pair limit for $U<0$ gives <mean> occupation one exactly at its crossing; this is not a finite-width singly occupied plateau.

\Image[/past-exam-of-the-physics-b-course-of-the-university-of-cambridge/2018/paper-2-2018-defect-occupancy.png]
{title=Zero-temperature occupation of a localized <impurity level in a crystal> with repulsive, zero and attractive interaction}
{description=Original plots of the minimizing occupation away from degeneracy points. Dashed vertical lines mark the chemical potentials at which different occupations have equal grand energy. Their vertical segments indicate jumps, not intermediate stable states.}