When the binomial distribution applies
The binomial distribution counts successes in a fixed number of independent attempts, each with the same chance of succeeding. Twelve heads in twenty coin flips, three defective units in a sample of fifty, seven conversions from a hundred visitors: all the same structure.
Four conditions have to hold, and they are worth checking rather than assuming.
- Fixed n. You decide the number of trials before you start. If you keep going until you get a success, the count follows a geometric or negative binomial distribution instead.
- Two outcomes. Each trial either succeeds or it does not. Anything with three or more categories needs a multinomial model.
- Constant p. The success probability is the same on every trial. Sampling without replacement from a small population violates this, because each draw changes the composition of what remains.
- Independence. One trial's outcome does not affect any other's.
When those hold, everything about the distribution follows from n and p alone. The mean is np, the variance is np(1 - p), and the probability of any particular count comes from a single formula. That is a lot of leverage from two numbers, which is why the binomial is the workhorse of quality inspection, survey work and A/B testing.
Why the formula has three factors
P(X = k) = C(n,k) x pk x (1 - p)n-k. Each factor answers a separate question.
pk is the probability that k specified trials all succeed. Independence lets you multiply, so five particular flips all coming up heads has probability 0.55.
(1 - p)n-k is the probability that the remaining n - k trials all fail. Together these two factors give the probability of one specific sequence - say success, failure, success, success, failure - with exactly k successes.
C(n,k) counts how many such sequences exist. Every arrangement of k successes among n trials has the same probability, so you multiply by the number of arrangements. This is the binomial coefficient, n! divided by k!(n-k)!, and it is the factor people forget: without it you get the probability of one particular ordering rather than of the count.
The mean np is intuitive - twenty trials at 50% average ten successes. The variance np(1 - p) is less obvious, and its shape is informative: it is largest at p = 0.5 and shrinks towards zero as p approaches either 0 or 1. A process that almost always succeeds is highly predictable in its count; one that succeeds half the time is as unpredictable as it can be.
Cumulative probabilities are sums of the individual terms. P(X <= k) adds up the terms from 0 to k, and P(X >= k) is 1 minus the sum up to k - 1. That off-by-one is the most common error in cumulative binomial work, and the reason the calculator reports both cumulative directions explicitly.
Worked example: five heads in ten fair flips
Flip a fair coin ten times. What is the probability of exactly five heads?
- Count the arrangements. C(10,5) = 10! / (5! x 5!) = 3,628,800 / (120 x 120) = 252. There are 252 different orders in which five heads can appear among ten flips.
- Probability of the successes. pk = 0.55 = 0.03125.
- Probability of the failures. (1 - p)n-k = 0.55 = 0.03125.
- Multiply. 252 x 0.03125 x 0.03125 = 252 / 1024 = 0.24609375.
So the single most likely outcome happens only about 25% of the time. That is worth sitting with: "exactly the expected number" is usually a minority outcome, and it gets rarer as n grows because the probability spreads over more possible counts.
For the cumulative version, add the terms. C(10,0) through C(10,5) are 1, 10, 45, 120, 210 and 252, summing to 638. So P(X <= 5) = 638 / 1024 = 0.623046875. By symmetry P(X >= 5) is also 638/1024, and the two overlap in exactly the P(X = 5) term - which is why they add to more than 1.
Now check the summary statistics. The mean is np = 10 x 0.5 = 5, matching the peak. The variance is np(1 - p) = 10 x 0.5 x 0.5 = 2.5, so the standard deviation is sqrt(2.5) = 1.5811. Two standard deviations from the mean spans roughly 1.8 to 8.2 heads, and indeed P(2 <= X <= 8) works out at 0.978515625 - close to the 95% a normal approximation would promise, which is what makes that approximation usable at n = 10 for p = 0.5.
Reading the answer
Decide first which probability you actually want. "Exactly k" is rarely the interesting question outside a textbook; real problems usually ask "k or more" (is this many defects surprising?) or "k or fewer" (will this batch pass?). The cumulative outputs answer those directly, and the interval output covers acceptance ranges of the kind used in sampling plans.
Judge surprise against the mean and standard deviation. A count of 15 successes in 20 trials at p = 0.5 sits (15 - 10) / 2.236 = 2.24 standard deviations above the mean, which the exact calculation puts at P(X >= 15) = 0.020695. Reporting the tail probability is more informative than reporting the count alone, because it accounts for n.
The shape of the distribution depends on p. At p = 0.5 it is symmetric. As p moves towards 0 the distribution is right-skewed, piling up at low counts with a tail to the right; as p moves towards 1 it is left-skewed. The skew fades as n grows, which is the practical content of the central limit theorem for counts: the rule of thumb is that both np and n(1 - p) should exceed about 5 before a normal approximation is trustworthy, and the calculator flags when they do not.
Two related approximations are worth knowing. When n is large and p is small with np moderate, the Poisson distribution with mean np is an excellent and much simpler approximation - the standard case is rare defects in a large batch. When n is large and p is moderate, the normal approximation with mean np and standard deviation sqrt(np(1-p)) works well, provided you apply a continuity correction of half a unit when converting a discrete count into a continuous range.
Ten fair coin flips: the complete distribution
| Heads k | C(10,k) | P(X = k) | P(X <= k) |
|---|---|---|---|
| 0 | 1 | 0.00097656 | 0.00097656 |
| 1 | 10 | 0.00976563 | 0.01074219 |
| 2 | 45 | 0.04394531 | 0.05468750 |
| 3 | 120 | 0.11718750 | 0.17187500 |
| 4 | 210 | 0.20507813 | 0.37695313 |
| 5 | 252 | 0.24609375 | 0.62304688 |
| 6 | 210 | 0.20507813 | 0.82812500 |
| 7 | 120 | 0.11718750 | 0.94531250 |
| 8 | 45 | 0.04394531 | 0.98925781 |
| 9 | 10 | 0.00976563 | 0.99902344 |
| 10 | 1 | 0.00097656 | 1.00000000 |
The coefficients add to 1024 = 2^10, which is the total number of possible sequences. Each probability column entry is the coefficient divided by 1024, and the cumulative column is the running total.
Assumptions that fail in practice
- Sampling without replacement from a small population. Drawing 10 items from a lot of 50 changes p at every draw. The correct model is the hypergeometric distribution; the binomial is an acceptable approximation when the sample is under about 10% of the population.
- Trials that are not independent. Machine faults cluster, customers influence each other, and consecutive items from one shift share a cause. Positive dependence makes extreme counts more likely than the binomial predicts, so tail probabilities are understated.
- A success probability that drifts. Tool wear, operator fatigue and seasonal effects all move p during the run. The observed variance then exceeds np(1 - p), a pattern called overdispersion.
- Stopping when you get the result you wanted. The binomial requires n to be fixed in advance. Continuing to sample until enough successes appear changes the distribution and invalidates any p-value computed from it.
- Confusing at least with more than. P(X >= 5) includes k = 5; P(X > 5) does not. On a discrete distribution the gap between them is a full probability mass, which can be a fifth of the total.
- Applying a normal approximation in the tail. Even when np and n(1-p) exceed 5, the approximation is worst exactly where you usually need it - far out in the tail. Use the exact figures, which is what this page computes.
Relatives of the binomial
Set n = 1 and the binomial becomes the Bernoulli distribution, a single trial. Let n grow with p shrinking so that np stays fixed, and it converges to the Poisson distribution, which is why Poisson is used for defect counts and arrivals. Let n grow with p fixed and it converges to the normal distribution with mean np and variance np(1 - p) - the earliest form of the central limit theorem, proved by de Moivre for p = 0.5 and extended by Laplace.
Sampling without replacement gives the hypergeometric distribution, which is the correct model for acceptance sampling from a finite lot. Counting trials until the first success gives the geometric distribution, and until the r-th success gives the negative binomial.
The binomial coefficient at the front of the formula is pure counting, and the combination calculator computes it on its own. For the underlying probability rules that justify multiplying independent trial probabilities together, see the probability calculator; for updating a belief about p in the light of observed successes, see the Bayes' theorem calculator.
In applied work the binomial usually appears through its tail probabilities. A quality plan that accepts a lot when 2 or fewer of 50 items are defective is a statement about P(X <= 2). An A/B test comparing two conversion rates is comparing two binomial proportions. A confidence interval for a proportion inverts the binomial tails, which is why the exact Clopper-Pearson interval is wider and more conservative than the familiar normal-approximation interval.
