Unit 6, lesson 40

The Geometric Distribution

How the geometric distribution counts trials up to the first success, how the trial-count and failure-count conventions differ, and how geometric series give its tail, memoryless property, mean and variance.

  • Video 40
  • Counting and Waiting in Independent Trials

Suppose each attempt at a task succeeds with probability one quarter, independently of every other attempt, and you keep trying until the first success. How many attempts should you expect to need, how likely is a long wait, and does a run of failures make the next attempt more promising? The number of attempts is now the random quantity, not the number of successes. This lesson finds its distribution, sums its probabilities with a geometric series, and answers all three questions exactly.

Key terms

Geometric distribution

Definition Consider a sequence of independent trials, each a success with the same probability pp, where 0<p≤10 < p \le 1. Let TT be the number of trials up to and including the first success. Counting the successful trial is the trial-count convention, and in it the support of TT is {1,2,3,… }\{1, 2, 3, \dots\} when p<1p < 1. The event {T=k}\{T = k\} means that the first k−1k - 1 trials fail and trial kk succeeds, so independence gives

P(T=k)=(1−p)k−1 pP(T = k) = (1 - p)^{k-1}\,p

for every positive integer kk, and P(T=x)=0P(T = x) = 0 for every other real xx. We say that TT has the geometric distribution with parameter pp. When p=1p = 1 the first trial succeeds with certainty, so T=1T = 1 and the support is {1}\{1\}. The formula gives this with the usual convention (1−p)0=1(1 - p)^0 = 1. The value p=0p = 0 is excluded, because then the probability of ever succeeding is 00.

In plain words Keep trying until the first success and count every attempt, the successful one included. The first success lands on trial kk in only one way, a run of k−1k - 1 failures followed by a success.

Example With p=14p = \tfrac14, the first success comes on trial 44 only for the pattern failure, failure, failure, success, so

P(T=4)=(34)3⋅14=27256.P(T = 4) = \left(\tfrac34\right)^3 \cdot \tfrac14 = \tfrac{27}{256}.

This is not the binomial probability of exactly one success in four trials. That event allows the success in any of the four positions, and its probability 4⋅14⋅(34)3=27644 \cdot \tfrac14 \cdot (\tfrac34)^3 = \tfrac{27}{64} is four times as large. Only the pattern with the success in position four has its first success on trial 44.

Failure-count convention

Definition Under the same independent trials with 0<p≤10 < p \le 1, let FF be the number of failures before the first success. Then F=T−1F = T - 1, the support of FF is {0,1,2,… }\{0, 1, 2, \dots\} when p<1p < 1 and {0}\{0\} when p=1p = 1, and

P(F=j)=(1−p)j pP(F = j) = (1 - p)^{j}\,p

for every integer j≥0j \ge 0. Some references also call this distribution geometric, so a formula or a mean quoted for a geometric distribution is ambiguous until the convention is stated. Since the two variables differ by the constant 11, their means differ by 11 and their variances are equal.

In plain words Both conventions describe the same experiment. One records how many attempts were used, the other how many failed before the success. The failure count can be zero, but the trial count cannot.

Example With p=14p = \tfrac14, the pattern failure, failure, failure, success gives T=4T = 4 and F=3F = 3, and P(F=3)=(34)3⋅14=27256P(F = 3) = (\tfrac34)^3 \cdot \tfrac14 = \tfrac{27}{256}, the same probability as P(T=4)P(T = 4). The value F=0F = 0 means a success on the first attempt, so P(F=0)=14P(F = 0) = \tfrac14, while P(T=0)=0P(T = 0) = 0. The mean trial count is 44 and the mean failure count is 33, as the last card shows.

Geometric series

Definition For a real number r≠1r \ne 1 and a positive integer mm, the finite geometric series has the sum

∑i=0m−1ri=1−rm1−r.\sum_{i=0}^{m-1} r^{i} = \frac{1 - r^{m}}{1 - r}.

To see this, call the sum SS. Every power of rr except 11 and rmr^m cancels in S−rSS - rS, so (1−r)S=1−rm(1 - r)S = 1 - r^m. If ∣r∣<1\lvert r \rvert < 1, then rm→0r^m \to 0 as m→∞m \to \infty, and the infinite series converges with

∑i=0∞ri=11−r.\sum_{i=0}^{\infty} r^{i} = \frac{1}{1 - r}.

If ∣r∣≥1\lvert r \rvert \ge 1, the terms rir^i do not tend to 00 and the infinite series diverges.

In plain words Multiplying the sum by the ratio shifts every term one place, so subtracting leaves only the first term and the one just past the end. When the ratio is smaller than 11 in size, the leftover term fades away and the infinite sum is finite.

Example The geometric masses add to 11. Write q=1−pq = 1 - p. Since 0<p≤10 < p \le 1, we have 0≤q<10 \le q < 1, and the first mm masses add to

∑k=1mqk−1p=p⋅1−qm1−q=1−qm.\begin{aligned} \sum_{k=1}^{m} q^{k-1} p &= p \cdot \frac{1 - q^m}{1 - q} \\[0.4em] &= 1 - q^m. \end{aligned}

With p=14p = \tfrac14 and m=3m = 3 this is 1664+1264+964=3764=1−(34)3\tfrac{16}{64} + \tfrac{12}{64} + \tfrac{9}{64} = \tfrac{37}{64} = 1 - (\tfrac34)^3. As mm grows, qm→0q^m \to 0, so the total is 11. The leftover qmq^m is the probability that the first mm trials all fail, so the probability of never succeeding is 00. When p<1p < 1 this holds even though no fixed number of trials is guaranteed to be enough.

Geometric tail

Definition Let TT be geometric with parameter pp in the trial-count convention and q=1−pq = 1 - p. The event {T>k}\{T > k\} means that the first kk trials all fail, whatever happens afterward. Hence for every integer k≥0k \ge 0, with q0=1q^0 = 1,

P(T>k)=qk,P(T≤k)=1−qk.\begin{gathered} P(T > k) = q^{k}, \\[0.4em] P(T \le k) = 1 - q^{k}. \end{gathered}

The second line is the CDF of TT at the integer kk. For k≥1k \ge 1, the event {T≥k}\{T \ge k\} is the event {T>k−1}\{T > k - 1\}, so it has probability qk−1q^{k-1}.

In plain words Needing more than kk trials is a statement about the first kk trials only, and they must all fail. Watch the endpoint. Needing at least kk trials allows trial kk itself to be the success, so it requires only k−1k - 1 failures.

Example With p=14p = \tfrac14, the probability of needing more than three trials is P(T>3)=(34)3=2764P(T > 3) = (\tfrac34)^3 = \tfrac{27}{64}, so P(T≤3)=3764P(T \le 3) = \tfrac{37}{64}. Needing at least three trials means the first two fail, so P(T≥3)=(34)2=3664P(T \ge 3) = (\tfrac34)^2 = \tfrac{36}{64}. The difference 3664−2764=964\tfrac{36}{64} - \tfrac{27}{64} = \tfrac{9}{64} is exactly P(T=3)=(34)2⋅14P(T = 3) = (\tfrac34)^2 \cdot \tfrac14.

Memoryless property

Definition Let TT be geometric with parameter pp, where 0<p<10 < p < 1, and let q=1−pq = 1 - p. For all integers m≥0m \ge 0 and n≥0n \ge 0,

P(T>m+n∣T>m)=P(T>n).\begin{aligned} &P(T > m + n \mid T > m) \\[0.4em] &\quad = P(T > n). \end{aligned}

The conditioning event has probability qm>0q^m > 0, and since {T>m+n}\{T > m + n\} is contained in {T>m}\{T > m\}, the left side is qm+n/qm=qnq^{m+n} / q^m = q^n. Equivalently, given T>mT > m, the remaining wait T−mT - m has the same geometric distribution as TT. When p=1p = 1 and m≥1m \ge 1, the event {T>m}\{T > m\} has probability 00 and the conditional probability is not defined.

In plain words After any number of failures, the future looks exactly like a fresh start. A run of failures does not make a success due, and it does not make one less likely either. The property comes from the model, independent trials with one constant pp. A real process in which people learn from failed attempts, or equipment wears out, need not be memoryless.

Example With p=14p = \tfrac14, suppose the first three attempts have failed. The probability of needing more than two additional attempts is

P(T>5∣T>3)=q5q3=q2=916,\begin{aligned} &P(T > 5 \mid T > 3) \\[0.4em] &\quad = \frac{q^5}{q^3} = q^2 = \frac{9}{16}, \end{aligned}

which equals P(T>2)P(T > 2). The expected remaining wait is still 44 trials, so the expected total wait given those failures is E[T∣T>3]=3+4=7E[T \mid T > 3] = 3 + 4 = 7. This does not contradict E[T]=4E[T] = 4, because the condition removes every outcome with an early success.

Mean and variance of a geometric distribution

Definition If TT is geometric with parameter pp, where 0<p≤10 < p \le 1, in the trial-count convention, then

E[T]=1p,Var⁡(T)=1−pp2.\begin{gathered} E[T] = \frac{1}{p}, \\[0.4em] \operatorname{Var}(T) = \frac{1 - p}{p^2}. \end{gathered}

Both moments are finite because the tail qkq^k shrinks geometrically. For the mean, a variable with values in the positive integers satisfies E[T]=∑k≥1P(T≥k)E[T] = \sum_{k \ge 1} P(T \ge k), so with q=1−pq = 1 - p

E[T]=∑k=1∞qk−1=11−q=1p.\begin{aligned} E[T] &= \sum_{k=1}^{\infty} q^{k-1} \\[0.4em] &= \frac{1}{1 - q} = \frac{1}{p}. \end{aligned}

For the second moment s=E[T2]s = E[T^2], condition on the first trial. If it succeeds, T=1T = 1. If it fails, T=1+T′T = 1 + T', where the remaining wait T′T' does not depend on the first trial and has the same distribution as TT. So

s=p⋅1+q E[(1+T′)2]=p+q(1+2p+s).\begin{aligned} s &= p \cdot 1 + q\,E[(1 + T')^2] \\[0.4em] &= p + q\bigl(1 + \tfrac{2}{p} + s\bigr). \end{aligned}

Solving gives s=(2−p)/p2s = (2 - p)/p^2, and subtracting (E[T])2=1/p2(E[T])^2 = 1/p^2 gives the variance. The failure count F=T−1F = T - 1 has E[F]=(1−p)/pE[F] = (1 - p)/p and the same variance.

In plain words If each attempt succeeds with probability one quarter, the average wait is four attempts. The mean is not a promise, though. As pp shrinks toward 00 the variance grows without bound, so rare successes come with very uneven waits.

Example With p=14p = \tfrac14, the mean is E[T]=4E[T] = 4, the second moment is E[T2]=(2−14)⋅16=28E[T^2] = (2 - \tfrac14) \cdot 16 = 28, and the variance is Var⁡(T)=28−16=12\operatorname{Var}(T) = 28 - 16 = 12, a standard deviation of about 3.463.46 trials. The mean of 44 does not guarantee a success within four trials, since P(T≤4)=1−(34)4=175256≈0.68P(T \le 4) = 1 - (\tfrac34)^4 = \tfrac{175}{256} \approx 0.68. The failure count has mean 33 and the same variance 1212.

Check yourself

  1. Independent trials each succeed with probability 0.20.2, and TT counts the trials up to and including the first success. Find P(T=3)P(T = 3), E[T]E[T] and Var⁡(T)\operatorname{Var}(T).
Show the answer

The first success lands on trial 33 only for the pattern failure, failure, success, so

P(T=3)=(0.8)2⋅0.2=16125=0.128.\begin{aligned} P(T = 3) &= (0.8)^2 \cdot 0.2 \\[0.4em] &= \frac{16}{125} = 0.128. \end{aligned}

The mean is E[T]=1/0.2=5E[T] = 1/0.2 = 5 trials, and the variance is Var⁡(T)=0.8/0.04=20\operatorname{Var}(T) = 0.8/0.04 = 20, a standard deviation of about 4.474.47 trials.

  1. In the same model, the first four trials have all failed. What is the probability that more than two additional trials are needed? Someone answers (0.8)6≈0.262(0.8)^6 \approx 0.262. What went wrong?
Show the answer

The question asks for P(T>6∣T>4)P(T > 6 \mid T > 4). The condition has probability (0.8)4>0(0.8)^4 > 0, so

P(T>6∣T>4)=(0.8)6(0.8)4=(0.8)2=1625.\begin{aligned} &P(T > 6 \mid T > 4) = \frac{(0.8)^6}{(0.8)^4} \\[0.4em] &\quad = (0.8)^2 = \frac{16}{25}. \end{aligned}

That is 0.640.64, the same as P(T>2)P(T > 2), as the memoryless property says. The value (0.8)6=0.262144(0.8)^6 = 0.262144 is the unconditional probability P(T>6)P(T > 6), which ignores the information that four failures have already happened. The four failures do not make a success due either, and the answer is neither larger nor smaller than it would be at the start.

  1. A reference states that a geometric distribution with p=0.2p = 0.2 has mean 44 and gives the value 00 probability 0.20.2. Can that be right?
Show the answer

Yes, if the reference uses the failure-count convention. The number of failures before the first success, F=T−1F = T - 1, has support {0,1,2,… }\{0, 1, 2, \dots\}, the probability P(F=0)=p=0.2P(F = 0) = p = 0.2 and the mean E[F]=0.8/0.2=4E[F] = 0.8/0.2 = 4, which is one less than E[T]=5E[T] = 5. Its variance is still 2020. Under the trial-count convention used on this page, the value 00 is impossible and the mean is 55. Neither statement is wrong, but each needs its convention.

How this lesson connects