How to Calculate the Geometric Distribution

The distribution of how many attempts it takes to succeed for the first time. The chance that the first success falls exactly on attempt k is (1−p)^(k−1) × p, and the chance of succeeding within k attempts is 1 − (1−p)^k.

This is the distribution of how many attempts it takes to succeed for the first time: k1k-1 failures followed by a success on attempt kk.

P(X=k)=(1p)k1pP(X = k) = (1-p)^{k-1} p

The chance of succeeding within kk attempts is the opposite of never succeeding, 1(1p)k1 - (1-p)^k. The mean is 1÷p1 \div p and the standard deviation 1p÷p\sqrt{1-p} \div p.

Example

With a 20% chance each time, the first success falls exactly on the third attempt with probability 0.82×0.2=0.1280.8^2 \times 0.2 = 0.128, or 12.8%. The chance of succeeding within three attempts is 10.83=0.4881 - 0.8^3 = 0.488, or 48.8%. The mean is 1÷0.2=51 \div 0.2 = 5 attempts and the standard deviation 4.47.

Waiting for the mean is not enough

Even with a mean of 5, the chance of succeeding within 5 attempts is only 10.85=67.21 - 0.8^5 = 67.2%. Roughly one time in three, five attempts still come up empty. The distribution has a long tail to the right, which pulls the mean above the median.

It has no memory

However many attempts have failed, the next one still succeeds with probability pp. Nothing is due. This is called memorylessness, and the exponential distribution has the same property in continuous time.

Notes

With a success probability of 0 there is never a success, so no mean exists.