# Binomial Theorem

The Binomial Theorem says that for some values a and b and a positive integer n:

The binomial coefficient, , also sometimes written as nCx, is read as n choose x and is calculated as:

where the exclamation mark denotes factorial, so 4! = 1*2*3*4, for example. The binomial coefficient calculates the number of different ways one can order n articles where x of those articles are of one type and therefore indistinguishable from one another and the remaining (n-x) are of another type, again each being indistinguishable from another. The Excel function COMBIN calculates the binomial coefficient.

The arguments underpinning this equation go as follows:

There are n! ways of ordering n articles, since there are n choices for the first article, then (n-1) choices for the second, (n-2) choices for the third, etc. until we are left with just the one choice for the last article. Thus there are n*(n-1)*(n-2)**1 = n! different ways of ordering these articles. Now, suppose that x of these articles were identical: we would not be able to differentiate between two orderings where we simply swapped the positions of two of these articles. Repeating the logic above, there are x! different orderings that would all appear the same to us, so we would only recognise 1/x! of the possible orderings and the number of orderings would now be n!/x!. Now suppose that the remaining (n-x) articles are also identical, but differentiable from the x articles. Then we could only distinguish 1/(n-x)! of the remaining possible orderings and thus the total number of different combinations is given by

.

If we replace a with probability p and b with probability (1-p), the equation becomes:

The summed component

is the binomial probability mass function for x successes in n trials where each trial has a probability p of success. In a binomial process all successes are considered identical and interchangeable, as are all failures.

### Properties of the binomial coefficient

The last identity is known as Vandermondes Theorem (A.T. Vandermonde, 1735-1796).

### Calculating x! for large x

x! is very laborious to calculate for high values of x. For example 100! = 9.3326E+157 and Excel s FACT(x) cannot calculate values higher than 170! The probability mass functions of many discrete probability distributions contain factorials, and we therefore often want to work out factorials for values larger than 170. Algorithms for generating distributions get around any calculation restriction by using approximations. However, if you are performing a Bayesian inference, for example, or attempting to calculate a probability exactly, you can still use the Excel function GAMMALN( ):

Log[x!] = GAMMALN(x+1)

This may allow you to manipulate multiplications of factorials etc by adding them in Log space. However, be warned that this formula will not return exactly the same answer as FACT( ), e.g.:

FACT(170) =                  7.2574156153E+306

EXP(GAMMALN(171)) =     7.2574156148E+306

and while it is possible to get values for GAMMALN(x) where x > 171, Excel will return an error if you attempt to calculate the corresponding EXP(GAMMALN(x)).