Solution (source code)

= Solution

The <chemical potential> is the change in <Helmholtz free energy> when particles are added at fixed <temperature> and <volume>:
$$
\boxed{\mu=\left(\frac{\partial F}{\partial N}\right)_{T,V}.}
$$
Equivalently, $dU=T\,dS-P\,dV+\mu\,dN$ identifies it as the derivative of <internal energy> at fixed <entropy> and <volume>. In equilibrium, systems that exchange particles have equal <chemical potentials>.

The <Fermi energy> is the zero-temperature <chemical potential>, or, for independent <electrons>, the highest occupied single-particle <energy> in the zero-temperature limit. Its numerical value depends on the chosen <energy> reference; the <Fermi energy> need not be measured from the bottom of a band unless that convention is specified.