Prob and StatsRandom Variables

The Geometric Distribution

Count the trials until the first success.

Not started Jump to practice

The binomial distribution fixes the number of trials and counts the successes. Turn the question around: keep trying until the first success, and count the trials. Rolling until a six, calling until someone answers, buying cereal until you find the prize.

Key idea

With independent trials, each a success with probability $p$, the trial number $X$ of the first success is geometric: $$P(X = k) = (1 - p)^{k - 1}p, \quad k = 1, 2, 3, \ldots$$ Its mean is $E(X) = \frac{1}{p}$, and $P(X > k) = (1 - p)^k$.

Why it works

The first success on trial $k$ means exactly this sequence: $k - 1$ failures, then a success. By independence its probability is the product $(1 - p)^{k - 1}p$. "More than $k$ trials are needed" means the first $k$ trials all fail: $(1 - p)^k$. The mean $1/p$ matches intuition: if success happens one time in six, you wait six tries on average.
The roll on which the first six appears. Every bar is 5/6 of the one before; the most likely single value is 1, yet the mean is 6.

Worked example: First six on a given roll

Roll a fair die until a six appears. Find $P(X = 3)$.
  1. Two failures, then a success: $\left(\frac{5}{6}\right)^2 \cdot \frac{1}{6}$.
  2. $= \frac{25}{216} \approx 0.116$.

Answer: $\frac{25}{216}$

Worked example: The average wait

On average, on which roll does the first six appear?
  1. A six comes up on 1 roll in 6, so the wait averages 6 rolls.
  2. $E(X) = \dfrac{1}{p} = \dfrac{1}{1/6} = 6$.

Answer: The 6th roll.

Worked example: A long wait

What is the probability that more than 4 rolls are needed?
  1. More than 4 rolls are needed exactly when the first 4 rolls all miss.
  2. $$P(X > 4) = \left(\frac{5}{6}\right)^4 = \frac{625}{1296} \approx 0.482$$

Answer: About $0.482$.

Common mistake

Believing a success is "due" after a run of failures. The trials are independent: after 5 misses, the chance of a six on the next roll is still $\frac{1}{6}$, and the expected wait from now is still 6 more rolls. Check: does the process have a memory? Dice and coins do not.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 2 XP.

Loading practice…

Builds on

Leads to

Sources and further reading

  • OpenStax, Introductory Statistics 2e, section 4.4 Geometric Distribution
@teddyrookbook GitHub