BoseEinstein statistics
In statistical mechanics, Bose-Einstein statistics (or more colloquially B-E statistics) determines the statistical distribution of identical indistinguishable bosons over the energy states in thermal equilibrium.

# Concept
Bosons, unlike fermions, are not subject to the Pauli exclusion principle: an unlimited number of particles may occupy the same state at the same time.  This explains why, at low temperatures, bosons can behave very differently from fermions; all the particles will tend to congregate together at the same lowest-energy state, forming what is known as a BoseEinstein condensate.
B-E statistics was introduced for photons in 1920 by Bose and generalized to atoms by Einstein in 1924.
The expected number of particles in an energy state i  for B-E statistics is:
n_i = \frac {g_i} {e^{(\varepsilon_i-\mu)/kT} - 1}
with \varepsilon_i > \mu and where:
This reduces to M-B statistics for energies ( i   ) >> kT.

# History
In the early 1920s Satyendra Nath Bose, a professor of University of Dhaka was intrigued by Einstein's theory of light waves being made of particles called photons. Bose was interested in deriving Planck's radiation formula, which Planck obtained largely by guessing. In 1900 Max Planck had derived his formula by manipulating the math to fit the empirical evidence.  Using the particle picture of Einstein, Bose was able to derive the radiation formula by systematically developing a statistics of massless particles without the constraint of particle number conservation. Bose derived Planck's Law of Radiation by proposing different states for the photon. Instead of statistical independence of particles, Bose put particles into cells and described statistical independence of cells of phase space. Such systems allow two polarization states, and exhibit totally symmetric wavefunctions.
He developed a statistical law governing the behaviour pattern of photons quite successfully. However, he was not able to publish his work; no journals in Europe would accept his paper, being unable to understand it. Bose sent his paper to Einstein, who saw the significance of it and used his influence to get it published.

# A derivation of the BoseEinstein distribution
Suppose we have a number of energy levels, labeled by index
\displaystyle i, each level 
having energy \displaystyle \varepsilon_i and containing a total of 
\displaystyle n_i particles.  Suppose each level contains 
\displaystyle g_i
distinct sublevels, all of which have the same energy, and which are distinguishable. For example, two particles may have different momenta, in which case they are distinguishable from each other, yet they can still have the same energy. 
The value of  
\displaystyle g_i associated with level \displaystyle i is called the "degeneracy" of that energy level. Any number of bosons can occupy the same sublevel.
Let \displaystyle w(n,g) be the number of ways of distributing
\displaystyle n particles among the 
\displaystyle g sublevels of an energy level. There is only one way of distributing
\displaystyle n particles with one sublevel, therefore 
\displaystyle w(n,1)=1. It is easy to see that
there are \displaystyle (n+1) ways of distributing
\displaystyle n particles in two sublevels which we will write as:
w(n,2)=\frac{(n+1)!}{n!1!}.
With a little thought 
(See Notes below) 
it can be seen that the number of ways of distributing
\displaystyle n particles in three sublevels is
so that
w(n,3)=\sum_{k=0}^n w(n-k,2) = \sum_{k=0}^n\frac{(n-k+1)!}{(n-k)!1!}=\frac{(n+2)!}{n!2!}
where we have used the following theorem involving binomial coefficients:
\sum_{k=0}^n\frac{(k+a)!}{k!a!}=\frac{(n+a+1)!}{n!(a+1)!}.
Continuing this process, we can see that 
\displaystyle w(n,g)
is just a binomial coefficient
(See Notes below)
w(n,g)=\frac{(n+g-1)!}{n!(g-1)!}.
The number of ways that a set of occupation numbers 
\displaystyle n_i
can be 
realized is the product of the ways that each individual energy level can be populated:
W = \prod_i w(n_i,g_i) =  \prod_i \frac{(n_i+g_i-1)!}{n_i!(g_i-1)!}
\approx\prod_i \frac{(n_i+g_i)!}{n_i!(g_i)!}
where the approximation assumes that g_i \gg 1. 
Following the same procedure used in deriving the MaxwellBoltzmann statistics, 
we wish to find the set of 
\displaystyle n_i
for which 
\displaystyle W 
is maximised, subject to the constraint that there be a fixed number of particles, 
and a fixed energy. The maxima of 
\displaystyle W and \displaystyle \ln(W) occur at the value of 
\displaystyle N_i and, since it is easier to accomplish mathematically, we will maximise the 
latter function instead. We constrain our solution using Lagrange multipliers forming the function:
f(n_i)=\ln(W)+\alpha(N-\sum n_i)+\beta(E-\sum n_i \varepsilon_i)
Using the g_i \gg 1 approximation and using Stirling's approximation for the factorials 
\left(\ln(x!)\approx x\ln(x)-x\right) gives
Taking the derivative with respect to 
\displaystyle n_i,
and setting the result to zero and solving for 
\displaystyle n_i,
yields the BoseEinstein population numbers:
n_i = \frac{g_i}{e^{\alpha+\beta \varepsilon_i}-1}.
It can be shown thermodynamically that 
\displaystyle \beta = \frac{1}{kT}, 
where 
\displaystyle k
is Boltzmann's constant and 
\displaystyle T
is the temperature.
It can also be shown that
\displaystyle \alpha = - \frac{\mu}{kT}, 
where 
\displaystyle \mu
is the chemical potential, so that finally:
n_i = \frac{g_i}{e^{(\varepsilon_i-\mu)/kT}-1}.
Note that the above formula is sometimes written:
n_i = \frac{g_i}{e^{\varepsilon_i/kT}/z-1},
where 
\displaystyle z=\exp(\mu/kT) 
is the absolute activity.

# Notes
The purpose of these notes is to clarify some aspects of the derivation of the Bose-Einstein (B-E) 
distribution for beginners.  The enumeration of cases (or ways) in the B-E distribution can be recast as 
follows.  Consider a game of dice throwing in which there are 
\displaystyle n dice, 
with each dice taking values in the set 
\displaystyle \left\{ 1, \cdots, g \right\}, for g \ge 1.  
The constraints of the game is that the value of a dice 
\displaystyle i, denoted by \displaystyle n_i, has to be 
greater or equal to the value of dice 
\displaystyle (i-1), denoted by 
\displaystyle m_{i-1}, in the previous throw, i.e., 
m_i \ge m_{i-1}.  Thus a valid sequence of dice throws can be described by an 
\displaystyle n-tuple 
\displaystyle \left( m_1 , m_2 , \cdots , m_n \right), such that m_i \ge m_{i-1}.  Let 
\displaystyle S(n,g) denote the set of these valid \displaystyle n-tuples:
Then the quantity \displaystyle w(n,g) (defined above as the number of ways to distribute 
\displaystyle n particles among the 
\displaystyle g sublevels of an energy level) is the cardinality of \displaystyle S(n,g), i.e., the number of elements (or valid \displaystyle n-tuples) in \displaystyle S(n,g).
Thus the problem of finding and expression for 
\displaystyle w(n,g) 
becomes the problem of counting the elements in \displaystyle S(n,g).
Example n = 4, g = 3:
Subset 
\displaystyle (a)
is obtained by fixing all indices 
\displaystyle m_i to 
\displaystyle 1, except for the last index, 
\displaystyle m_n, which is incremented from 
\displaystyle 1 to
\displaystyle g=3.
Subset 
\displaystyle (b)
is obtained by fixing 
\displaystyle m_1 = m_2 = 1, and increment 
\displaystyle m_3 from 
\displaystyle 2 to
\displaystyle g=3; due to the constraint 
-n the indices in 
\displaystyle S(n,g),
the index
\displaystyle m_4 must 
automatically
take values in 
\displaystyle \left\{ 2, 3 \right\}.
The construction of subsets
\displaystyle (c) and 
\displaystyle (d)
follows in the same manner.
Each element of 
\displaystyle S(4,3) can be thought of as a 
multiset 
-f cardinality 
\displaystyle n=4; 
the elements of such multiset are taken from the set 
\displaystyle \left\{ 1, 2, 3 \right\}
-f cardinality 
\displaystyle g=3,
and the number of such multisets is the 
multiset coefficient
More generally, each element of 
\displaystyle S(n,g)
is a 
multiset 
-f cardinality
\displaystyle n
(number of dice)
with elements taken from the set 
\displaystyle \left\{ 1, \cdots, g \right\}
-f cardinality 
\displaystyle g
(number of possible values of each dice),
and the number of such multisets, i.e., 
\displaystyle w(n,g)
is the 
multiset coefficient
which is exactly the same as the 
formula for \displaystyle w(n,g), as derived above with the aid
-f
a theorem involving binomial coefficients, namely
To understand the decomposition
-r for example, 
\displaystyle n=4
and
\displaystyle g=3
To this end, let's rearrange the elements of 
\displaystyle S(4,3) as follows
(111{\color{Red}\underset{=}{3}}),
	 (112{\color{Red}\underset{=}{3}}), 
	 (122{\color{Red}\underset{=}{3}}), 
	 (222{\color{Red}\underset{=}{3}})
(11{\color{Red}\underset{==}{33}}),
	 (12{\color{Red}\underset{==}{33}}), 
	 (22{\color{Red}\underset{==}{33}})
(1{\color{Red}\underset{===}{333}}),
	 (2{\color{Red}\underset{===}{333}})
({\color{Red}\underset{====}{3333}})
Clearly, the subset
\displaystyle (\alpha)
-f 
\displaystyle S(4,3)
is the same as the set
By deleting the index 
\displaystyle m_4=3
(shown in red with double underline)
in
the subset 
\displaystyle (\beta)
-f 
\displaystyle S(4,3),
-ne obtain
the set
In other words, there is a one-to-one correspondence between the subset
\displaystyle (\beta)
-f 
\displaystyle S(4,3)
and the set
\displaystyle S(3,2).  We write
Similarly, it is easy to see that
 (empty set)
Thus we can write
-r more generally,
and since the sets
are non-intersecting, we thus have
with the convention that
Continue the process, we arrive at the following formula
Using the convention (7)2 above, we obtain the formula
keeping in mind that for 
\displaystyle q
and 
\displaystyle p
being constants, we have
It can then be verified that (8) and (2) give the same result for 
\displaystyle w(4,3),
\displaystyle w(3,3), 
\displaystyle w(3,2), etc.

# Information Retrieval
In recent years, Bose Einstein statistics have also been used as a method for term weighting in information retrieval. The method is one of a collection of DFR ("Divergence From Randomness") models, the basic notion being that Bose Einstein statistics may be a useful indicator in cases where a particular term and a particular document have a significant relationship that would not have occurred purely by chance. Source code for implementing this model is available from the Terrier project at the University of Glasgow.