Also, the Fermi energy is the amount of energy needed to subtract or add an electron to the system at zero temperature. These quantities are called the ionization energy and electron affinity . They are the same in a metal, but different in an insulator. Therefore, in an insulator the only correct definition of the Fermi energy is the zero temperature limit of the chemical potential. The total energy of the system is where the factor two is again due to spin degeneracy.
Many important quantities are of the form .
Our two special cases are like this. In order to get thermal averages we have to sum over all states of the electrons. This is a three dimensional integration. For quantites like we are interested in, we only need to know how many states there are in the energy range . This is measured by the density of states.