Wolfram Alpha:

```Fermi-Dirac Statistics
-----------------------

The Fermi-Dirac distribution differs from the classical Maxwell-Boltzmann
distribution because the particles it describes are indistinguishable.

Particles are considered to be indistinguishable if their wave packets overlap
significantly. Two particles can be considered to be distinguishable if their
separation is large compared to their DeBroglie wavelength.

For example, the condition of distinguishability is met by molecules in an
ideal gas under ordinary conditions.  On the other hand, two electrons
in the first shell of an atom are inherently indistinguishable because of the
large overlap of their wavefunctions.

Let:

gi = the number of states with energy Ei
ni = the number of electrons in each energy state, Ei

The total number of ways of distributing ni electrons in gi states, Wi,
with the restriction that only one electron can occupy each state, is given by:

- -
Wi = | g | =  gi!/(gi - ni)!ni!  - The binomial coefficient
| n |
- -

The number of possible ways to fit the electrons in the number of
avalable states is called the multiplicity function.

The multiplicity function for the whole system is the product of the
multiplicity functions for each energy Ei:

W = ΠiWi = Πi[g!/(gi - ni)!ni!]

Simplify by taking the log of each side:

lnW = ΣilnWi

= Σiln[g!/(gi - ni)!ni!]

We can using Stirling's Approximation which says that ln(n!) = nln(n) - n
when n is large to get:

lnW = Σi[gilngi - nilnni - (gi - ni)ln(gi - ni)]

Now maximize lnW using the method of Lagrange multipliers and the
constraints Σini = N  and E = ΣiniEi

Therefore,

lnW = Σi[gilngi - nilnni - (gi - ni)ln(gi - ni) - αni - βniEi]

Now the derivative of each of the i's must equal 0.  Thus we can
ignore the Σ.

∂lnW/∂ni = ln{(gi - ni)/ni} - α - βEi = 0

ln{(gi - ni)/ni} = α + βEi

(gi - ni)/ni = exp(α + βEi)

gi - ni = niexp(α + βEi)

gi = ni(1 + exp(α + βEi))

∴ ni = gi/(1 + exp(α + βEi))

The occupation probability = Pi = ni/gi = 1/(1 + exp(α + βEi))

Let α = -EF/KBT and β = 1/KBT where EF is the FERMI ENERGY