Intuition

How many times do you have to try before you succeed? If each attempt is independent with the same probability of success, the number of the trial on which you first succeed follows a geometric distribution. It is the only discrete distribution with the memoryless property: no matter how many failures you have already seen, the probability of succeeding on the next trial stays the same.

Definition

A random variable follows a geometric distribution if it represents the trial number on which the first success occurs in a sequence of independent Bernoulli trials, each with success probability and failure probability .

can take positive integer values

Convention note: Some texts define the geometric as the number of failures before the first success, giving with support and PMF . The formulas below use the “trial number” convention ().

Key Formulas

Probability Mass Function (PMF):

The factor accounts for the failures before the first success.

Cumulative Distribution Function (CDF):

Mean (expected number of trials):

Variance:

Memoryless Property:

This property says: given that you have already failed times, the distribution of additional trials needed is the same as starting fresh. The geometric is the only discrete distribution with this property.

Moment Generating Function:

Example

A telephone exchange is busy 95% of the time. Each attempt to connect succeeds independently with probability . How many attempts are expected, and what is the probability of connecting within the first 3 tries?

  • Expected attempts: tries.
  • .

So you have roughly a 14.3% chance of getting through in 3 or fewer attempts, and on average you will need 20 attempts.

We can also find how many attempts guarantee at least a 50% chance of connecting:

So after 14 attempts, you have at least a 50% cumulative chance of having connected at least once.

Why It Matters in CS

  • Las Vegas algorithms: algorithms that always produce the correct answer but have random running time. The expected execution count follows a geometric model when each attempt succeeds with fixed probability.
  • Hash table collision resolution: under uniform hashing, the expected number of probes to find an empty slot in an open-addressing scheme is geometrically distributed.
  • Retry protocols: Ethernet’s exponential backoff and TCP reconnection strategies are analyzed using geometric waiting times as a baseline.
  • Random search: brute-force key search in cryptography, where each guess succeeds with probability , requires expected attempts.
  • Coupon collector variant: the geometric distribution appears as a building block in the coupon collector problem, where the wait for each new distinct item is geometric with a shrinking success probability.