The binomial distribution is one of the most useful models in probability: it counts the number of successes in a fixed number of independent, identical trials. Whether you are calculating the chance of getting at least 7 heads in 20 coin flips, estimating the probability that at most 2 items in a batch of 50 are defective, or working out how likely it is that exactly 3 out of 10 surveyed customers say yes, the same formula applies.
How it works
Each trial is independent and has exactly two outcomes: success (probability p) or failure (probability 1 − p). After n trials the number of successes X follows a Binomial(n, p) distribution. The probability mass function (PMF) gives the exact probability of seeing k successes:
P(X = k) = C(n, k) · p^k · (1 − p)^(n − k)
where C(n, k) = n! / (k! · (n − k)!) is the number of ways to choose k successes from n trials. The cumulative distribution function (CDF) sums the PMF from 0 to k:
P(X ≤ k) = Σ_{i=0}^{k} C(n, i) · p^i · (1 − p)^(n − i)
The calculator evaluates everything in log-space — using ln C(n, k) + k ln p + (n−k) ln(1−p) before exponentiating — so results stay numerically precise up to n = 150 without any external library.
Key distribution statistics are derived directly from the parameters:
- Mean: μ = n · p
- Variance: σ² = n · p · (1 − p)
- Standard deviation: σ = √(n · p · (1 − p))
Worked example
A manufacturing line produces components with a 3% defect rate (p = 0.03). A quality inspector samples n = 50 components at random. What is the probability that at most 2 are defective?
Using the calculator with n = 50, p = 0.03, mode = “at most k”, k = 2:
- P(X = 0) = C(50,0) · 0.03⁰ · 0.97⁵⁰ ≈ 0.2181
- P(X = 1) = C(50,1) · 0.03¹ · 0.97⁴⁹ ≈ 0.3372
- P(X = 2) = C(50,2) · 0.03² · 0.97⁴⁸ ≈ 0.2555
- P(X ≤ 2) ≈ 0.8108 — about 81%
The mean number of defects is μ = 50 × 0.03 = 1.5, and the standard deviation is σ = √(50 × 0.03 × 0.97) ≈ 1.21.
| Scenario | n | p | Query | Result |
|---|---|---|---|---|
| Fair coin, exactly 5 heads | 10 | 0.5 | P(X = 5) | ≈ 24.6% |
| Defect rate 3%, at most 2 bad | 50 | 0.03 | P(X ≤ 2) | ≈ 81.1% |
| Survey 20 people, at least 8 yes (40% base) | 20 | 0.4 | P(X ≥ 8) | ≈ 59.6% |
| Ad clicks, between 3 and 6 of 30 (10% CTR) | 30 | 0.1 | P(3 ≤ X ≤ 6) | ≈ 61.6% |
Formula note
The binomial coefficient C(n, k) — also written ⁿCₖ or “n choose k” — counts the number of distinct ways to pick k items from n without regard to order. For n = 10, k = 3: C(10, 3) = 10! / (3! × 7!) = 120. When n is large these factorials overflow standard arithmetic, which is why the calculator uses the equivalent log-sum form and only exponentiates at the final step.
Every calculation runs entirely in your browser. No values are sent to any server.