The Geometric Distribution
The distribution for "how many tries until the first success" — one number, the success probability, controls the whole thing. It's the discrete cousin of the exponential and the only discrete distribution with no memory.
Prerequisites: The Binomial Distribution
The geometric distribution answers a very natural question: you keep trying the same thing over and over, each attempt succeeds with the same probability, so how many attempts until the first success? Flip a coin until it lands heads, send quotes until one fills, roll a die until you get a six. The count of tries is geometric, and remarkably, a single number, the per-try success probability, tells you everything about it.
Each attempt is an independent Bernoulli trial: it succeeds with probability and fails with probability . To have your first success land on try number , you need the first tries to all fail and the -th to succeed. Multiply those independent chances together:
Here is the trial on which the first success occurs, is the success probability of a single try, and is the chance of failing the first times in a row. The counts run with no upper bound: you might, in principle, wait forever.
The average wait is one-over-p
The mean and variance are worth memorising:
The mean has a beautifully simple reading: if something works one time in , you wait tries on average. A one-in-six event (rolling a six) takes six rolls on average; a coin's heads takes two flips.
For a first-success count, the expected number of tries is one over the success probability, . A one-in- event takes about attempts on average.
Memorylessness
The geometric distribution has a strange and useful property: it forgets the past. Suppose you've already failed ten times. Does that "load the dice" for a success soon? No. The chance you need at least more tries is exactly the same as it was at the very start:
Coins and dice don't keep score. A run of bad luck doesn't make you "due." The geometric is the only discrete distribution with this no-memory property, which is exactly why it's the discrete twin of the The Exponential Distribution, the continuous distribution that forgets in the same way.
"I've missed nine times, so I'm due" is the gambler's fallacy. Under a genuinely memoryless process the streak carries no information about the next try. Being due is a feeling, not a probability.
Worked example
You roll a fair die repeatedly until the first six. Here .
- Expected number of rolls: . On average it takes six rolls.
- Chance the first six lands on roll 3: you need two non-sixes then a six,
- Chance it takes more than 6 rolls: all of the first six must miss,
So even though six rolls is the average, you'll still be waiting past six rolls about a third of the time, that fat right tail again.
To get fast, skip the sum. You just need failures in a row: . Everything else is one minus that.
A note on conventions
Two definitions float around and they differ by one. This page counts the trial of the first success (support , mean ). The other convention counts the number of failures before the first success (support , mean ). They describe the same experiment; just check which one a textbook or a library function means before plugging numbers in.
The geometric is the special case of the The Negative Binomial Distribution (wait for one success instead of ), sits among the Common Distributions every quant should know, and its one-over-p mean is a direct application of Expected Value.
Related concepts
Practice in interviews
Further reading
- Blitzstein & Hwang, Introduction to Probability, ch. 4
- Ross, A First Course in Probability