Binomial Distribution
Count successes in n independent trials and watch a Galton board build the distribution
Probability mass function(tap a bar to move the nearest end of the range)
- Mean μ = np
- 5.000
- Variance np(1 − p)
- 2.500
- Std. dev. σ
- 1.581
- Mode
- 5
- Exact (sum of the shaded bars)
- 0.890625
- Normal approx. with continuity correction
- 0.886154error -0.0045
np = 5.0, n(1 − p) = 5.0. The normal approximation is rough unless np and n(1 − p) are both at least about 10.
Galton board
Each ball meets 10 pegs and bounces right with probability p = 0.50. Its bin is the number of rights, so the bins follow Binomial(n, p). Red lines mark the PMF; blue bars are the observed share of balls in each bin.
- Balls landed
- 0
- Sample mean
- –np = 5.000
- Sample variance
- –np(1 − p) = 2.500
- Share in [3, 7]
- –exact 0.8906
With more balls the blue bars settle onto the red PMF lines: the law of large numbers at work on every bin.
What the binomial distribution counts
Repeat the same yes/no experiment n times, independently, with success probability p each time. The number of successes X is a random variable that can be 0, 1, 2, …, n. Its distribution is the binomial distribution, written X ~ Binomial(n, p) or B(n, p).
A Galton board makes this physical. A ball falls through n rows of pegs and at each peg bounces right (a success) with probability p or left with probability 1 − p. The bin it lands in is the number of rights, so one ball is one draw of X. Drop thousands of balls and the pile in the bins takes the shape of the binomial PMF.
The number of paths matters as much as the probability of each path. With n = 10 and p = 0.5 there is only one path to bin 0 but 252 paths to bin 5, which is why the middle bins fill up and the edges stay almost empty.
Bernoulli trials
Fixed n, independent, same p
Counting paths
Sum of simple pieces
Key formulas
Probability mass function
P(X = k) = C(n, k) · pk · (1 − p)n − k, k = 0, 1, …, n
- n
- number of independent trials
- p
- probability of success on each trial
- C(n, k)
- n! / (k! (n − k)!), the number of ways to place k successes among n trials
Mean, variance and mode
E[X] = np, Var(X) = np(1 − p), σ = √(np(1 − p)), mode = ⌊(n + 1)p⌋
Range probability and its normal approximation
P(a ≤ X ≤ b) = Σk=ab P(X = k) ≈ Φ((b + 0.5 − np)/σ) − Φ((a − 0.5 − np)/σ)
- Φ
- standard normal CDF
- ± 0.5
- continuity correction: bar k covers [k − 0.5, k + 0.5]
How the shape depends on n and p
| Setting | Shape | Example |
|---|---|---|
| p = 0.5 | Symmetric about n/2 | Heads in fair coin flips |
| p < 0.5 | Skewed right (long tail toward n) | Defective parts with p = 0.05 |
| p > 0.5 | Skewed left (long tail toward 0) | Free throws made by a 90% shooter |
| np ≥ 10 and n(1 − p) ≥ 10 | Close to a normal curve | Votes for a candidate in a poll of 1000 |
| n large, p small, np moderate | Close to Poisson(np) | Typos in a 500-page book |
How to use this visualizer
- 1Set the number of trials n and the success probability p. The bar chart shows P(X = k) for every k, with the mean as a dashed line and μ ± σ as a bracket above.
- 2Choose a range with the a and b sliders, or tap a bar to move the nearest end. The shaded bars add up to the exact P(a ≤ X ≤ b) shown in the side panel.
- 3Turn on Normal approximation to overlay the bell curve N(np, np(1 − p)) and compare its continuity-corrected answer with the exact one. Try p = 0.05 with n = 20 to see it fail.
- 4In the Galton board, press Drop 1 to follow a single ball, Drop 50 or Play for a stream, and Add 1000 instantly to fill the bins fast.
- 5Watch the blue bars settle onto the red PMF lines, and the sample mean and variance approach np and np(1 − p). Changing n or p clears the board.
Common misconception
Not every count of successes is binomial. Drawing 5 cards from a deck and counting hearts is not, because the draws are made without replacement: each card changes the chance for the next one (that count is hypergeometric). The binomial model needs independent trials with the same p, which holds for sampling with replacement or, approximately, when the sample is a tiny fraction of a large population.Practice problems
Problem 1: Guessing on a quiz
Show solutionHide solution
X ~ Binomial(n = 10, p = 0.25)
P(X = 3) = C(10, 3) · 0.25³ · 0.75⁷ = 120 × 0.015625 × 0.133484 ≈ 0.2503
P(X ≤ 4) = 0.05631 + 0.18771 + 0.28157 + 0.25028 + 0.14600 = 0.92187
P(X ≥ 5) = 1 − 0.92187 = 0.07813
μ = np = 10 × 0.25 = 2.5
σ = √(np(1 − p)) = √(10 × 0.25 × 0.75) = √1.875 ≈ 1.369
P(X = 3) ≈ 0.250, P(X ≥ 5) ≈ 0.078, μ = 2.5, σ ≈ 1.37
Problem 2: Normal approximation for coin flips
Show solutionHide solution
μ = np = 50, σ = √(100 × 0.5 × 0.5) = 5
np = n(1 − p) = 50 ≥ 10, so the approximation is reasonable
With correction: P(44.5 ≤ Y ≤ 55.5), z = (44.5 − 50)/5 = −1.1 and z = (55.5 − 50)/5 = 1.1
Φ(1.1) − Φ(−1.1) = 0.86433 − 0.13567 = 0.7287
Without correction: z = ±1, so Φ(1) − Φ(−1) = 0.6827
0.7287 with the correction (matches the exact value), 0.6827 without (too low by 0.046)
Related topics
Law of Large Numbers
Why the Galton board histogram settles onto the PMF
PDF and CDF
From probability masses to continuous densities and cumulative curves
Normal Distribution
The bell curve that a binomial with large np and n(1 − p) approaches
Central Limit Theorem
A binomial is a sum of n Bernoulli trials, so the CLT explains its bell shape
Discussion
Questions, ideas or a different approach? Join the conversation.