Binomial Distribution Calculator
Enter the number of trials, the chance of success on each, and the number of successes you are asking about. Coin flips use p = 0.5.
P(X = k)
0.246094
P(X ≤ k)
0.623047
P(X ≥ k)
0.623047
P(X < k)
0.376953
P(X > k)
0.376953
P(a ≤ X ≤ b)
0.890625
Mean np
5
Standard deviation
1.5811
How it works
A binomial experiment repeats the same yes/no trial n times, each trial independent with the same probability p of success: flipping a coin ten times, inspecting twenty parts that each have a 3% defect rate, taking a 15-question multiple-choice test by guessing. The binomial distribution gives the probability of each possible number of successes.
A particular sequence with k successes and n − k failures has probability p^k (1 − p)^(n−k). There are C(n, k) = n! ÷ (k!(n − k)!) such sequences, so P(X = k) is C(n, k) times that. The cumulative probabilities add up the P(X = j) terms over the range you ask about: at most k, at least k, or between a and b inclusive.
The mean number of successes is np and the standard deviation is √(np(1 − p)). Both tails are added term by term rather than taken as 1 minus the other tail, so a small probability in the tail keeps its precision. For n above 56 the coefficients are evaluated in log space, so large n never overflows.
Formula
P(X = k) = C(n, k) · p^k · (1 − p)^(n − k) C(n, k) = n! ÷ (k! (n − k)!) P(X ≤ k) = Σ P(X = j) for j = 0 … k P(X ≥ k) = Σ P(X = j) for j = k … n P(a ≤ X ≤ b) = Σ P(X = j) for j = a … b μ = n·p σ = √(n·p·(1 − p)) for n > 56: ln P(X = k) = lnΓ(n+1) − lnΓ(k+1) − lnΓ(n−k+1) + k·ln p + (n−k)·ln(1−p)
Example
Ten fair coin flips, exactly 5 heads: C(10, 5) = 252 and 0.5⁵ × 0.5⁵ = 1/1024, so P(X = 5) = 252 ÷ 1024 = 0.246094. At most 5 heads adds C(10, 0) through C(10, 5): (1 + 10 + 45 + 120 + 210 + 252) ÷ 1024 = 638 ÷ 1024 = 0.623047, and by symmetry at least 5 heads is also 0.623047. Between 3 and 7 heads is 912 ÷ 1024 = 0.890625. The mean is 10 × 0.5 = 5 heads with standard deviation √2.5 = 1.5811.
Twenty parts with a 30% defect rate, exactly 6 defective: C(20, 6) × 0.3⁶ × 0.7¹⁴ = 38,760 × 0.000729 × 0.006782 = 0.191639, and at most 6 defective is 0.608010, the figure a cumulative binomial table gives as 0.6080.
Assumptions and limitations
- The trials are independent and p is the same on every trial. Drawing without replacement from a small batch violates this; the hypergeometric distribution is the right model there.
- n is limited to 100,000. For larger n the normal approximation with mean np and standard deviation √(np(1 − p)) is the practical tool.
- Probabilities are rounded to six decimal places for display; a value below 0.0000005 shows as 0.
Frequently asked questions
How do I get the probability of at least one success?
Set k = 1 and read P(X ≥ k). Equivalently it is 1 − P(X = 0) = 1 − (1 − p)ⁿ, which the probability calculator computes directly.
Why does P(X ≤ k) + P(X ≥ k) come to more than 1?
Both include P(X = k). The pairs that add to exactly 1 are P(X ≤ k) with P(X > k), and P(X < k) with P(X ≥ k).
More in Math & Geometry calculators.