The Binomial Distribution
Counting successes.
Flip a coin ten times. How many heads will you get? Probably around five, but it could be anything from zero to ten. The binomial distribution gives the chance of each count.

- Ten flips
- How many heads?
- The binomial distribution
Its two settings
A binomial distribution describes the number of successes in N independent tries, where each try succeeds with the same probability P. Ten coin flips is N equals ten, and P equals a half. Ten free throws by a seventy percent shooter is N equals ten, and P equals zero point seven.
| key | value |
|---|---|
| n | number of tries |
| p | chance of success each time |
| Counts | 0, 1, … n successes |
| Mean | n × p |
Drawing it
Sci Pi's binom gives us the probability of each count, with PMF, the probability mass function. We draw it as bars. Run it. Five heads is the most likely, but four and six are close behind. Zero or ten heads is very rare.
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import binom
k = np.arange(0, 11)
plt.bar(k, binom.pmf(k, n=10, p=0.5))
plt.title("Heads in 10 flips")
plt.xlabel("number of heads"); plt.xticks(k)
plt.savefig("binom.png")Summary
The binomial distribution counts successes in N tries with chance P. Its mean is N times P. Next, using it to answer real questions.
Key takeaways- n tries, chance p
- binom.pmf
- Mean = n × p