MaxwellBoltzmann statistics
In statistical mechanics, MaxwellBoltzmann statistics describes the statistical distribution of material particles over various energy states in thermal equilibrium, when the temperature is high enough and density is low enough to render quantum effects negligible. MaxwellBoltzmann statistics are therefore applicable to almost any terrestrial phenomena for which the temperature is above a few tens of kelvins.
The expected number of particles with energy \epsilon_i for MaxwellBoltzmann statistics is N_i where:
\frac{N_i}{N} = \frac {g_i} {e^{(\epsilon_i-\mu)/kT}} = \frac{g_i e^{-\epsilon_i/kT}}{Z}
where:
- N_i is the number of particles in state i
- \epsilon_i is the energy of the i-th state
- g_i is the degeneracy of energy level i, the number of particle's states (excluding the "free particle" state) with energy \epsilon_i
-  is the chemical potential
- k is Boltzmann's constant
- T is absolute temperature
- N is the total number of particles
- Z is the partition function
- e(...) is the exponential function
Equivalently, the distribution is sometimes expressed as
\frac{N_i}{N} = \frac {1} {e^{(\epsilon_i-\mu)/kT}}= \frac{e^{-\epsilon_i/kT}}{Z}
where the index i  now specifies a particular state rather than the set of all states with energy \epsilon_i

# A derivation of the MaxwellBoltzmann distribution
In this particular derivation, the Boltzmann distribution will be derived using the assumption of distinguishable particles, even though the ad hoc correction for Boltzmann counting is ignored, the results remain valid.
Suppose we have a number of energy levels, labelled by index i , each level  having energy \epsilon_i and containing a total of N_i particles. To begin with, let's ignore the degeneracy problem. Assume that there is only one way to put N_i particles into energy level i.
The number of different ways of performing an ordered selection of one object from N objects is obviously N. The number of different ways of selecting 2 objects from N objects, in a particular order, is thus N(N-1) and that of selecting n objects in a particular order is seen to be N!/(N-n)!. The number of ways of selecting 2 objects from N objects without regard to order is N(N-1) divided by the number of ways 2 objects can be ordered, which is 2!. It can be seen that the number of ways of selecting n objects from N objects without regard to order is the binomial coefficient: N!/n!(N-n)!. If we have a set of boxes numbered 1,2, \ldots, k, the number of ways of selecting N_1 objects from N objects and placing them in box 1, then selecting N_2 objects from the remaining N-N_1 objects and placing them in box 2 etc. is
\left(\frac{N_k!}{N_k!0!}\right)
where the extended product is over all boxes containing one or more objects. If the i-th box has a "degeneracy" of g_i, that is, it has g_i sub-boxes, such that any way of filling the i-th box where the number in the sub-boxes is changed is a distinct way of filling the box, then the number of ways of filling the i-th box must be increased by the number of ways of distributing the N_i objects in the g_i boxes. The number of ways of placing N_i distinguishable objects in g_i boxes is g_i^{N_i}. Thus the number of ways (W) that N atoms can be arranged in energy levels each level i having g_i distinct states such that the i-th level has N_i atoms is:
For example, suppose we have three particles, a, b, and c, and we have three energy levels with degeneracies 1, 2, and 1 respectively. There are 6 ways to arrange the 3 particles so that N_1 = 2, N_2 = 1 and N_3 = 0.
The six ways are calculated from the formula:
\left(\frac{1^2}{2!}\right)
\left(\frac{2^1}{1!}\right)
\left(\frac{1^0}{0!}\right)=6
We wish to find the set of N_i for which W is maximized, subject to the constraint that there be a fixed number of particles, and a fixed energy. The maxima of W and \ln(W) are achieved by the same values of N_i and, since it is easier to accomplish mathematically, we will maximize the latter function instead. We constrain our solution using Lagrange multipliers forming the function:
f(N_1,N_2,...,N_n)=\ln(W)+\alpha(N-\sum N_i)+\beta(E-\sum N_i \epsilon_i)
Using Stirling's approximation for the factorials
N! \approx N^N e^{-N},
we obtain:
\ln (N!) = N \ln N - N
Then
\ln W=\ln\left=\ln N!+\sum\limits_{i=1}^n\left(N_i\ln g_i-N_i\ln N_i + N_i\right)
Finally
f(N_1,N_2,...,N_n)=N\ln(N)-N+\alpha N +\beta E +
\sum\limits_{i=1}^n\left(N_i\ln g_i-N_i\ln N_i + N_i-(\alpha+\beta\epsilon_i) N_i\right)
In order to maximize the expression above we apply Fermat's theorem (stationary points), according to which local extrema, if exist, must be at critical points (partial derivatives vanish):
\frac{\partial f}{\partial N_i}=\ln g_i-\ln N_i -(\alpha+\beta\epsilon_i) = 0
By solving the equations above (i=1\ldots n) we arrive to an expression for N_i:
N_i = \frac{g_i}{e^{\alpha+\beta \epsilon_i}} 
It can be shown thermodynamically that  = 1/kT where k is Boltzmann's constant and T is the temperature, and that  = -/kT where  is the chemical potential, so that finally:
N_i = \frac{g_i}{e^{(\epsilon_i-\mu)/kT}} 
Note that the above formula is sometimes written:
N_i = \frac{g_i}{e^{\epsilon_i/kT}/z} 
where z=exp(\mu/kT) is the absolute activity.
Alternatively, we may use the fact that
to obtain the population numbers as
N_i = N\frac{g_i e^{-\epsilon_i/kT}}{Z} 
where Z is the partition function defined by:
Z = \sum_i g_i e^{-\epsilon_i/kT}

# Another derivation
In the above discussion, the Boltzmann distribution function was obtained via directly analysing the multiplicities of a system. Alternatively, one can make use of the canonical ensemble. In a canonical ensemble, a system is in thermal contact with a reservoir.  While energy is free to flow between the system and the reservoir, the reservoir is thought to have infinitely large heat capacity as to maintain constant temperature, T, for the combined system.
In the present context, our system is assumed to be have energy levels \epsilon _i with degeneracies g_i. As before, we would like to calculate the probability that our system has energy \epsilon_i.
If our system is in state \; s_1, then there would be a corresponding number of microstates available to the reservoir. Call this number \; \Omega _ R (s_1). By assumption, the combined system (of the system we are interested in and the reservoir) is isolated, so all microstates are equally probable. Therefore, for instance, if  \; \Omega _ R (s_1) = 2 \; \Omega _ R (s_2) , we can conclude that our system is twice as likely to be in state \; s_1 than \; s_2. In general, if \; P(s_i) is the probability that our system is in state \; s_i,
Since the entropy of the reservoir \; S_R = k \ln \Omega _R, the above becomes
Next we recall the thermodynamic identity (from the first law of thermodynamics):
In a canonical ensemble, there is no exchange of particles, so the d N_R term is zero. Similarly, d V_R = 0.  This gives
where \; U_R (s_i)  and \; E(s_i)  denote the energies of the reservoir and the system at s_i, respectively. For the second equality we have used the conservation of energy. Substituting into the first equation relating P(s_1), \; P(s_2):
\frac{P(s_1)}{P(s_2)} =  \frac{ e^{ - E(s_1) / kT } }{ e^{ - E(s_2) / kT} }
which implies, for any state s of the system
P(s) = \frac{1}{Z} e^{- E(s) / kT}
where Z is an appropriately chosen "constant" to make total probability 1. (Z is constant provided that the temperature T is invariant.) It is obvious that
where the index s runs through all microstates of the system. If we index the summation via the energy eigenvalues instead of all possible states, degeneracy must be taken into account. The probability of our system having energy \epsilon _i is simply the sum of the probabilities of all corresponding microstates:
where, with obvious modification,
Z = \sum _j g_j  e^{- \epsilon _j / kT},
this is the same result as before.

### Comments
- Notice that in this formulation, the initial assumption "... suppose the system has total N particles..." is dispensed with. Indeed, the number of particles possessed by the system plays no role in arriving at the distribution. Rather, how many particles would occupy states with energy \epsilon _i follows as an easy consequence.
- What has been presented above is essentially a derivation of the canonical partition function. As one can tell by comparing the definitions, the Boltzman sum over states is really no different from the canonical partition function.
- Exactly the same approach can be used to derive FermiDirac and BoseEinstein statistics. However, there one would replace the canonical ensemble with the grand canonical ensemble, since there is exchange of particles between the system and the reservoir. Also, the system one considers in those cases is a single particle state, not a particle. (In the above discussion, we could have assumed our system to be a single atom.)

# Limits of applicability
The BoseEinstein and FermiDirac distributions may be written:
N_i = \frac{g_i}{e^{(\epsilon_i-\mu)/kT}\pm 1} 
Assuming the minimum value of \epsilon_i is small, it can be seen that the condition under which the MaxwellBoltzmann distribution is valid is when
For an ideal gas, we can calculate the chemical potential using the development in the SackurTetrode article to show that:
where E is the total internal energy, S is the entropy, V is the volume,  and  \Lambda is the thermal de Broglie wavelength. The condition for the applicability of the MaxwellBoltzmann distribution for an ideal gas is again shown to be