Geometric Distribution
The geometric distribution counts how many independent trials you need until the first success.
The model
Run independent Bernoulli(p) trials until the first success. The number of trials X follows a geometric distribution with PMF P(X = k) = (1 − p)^{k−1} p for k = 1, 2, …. Each factor (1 − p) is a prior failure; the final p is the success.
Mean and variance
The expected number of trials is E[X] = 1/p, which matches intuition: a rare event with p = 0.01 takes about 100 trials on average. The variance is (1 − p)/p², so rare events also have highly variable waiting times.
Memoryless in discrete time
Like the exponential in continuous time, the geometric is memoryless: past failures do not change the distribution of remaining trials. P(X > m + n | X > m) = P(X > n). It is the only discrete distribution with this property.
Two conventions
Some texts define the geometric as the number of failures before the first success, shifting the support to 0, 1, 2, … and the mean to (1 − p)/p. Both conventions are common, so always check which one a formula or library uses.
def geom_pmf(k, p):
return (1-p)**(k-1)*p
print(round(geom_pmf(3, 0.2), 4)) # 0.1280
Where it appears
The geometric models retry counts, the number of samples until a rejection-sampling proposal is accepted, and time-to-first-detection problems. Summing r independent geometrics gives the negative binomial, which counts trials until the r-th success.