Binomial Distribution

Count successes in n independent trials and watch a Galton board build the distribution

Beginner

Probability mass function(tap a bar to move the nearest end of the range)

0.000.100.20μ ± σμ = 5.00012345678910k (number of successes)
k in [a, b]other k
Distribution
Mean μ = np
5.000
Variance np(1 − p)
2.500
Std. dev. σ
1.581
Mode
5
P(3 ≤ X ≤ 7)
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.

Observed vs theory
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

Each trial has two outcomes, success with probability p and failure with probability 1 − p. A coin flip, a free throw or a yes/no survey answer.

Fixed n, independent, same p

The binomial model needs a fixed number of trials n, trials that do not influence each other, and the same success probability p every time.

Counting paths

There are C(n, k) different orders in which k successes can appear among n trials. Each order has probability pᵏ(1 − p)ⁿ⁻ᵏ, so the PMF multiplies the two.

Sum of simple pieces

X is a sum of n independent 0/1 variables. Means and variances of independent pieces add, which gives E[X] = np and Var(X) = np(1 − p) straight away.

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

SettingShapeExample
p = 0.5Symmetric about n/2Heads in fair coin flips
p < 0.5Skewed right (long tail toward n)Defective parts with p = 0.05
p > 0.5Skewed left (long tail toward 0)Free throws made by a 90% shooter
np ≥ 10 and n(1 − p) ≥ 10Close to a normal curveVotes for a candidate in a poll of 1000
n large, p small, np moderateClose to Poisson(np)Typos in a 500-page book

How to use this visualizer

  1. 1
    Set 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.
  2. 2
    Choose 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.
  3. 3
    Turn 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.
  4. 4
    In 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.
  5. 5
    Watch 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

A quiz has 10 multiple-choice questions with 4 options each. A student guesses every answer at random. Find the probability of exactly 3 correct answers, the probability of passing with at least 5 correct, and the mean and standard deviation of the number correct.
Show 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

A fair coin is flipped 100 times. The exact probability of getting between 45 and 55 heads (inclusive) is 0.7287. Estimate it with the normal approximation, first with and then without the continuity correction.
Show 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

Discussion

Questions, ideas or a different approach? Join the conversation.