Geometric, Negative Binomial and Hypergeometric
Waiting times, counts until r successes, and sampling without replacement.
Assumes you know
Geometric, Negative Binomial and Hypergeometric
Intuition first
Three distributions, each obtained by relaxing one assumption of the binomial.
The binomial fixes the number of trials and counts successes. Turn that around — fix the number of successes and count the trials needed — and you get the geometric (one success) and the negative binomial ( successes).
The hypergeometric keeps trials fixed but drops independence: it samples without replacement, so each draw changes the composition of what remains. Drawing 5 cards from a deck is hypergeometric; the binomial would be wrong because the second card's probabilities depend on the first.
Knowing which of these applies is mostly a matter of two questions: is the number of trials fixed or random, and is sampling with or without replacement?
Choosing among them
| Distribution | Fixed | Counts | Replacement |
|---|---|---|---|
| Binomial | trials | successes | with |
| Geometric | 1 success | trials needed | with |
| Negative binomial | successes | trials needed | with |
| Hypergeometric | draws | successes | without |
The geometric distribution
Number of independent trials until the first success:
Mean of the geometric, by conditioningAdvanced
The elegant route avoids summing the series. Either the first trial succeeds, or it fails and the situation resets — the memoryless property in action.
The second term says: one trial was consumed, and from there the expected additional wait is the same as at the beginning. Expand:
Collect terms:
Three lines, no series manipulation. The same trick gives the variance and appears again in Markov-chain hitting times and in the RL Bellman equations, which have exactly this self-referential structure.
The geometric is the unique discrete memoryless distribution:
The negative binomial
Number of trials until the -th success:
A negative binomial is a sum of independent geometrics, which gives its mean and variance immediately by linearity and independence.
The hypergeometric
Population of items containing successes; draw without replacement:
Why the correction factor appears, and when it vanishesAdvanced
Draws without replacement are negatively correlated: drawing a success makes the next draw slightly less likely to be a success, since one has been removed. Write where indicates a success on draw . Then
Each indicator is Bernoulli by symmetry, giving the binomial-like first term. The covariances are all negative and identical, and summing them produces exactly the factor .
Two limiting checks:
- : the factor is . A single draw cannot depend on itself, so hypergeometric and binomial coincide.
- : the factor is 0. Drawing the whole population always yields exactly successes, so there is no variability at all.
- : the factor tends to 1, and the hypergeometric converges to Binomial. Removing a few items from a huge population barely changes the composition.
The usual rule: use the binomial approximation when .
Solved problem 1 · All three on one scenario
A box holds 20 components, 6 defective.
(a) Draw 5 without replacement — probability exactly 2 are defective. (b) Draw 5 with replacement — same question. (c) Drawing with replacement, probability the first defective appears on draw 4. (d) Drawing with replacement, probability the 3rd defective appears on draw 8.
Step 1 — part (a): hypergeometric
, , , .
Step 2 — part (b): binomial with p = 6/20
Step 3 — compare (a) and (b)
Here , well above the 0.05 threshold, so the binomial approximation is poor — off by about 14% relative. The finite population correction is
so the hypergeometric variance is only 79% of the binomial's, concentrating probability nearer the mean of and thus raising .
Step 4 — part (c): geometric
First success on trial 4 means three failures then a success:
Step 5 — part (d): negative binomial
Third success on trial 8: among the first 7 trials there must be exactly 2 successes, then trial 8 is a success.
Answer
(a) hypergeometric; (b) binomial; (c) ; (d) .
With the with/without distinction matters materially.
from scipy import stats
# (a) hypergeometric: M = population, n = successes in population, N = draws
print(f"(a) hypergeom {stats.hypergeom(M=20, n=6, N=5).pmf(2):.5f}")
print(f"(b) binomial {stats.binom(n=5, p=0.3).pmf(2):.5f}")
print(f"(c) geometric {stats.geom(p=0.3).pmf(4):.5f}")
print(f"(d) negbinom {stats.nbinom(n=3, p=0.3).pmf(8 - 3):.5f} # nbinom counts FAILURES")
# Variance: the finite population correction.
H = stats.hypergeom(M=20, n=6, N=5)
B = stats.binom(n=5, p=0.3)
fpc = (20 - 5) / (20 - 1)
print(f"\nhypergeom var {H.var():.5f}")
print(f"binomial var {B.var():.5f} x fpc {fpc:.4f} = {B.var()*fpc:.5f}")
# The approximation improves as N grows with K/N fixed.
print(f"\n{'N':>8} hypergeom P(X=2) binomial 0.30870")
for N in (20, 100, 1000, 100_000):
print(f"{N:8d} {stats.hypergeom(M=N, n=int(0.3*N), N=5).pmf(2):.5f}")Exercise 1
A salesperson closes 20% of calls. Find the expected number of calls to the first sale, and the probability it takes more than 10 calls.
Show solutionHide solution
.
For the tail, "more than 10 calls" means the first 10 all failed:
So about a 10.7% chance of needing more than 10 calls.
The survival function has the clean closed form , which is often easier than summing the PMF. Note the memorylessness: after 10 failures, the expected additional calls is still 5.
Exercise 2
A shipment of 500 items contains 25 defective. 20 are inspected. Should you use hypergeometric or binomial? Compute the probability of finding no defects both ways.
Show solutionHide solution
Strictly hypergeometric, since inspection is without replacement. But check the rule of thumb:
so the binomial approximation is acceptable.
Hypergeometric, with , , , :
This equals the product of sequential probabilities:
Binomial, with :
The two differ by about 0.017, or 5% relative — small enough for most purposes, and the direction is predictable: the finite population correction
reduces variance slightly, so the hypergeometric puts marginally less mass in the tail at .
Use the binomial if you want a quick number, the hypergeometric if the result feeds an acceptance decision where 5% matters.
Next: Gamma and Beta Distributions.