Binomial distribution calculator
Exact probabilities for the number of successes in n tries, drawn as the whole distribution.
The binomial distribution gives the probability of exactly k successes in n independent tries that each succeed with the same probability p. In 20 tries at a 30 % chance, the probability of at most 7 successes is 0.7723 and of exactly 6 is 0.1916. The calculator above computes these exactly, for a single value, a cumulative “at most” or “at least”, or a range, and draws the whole distribution so you can see which outcomes you are adding up.
The formula
C(n, k) = n! / (k! (n − k)!) counts the orders in which the k successes can occur, and each order has probability pk(1 − p)n−k. Cumulative probabilities are sums of these terms: P(X ≤ 7) adds the eight terms for k = 0 to 7. The mean number of successes is np and the standard deviation is √(np(1 − p)): 6 and 2.05 for 20 tries at 30 %[1]. established
When is a count binomial?
Four conditions, easy to check and easy to forget:
- a fixed number of tries n, decided in advance;
- each try has two outcomes, success or failure;
- the chance of success p is the same on every try;
- the tries are independent: one outcome does not change the next.
Coin flips, a multiple-choice guesser, and defective items drawn from a large batch fit. Draws without replacement from a small batch do not (the chance changes as items are removed; that count is hypergeometric), and neither do counts with no fixed number of tries, such as calls to a help line, which are usually Poisson.
Worked examples
- Exactly. 20 tries, p = 0.3: P(X = 6) = C(20, 6) × 0.36 × 0.714 = 38,760 × 0.000729 × 0.006782 = 0.1916.
- At most. Same tries: P(X ≤ 7) = 0.7723.
- At least. 10 fair coin flips: P(X ≥ 3) = 1 − P(X ≤ 2) = 1 − 56/1024 = 0.9453.
- A range. 100 fair coin flips: P(45 ≤ X ≤ 55) = 0.7287.
The normal approximation, and why it needs a correction
For large n the binomial distribution is close to a normal curve with mean np and standard deviation √(np(1 − p)), which de Moivre discovered in 1733[2]. A binomial count lives on whole numbers, though, and the bar for k covers k − ½ to k + ½. For the 100 coin flips, the normal area from 44.5 to 55.5 gives 0.7287, matching the exact answer, while the area from 45 to 55 gives 0.6827, nearly five points short. That half-unit adjustment is the continuity correction; tick the comparison in the calculator to see it work. With exact calculation available there is rarely a reason to approximate at all[3]. established
To see the distribution built one ball at a time, try the Galton board. The chapter on the binomial and Poisson distributions explains where both shapes come from.
Sources
- (2012). NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.6.6.18 Binomial Distribution. National Institute of Standards and Technology. standard
- (1986). The History of Statistics: The Measurement of Uncertainty before 1900. Belknap Press of Harvard University Press. ISBN 978-0-674-40341-3. scholarship Ch. 2 (de Moivre’s normal approximation, 1733), ch. 4 (Laplace and the central limit theorem), ch. 8 (Galton).
- (2007). Mathematical Statistics and Data Analysis, 3rd edition. Duxbury (Thomson Brooks/Cole). ISBN 978-0-534-39942-9. textbook Ch. 2–4 (distributions, moments), §5.3 (central limit theorem), ch. 7 (survey sampling, the n − 1 divisor), ch. 9 (testing).