Understanding the geometric distribution calculator — concept and principle
The geometric distribution answers "on which trial does the first success happen?" when you repeat independent trials, each succeeding with the same probability p. Examples: how many calls a salesperson makes before the first sale, how many attempts until a part passes inspection, how many packs you open before finding a specific card, or how many rolls until a six appears. The calculator gives the probability that the first success occurs exactly on trial k, the probability that it occurs by trial k, and the expected number of trials.
How it is calculated
Here X counts the trials up to and including the first success (X = 1, 2, 3, …).
- P(X = k) = (1 − p)ᵏ⁻¹·p: k − 1 failures followed by one success.
- P(X ≤ k) = 1 − (1 − p)ᵏ: at least one success in the first k trials.
- Expected trials E[X] = 1/p; the variance is (1 − p)/p².
The principle
For the first success to fall on trial k, the first k − 1 trials must all fail and trial k must succeed. Independence lets you multiply the probabilities: (1 − p) × (1 − p) × … × p. For the cumulative probability it is easier to look at the complement: "no success in k trials" has probability (1 − p)ᵏ, so "success by trial k" is 1 minus that. The geometric distribution is memoryless: after any number of failures, the chance of needing j more trials is exactly what it was at the start. Past failures do not make a success "due".
Worked example
- Defaults: p = 0.2, k = 3.
- P(X = 3) = 0.8² × 0.2 = 0.64 × 0.2 = 0.128.
- P(X ≤ 3) = 1 − 0.8³ = 1 − 0.512 = 0.488.
- Expected trials = 1 ÷ 0.2 = 5.
So with a 20% chance per try, there is a 12.8% chance the first success comes exactly on the third try, a 48.8% chance it has come by then, and on average it takes 5 tries.
| Trial k of first success | P(X = k) |
|---|---|
| 0.75 | 0.2114742527 |
| 1.5 | 0.1788854382 |
| 2.25 | 0.1513186574 |
| 3 | 0.128 |
| 3.75 | 0.1082748174 |
| 4.5 | 0.0915893444 |
| 6 | 0.065536 |
How to read the result
The single most likely value is always k = 1, and probabilities decrease by the factor 1 − p each step. To plan with confidence, solve 1 − (1 − p)ᵏ ≥ target for k: with p = 0.2 you need 11 tries for a 90% chance (1 − 0.8¹¹ ≈ 0.914) and 14 tries for 95%. The spread is large: the standard deviation is √(1 − p)/p ≈ 4.47 tries here.
Common mistakes
- Using the other convention by mistake: some books count failures before the first success (Y = X − 1), whose mean is (1 − p)/p, not 1/p.
- Believing in the gambler's fallacy, that a success becomes more likely after many failures.
- Applying it when p changes between tries, such as with pity systems or drawing without replacement.
Frequently asked questions
What is the probability of needing more than k trials?
P(X > k) = (1 − p)ᵏ, for example 0.8³ = 0.512 in the example.
How is it related to the binomial distribution?
The binomial counts successes in a fixed number of trials; the geometric counts trials until a fixed number (one) of successes.
What is the continuous counterpart?
The exponential distribution, which is also memoryless and models waiting times in continuous time.
Sources: Sheldon M. Ross, A First Course in Probability, Pearson — geometric random variables · William Feller, An Introduction to Probability Theory and Its Applications, Vol. 1, Wiley