Solution (source code)

= Solution

The <degeneracy factor> $g_A$ counts internal states with the same energy, including the allowed <spin> states. The <chemical potential> $\mu_A$ measures the free-energy cost of changing the number of particles of species $A$; in this convention the rest energy remains in the exponential of the <nonrelativistic Maxwell--Boltzmann number density>.

The <chemical potential> is fixed by the densities of <conserved charges> and by <chemical equilibrium> between reactions. For a reaction $\sum_A\nu_A A=0$, <chemical equilibrium> requires $\sum_A\nu_A\mu_A=0$. Equivalently, when these are the only constraints, $\mu_A$ is a linear combination of the <chemical potentials> of the <conserved charges> carried by $A$. An unconstrained species has zero <chemical potential>. In particular, the <photon chemical potential> vanishes in thermal equilibrium when photon-number-changing reactions are effective.