How long until...?

How many times do you need to flip a coin before you get Heads? How many emails before you get a job offer? How many die rolls before you see a 6?

What do you think?
You flip a fair coin repeatedly. On average, how many flips until the first Heads?

This "waiting time for the first success" shows up everywhere. Here's the formal definition.

The geometric distribution

Geometric Distribution

If each trial succeeds with probability pp (independently), and XX = number of trials until the first success, then XX follows a Geometric distribution with parameter pp: P(X=k)=(1p)k1p,k=1,2,3,P(X = k) = (1-p)^{k-1} \cdot p, \quad k = 1, 2, 3, \ldots We write XGeom(p)X \sim \text{Geom}(p).

The logic: to succeed on trial kk, you need k1k-1 failures (each with probability 1p1-p) followed by one success (probability pp).

Geometric Coin Flipper
0.050.95
Trials
0
Avg flips
0.00
E[X] = 1/p
2.00

Explore how the PMF shape changes as you adjust the success probability:

Geometric Distribution Explorer
Mode
0.050.95
P(X = k) = (1 − p)k−1 · p
1
2
3
4
5
6
7
8
9
10
11
12
13
14
k (trials until first success)
E[X] = 1/p
3.33
Var(X)
7.78
SD(X)
2.79
P(X > 5)
0.1681

The PMF shape

The geometric PMF always decreases:

  • The most likely outcome is X=1X = 1 (immediate success)
  • Each additional failure makes the outcome less likely
  • The PMF has a "tail" that stretches to infinity
For Geom(0.3), what is P(X = 1)? (decimal, e.g. 0.42)
For Geom(0.3), what is P(X = 3)? (decimal to 3 places, e.g. 0.456)

Key properties

Geometric Expectation & Variance

If XGeom(p)X \sim \text{Geom}(p): E[X]=1p,Var(X)=1pp2E[X] = \Large\frac{1}{p}, \qquad \text{Var}(X) = \frac{1-p}{p^2}

Probability ppExpected trials 1/p1/pInterpretation
0.52Fair coin → 2 flips
1/66Fair die → 6 rolls to see a 6
0.011001% chance → 100 attempts on average
0.0011000Rare event → needs many trials

The expected wait is always 1/p1/p, regardless of what happened before. This is the memoryless property.

The CDF: tail probabilities

The probability of needing more than kk trials:

P(X>k)=(1p)kP(X > k) = (1-p)^k

This is the complement: you need more than kk trials exactly when the first kk all fail.

What do you think?
Flip a fair coin. What's the probability of needing more than 5 flips?
Enter a decimal, e.g. 0.42

The memoryless property

This is what makes the geometric distribution special:

Memoryless Property

If XGeom(p)X \sim \text{Geom}(p), then for any s,t0s, t \geq 0: P(X>s+tX>s)=P(X>t)P(X > s + t \mid X > s) = P(X > t)

In words: given that you've already waited ss trials without success, the probability of waiting at least tt more is the same as starting fresh.

The coin has no memory. If you've flipped 10 Tails in a row, the 11th flip still has P(H) = p. The past doesn't matter.

Proof (it's short!)

P(X>s+tX>s)=P(X>s+t)P(X>s)=(1p)s+t(1p)s=(1p)t=P(X>t)P(X > s + t \mid X > s) = \Large\frac{P(X > s + t)}{P(X > s)} = \frac{(1-p)^{s+t}}{(1-p)^s} \normalsize= (1-p)^t = P(X > t)

The geometric distribution is the only discrete distribution with the memoryless property.

Explore the memoryless property visually — watch how the conditional survival curve perfectly overlaps the original:

Memoryless Property
Distribution
0.10.8
110
0.000.250.500.751.000123456789s = 3
P(X > t) original P(X > s+t | X > s)

The curves overlap!

P(X > 3+2 | X > 3) = 0.4900 = P(X > 2) = 0.4900

Simulate: given survival past 3, what’s the remaining wait?
Samples
0
Avg remaining
0.000
E[X] (unconditional)
3.33

Real-world applications

How many job applications?

If each application has a 5% chance of resulting in an offer: E[X]=1/0.05=20E[X] = 1/0.05 = 20 applications.

Server requests until failure

If each request has a 0.1% chance of crashing the server: E[X]=1/0.001=1000E[X] = 1/0.001 = 1000 requests on average.

Geometric thinking in everyday life

"How many tries until I find parking?" "How many dates until I meet the right person?" Whenever success is random and memoryless, the geometric appears.

Connecting to the Binomial

The Binomial and Geometric are close relatives:

PropertyBinomialGeometric
Question"How many successes in nn trials?""How many trials until first success?"
FixedNumber of trials (nn)Success probability (pp)
RandomNumber of successesNumber of trials

The Binomial counts successes in a fixed window. The Geometric counts time until the first success.

Summary

PropertyFormula
PMFP(X=k)=(1p)k1pP(X = k) = (1-p)^{k-1} p
CDFP(Xk)=1(1p)kP(X \leq k) = 1 - (1-p)^k
Expected valueE[X]=1/pE[X] = 1/p
VarianceVar(X)=(1p)/p2\text{Var}(X) = (1-p)/p^2
MemorylessP(X>s+tX>s)=P(X>t)P(X > s+t \mid X > s) = P(X > t)

If each trial is like a coin flip that doesn't remember its past, and you're counting "how many until the first success," you've got a Geometric distribution.

Test your understanding

Roll a fair die until you get a 6. Expected rolls? (whole number)
P(first 6 on exactly the 3rd roll)? (decimal to 3 places, e.g. 0.456)
You've rolled the die 10 times with no 6. What's P(6 on the next roll)? (decimal to 3 places, e.g. 0.456)

What's next

From counting "how many trials until a success" to counting how many events in an interval — the Poisson distribution, the workhorse of rare-event modeling.