Binomial Distribution Calculator
The binomial distribution gives the probability of exactly k successes in n independent trials, each with the same success probability p: P(X = k) = C(n, k) × p^k × (1 − p)^(n − k). For 10 fair coin flips, the chance of exactly 5 heads is 252 ÷ 1024 = 0.2461. Enter n, p and k to get the exact, cumulative and tail probabilities.
P(X = k)
0.246094
P(X ≤ k)
0.623047
P(X < k)
0.376953
P(X ≥ k)
0.623047
P(X > k)
0.376953
Mean (np)
5
Standard deviation
1.5811
Working
- P(X = 5) = C(10, 5) × 0.5^5 × 0.5^5 = 0.246094
- P(X ≤ 5) = sum of P(X = i) for i = 0 to 5 = 0.623047
- P(X ≥ 5) = 1 − P(X ≤ 4) = 0.623047
- Mean = n × p = 5; standard deviation = √(n × p × (1 − p)) = 1.5811
Example: 10 fair coin flips, k = 5 heads
- P(X = 5) = C(10, 5) × 0.5^5 × 0.5^5 = 0.246094
- P(X ≤ 5) = sum of P(X = i) for i = 0 to 5 = 0.623047
- P(X ≥ 5) = 1 − P(X ≤ 4) = 0.623047
- Mean = n × p = 5; standard deviation = √(n × p × (1 − p)) = 1.5811
What each result means
P(X = k) is the exact probability. P(X ≤ k) adds the probabilities from 0 up to k, and P(X < k) stops at k − 1. P(X ≥ k) is 1 − P(X ≤ k − 1) and P(X > k) is 1 − P(X ≤ k). The mean is np and the standard deviation is √(np(1 − p)). For 10 flips of a fair coin, P(X ≤ 3) = 176 ÷ 1024 = 0.1719.
The binomial model needs a fixed number of trials, two outcomes per trial, a constant p, and independent trials. Drawing without replacement from a small population breaks independence; use the hypergeometric calculator instead.
How it is computed
Each probability is evaluated in log space with the log-gamma function, so large n does not overflow, and cumulative probabilities are the sum of the exact terms. The code is checked against exact fractions (252 ÷ 1024 and 176 ÷ 1024 for 10 trials at p = 0.5) and published values such as P(X ≤ 3) = 0.6496 for n = 10, p = 0.3. For large n, a normal approximation with mean np and standard deviation √(np(1 − p)) works when np and n(1 − p) are both at least about 10, but the exact calculation here needs no approximation.
Frequently asked questions
- What is the formula for binomial probability?
- P(X = k) = C(n, k) p^k (1 − p)^(n − k), where C(n, k) = n! ÷ (k!(n − k)!).
- How do I find at least k successes?
- Use P(X ≥ k) = 1 − P(X ≤ k − 1), shown in the results.
- What are the mean and variance of a binomial?
- The mean is np and the variance is np(1 − p).
- When is the binomial not appropriate?
- When trials are not independent, p changes between trials, or you sample without replacement from a small population.
Sources and references
- OpenStax Introductory Statistics 2e: Binomial Distribution: the binomial formula, mean and standard deviation.