Binomial Distribution: Coin Flips and Success Counts

April 12, 2026

Problem

Flip a coin n = 20 times with probability p of heads. Show P(k heads) = C(n,k) p^k (1−p)^(n−k) for k = 0 to n as a bar chart.

Explanation

What is the binomial distribution?

The binomial distribution answers: "If I repeat an experiment nn times, each with probability pp of success, what's the probability of getting exactly kk successes?"

The formula

P(X=k)=(nk)pk(1p)nkP(X = k) = \binom{n}{k} p^{k}(1-p)^{n-k}

where (nk)=n!k!(nk)!\binom{n}{k} = \frac{n!}{k!(n-k)!} is "n choose k" — the number of ways to pick which kk of the nn trials are successes.

Step-by-step example: n=20n = 20 coin flips, p=0.5p = 0.5

What is P(exactly 10 heads)P(\text{exactly 10 heads})?

Step 1 — Identify values: n=20n = 20, k=10k = 10, p=0.5p = 0.5.

Step 2 — Compute (2010)\binom{20}{10}: (2010)=184,756\binom{20}{10} = 184{,}756.

Step 3 — Apply the formula:

P(X=10)=184,756×(0.5)10×(0.5)10=184,756×(0.5)20P(X = 10) = 184{,}756 \times (0.5)^{10} \times (0.5)^{10} = 184{,}756 \times (0.5)^{20}

=184,756/1,048,5760.176= 184{,}756 / 1{,}048{,}576 \approx 0.176

So there's about a 17.6% chance of getting exactly 10 heads in 20 flips.

Key properties

  • Mean: μ=np=20×0.5=10\mu = np = 20 \times 0.5 = 10
  • Standard deviation: σ=np(1p)=20×0.5×0.5=52.24\sigma = \sqrt{np(1-p)} = \sqrt{20 \times 0.5 \times 0.5} = \sqrt{5} \approx 2.24
  • Shape: Symmetric when p=0.5p = 0.5; skewed left when p>0.5p > 0.5; skewed right when p<0.5p < 0.5.

When to use the binomial

The binomial applies when: (1) fixed number of trials nn, (2) each trial has exactly two outcomes (success/failure), (3) constant probability pp, (4) trials are independent.

Examples: coin flips, defective items in a batch, free throw success rate, true/false quiz guessing.

Try it in the visualization

Adjust nn and pp. The bar chart shows P(X=k)P(X = k) for each kk. The mean line shifts with npnp. Toggle the normal approximation to see how the binomial becomes bell-shaped for large nn.

Interactive Visualization

Parameters

20.00
0.50
10.00
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day
Binomial Distribution: Coin Flips and Success Counts | MathSpin