Probability, Binomial Distribution

Binomial Distribution

If you flip a coin n times, the number of "heads" could be anywhere from 0 to n. What is the probability of each outcome? For each k, what is the probability of obtaining k heads and n-k tails? The answer is given by the binomial distribution.

Before we derive any formulas, we already know how the distribution behaves for large n, because we explored this example in the law of large numbers. The mean is n/2, andmost of the time, k will be very close to the mean. A perfect split is not likely. We won't obtain precisely 500,000 heads out of a million flips; but k will usually lie between 498,000 and 502,000, and the ratio becomes even tighter as n increases.

The binomial distribution is computed for an arbitrary coin, which may or may not be fair. The coin comes up heads, or the trial "succeeds", with probability p. Tails, or failure, is assigned the probability q, where p+q = 1. Now use the principle of independent events. The odds of succeeding twice in a row are p2, while the odds of failing twice in a row are q2. One success, k = 1, can happen in two ways, giving the formula pq+qp. This is the same as 2pq. So the probabilities for k = {0,1,2} are, respectively, p2, 2pq, and q2. This looks a lot like (p+q)2.

Bring in a third trial, and build the third row of Pascal's triangle. The nth trial builds the nth row of the triangle. In general, there are (n:k) ways to produce k successes from n trials, where (n:k) is the binomial coefficient. Each of these combinations has a probability of pkqn-k. Put this together to write the density function f(k) in closed form, for all k.

f(k) = (n:k) × pkqn-k

As a sanity check, take the sum of f(k), as k runs from 0 to n. This is merely the expansion of (p+q)n via the binomial theorem. Therefore the sum is (p+q)n, or 1, as it should be.

Remember that the mean of the sum is the sum of the means, and similarly for variance. Compute the mean and variance for a single trial, then multiply by n for the mean and variance of the binomial distribution.

In a single trial, 0 appears with probability q and 1 appears with probability p. This gives a mean of p. To find the variance, compute the weighted sum of x2, which is simply p, then subtract the mean squared. The result is p-p2, or pq. Multiply by n for the binomial distribution. The mean is np, and the variance is npq.

If k is expressed as a ratio, the number of successes divided by the number of trials, and if n approaches infinity, the mean holds steady at p, and the variance is pq/n. The standard deviation has a denominator of sqrt(n), which is what we saw in the law of large numbers.