Tutorials › VEE Mathematical Statistics › Geometric and Negative Binomial Sums

VEE Mathematical Statistics · Sums and Linear Combinations · Tutorial 329 of 880

Geometric and Negative Binomial Sums

Learn to model the number of trials needed for a fixed number of successes and calculate exact or cumulative probabilities from the negative binomial distribution.

Intermediate 10 min read

What You'll Learn

  • Define a geometric waiting time as the trial count through the first success.
  • Identify the conditions under which independent geometric waiting times have a negative binomial sum.
  • Derive the probability of requiring exactly a specified number of trials.
  • Calculate exact, at-most, and more-than trial-count probabilities.
  • Avoid confusing the trial-count convention with the number of failures before the final success.

Why Geometric Waiting Times Add to a Negative Binomial

Suppose a quality-control test is repeated until a fixed number of items pass. The number of tests required to obtain one passing item has a geometric distribution. If the tests are independent and the chance of passing stays constant, the total number of tests required to obtain several passing items is a sum of independent geometric waiting times. That sum has a negative binomial distribution.

The key is to be precise about what is being counted. In this tutorial, the random variable counts all trials through and including the trial on which the required success occurs. This convention gives a minimum total of \(r\) trials when \(r\) successes are required. The result is aligned with the SOA VEE Mathematical Statistics syllabus.

Definition: Let \(X\) be the number of independent Bernoulli trials up to and including the first success, where each trial has success probability \(p\), with \(0<p<1\). Then \(X\) has a geometric distribution with $$ P(X=k)=(1-p)^{k-1}p,\qquad k=1,2,3,\ldots. $$ If \(X_1,\ldots,X_r\) are independent geometric random variables with this same success probability \(p\), their sum \(N=X_1+\cdots+X_r\) counts the trials up to and including the \(r\)th success.

Write \(q=1-p\) for the probability of failure on any one trial. The common-\(p\) condition means that every waiting time describes the same success probability. Independence means that the trial outcomes do not affect one another; in particular, one success does not change the chance of success on the next trial.

The Negative Binomial Probability Formula

For the \(r\)th success to occur on trial \(n\), trial \(n\) must be a success, and exactly \(r-1\) of the first \(n-1\) trials must be successes. The other \(n-r\) trials are failures. There are \(\binom{n-1}{r-1}\) ways to choose which of the first \(n-1\) trials are successes. Each such sequence has probability \(p^r q^{n-r}\).

Theorem: If \(N\) is the number of independent Bernoulli trials through the \(r\)th success, with success probability \(p\) on every trial, then $$ P(N=n)=\binom{n-1}{r-1}p^r(1-p)^{n-r}, \qquad n=r,r+1,r+2,\ldots. $$ For \(n<r\), \(P(N=n)=0\). Equivalently, \(N\) is the sum of \(r\) independent geometric random variables with common success probability \(p\).

The formula can also be obtained from the convolution of the geometric waiting times. For example, when \(r=2\), the total \(N=n\) can arise from \(X_1=k\) and \(X_2=n-k\), for \(k=1,\ldots,n-1\). Each pair has probability \(p^2q^{n-2}\), so summing the \(n-1\) possibilities gives \(P(N=n)=(n-1)p^2q^{n-2}\). For general \(r\), the number of ways to divide the \(n-r\) failures among the \(r\) waiting periods is \(\binom{n-1}{r-1}\), yielding the same formula.

1
Fix the final trial.
For \(N=n\), the \(r\)th success must occur on trial \(n\), so that trial is a success.
2
Count earlier successes.
The first \(n-1\) trials must contain exactly \(r-1\) successes. There are \(\binom{n-1}{r-1}\) possible sets of success positions.
3
Multiply the sequence probability.
Every allowed sequence has \(r\) successes and \(n-r\) failures, so independence gives probability \(p^rq^{n-r}\). Multiplying by the number of sequences gives the formula.

A useful check is the support: the total cannot be less than \(r\), because each success requires at least one trial. At \(n=r\), every trial must be a success, and the formula gives \(P(N=r)=p^r\), as it should.

Worked Probability Calculations

Worked Example: Three Passing Items by the Fifth Test

A hypothetical inspection process tests items one at a time. Assume each test is independent and an item passes with probability \(p=0.4\). Let \(N\) be the number of tests through the third passing item. Find the probability that the third passing item is obtained on test 5.

Method. This is an exact trial-count probability with \(r=3\), \(n=5\), \(p=0.4\), and \(q=1-0.4=0.6\). The fifth test must be a pass, and exactly two of the first four tests must be passes.

$$ P(N=5)=\binom{5-1}{3-1}(0.4)^3(0.6)^{5-3} $$

There are \(\binom{4}{2}=6\) ways to place the two earlier passes. Also, \((0.4)^3=0.064\) and \((0.6)^2=0.36\). Therefore,

$$ P(N=5)=6(0.064)(0.36)=6(0.02304)=0.13824. $$

To four decimal places, the probability is 0.1382. As a check, each of the six qualifying sequences has three passes and two failures, so each has probability \(0.4^3(0.6)^2=0.02304\); their total is \(6(0.02304)=0.13824\). A common mistake would be to use \(\binom{5}{3}\), which allows the final test to be a failure. The final test must be the third success, so the choices are made only among the first four tests.

Worked Example: Exactly Six Tests Versus At Most Six

A hypothetical screening procedure has an independent success probability of \(p=0.5\) on each trial. Let \(N\) count the trials through the fourth success. Find (a) \(P(N=6)\) and (b) \(P(N\leq 6)\).

(a) Exactly six trials. Here \(r=4\), \(n=6\), and \(q=0.5\). The first five trials must contain exactly three successes, followed by a success on trial 6:

$$ P(N=6)=\binom{5}{3}(0.5)^4(0.5)^2 =10(0.5)^6 =\frac{10}{64} =0.15625. $$

Thus \(P(N=6)=0.1563\) to four decimal places.

(b) At most six trials. The fourth success must have occurred by trial 6 exactly when at least four successes occur in the first six trials. The possible success counts in those six trials are 4, 5, or 6:

$$ P(N\leq 6) =\left[\binom{6}{4}+\binom{6}{5}+\binom{6}{6}\right](0.5)^6 =\frac{15+6+1}{64} =\frac{22}{64} =0.34375. $$

Thus \(P(N\leq 6)=0.3438\) to four decimal places. The exact event \(N=6\) is only one part of the cumulative event \(N\leq6\), so the cumulative probability is larger, as the values confirm. Confusing these two events is a common exam trap.

Worked Example: Two Successes and a More-Than Trial Count

A hypothetical sensor detects a target independently on each scan with probability \(p=0.3\). Let \(N\) be the number of scans through the second detection. Find (a) \(P(N=7)\) and (b) \(P(N>7)\).

(a) Exactly seven scans. Here \(r=2\), \(n=7\), and \(q=0.7\). The seventh scan is a detection, and there is exactly one detection among the first six scans:

$$ P(N=7)=\binom{6}{1}(0.3)^2(0.7)^5. $$

Since \((0.3)^2=0.09\), \((0.7)^5=0.16807\), and \(\binom{6}{1}=6\),

$$ P(N=7)=6(0.09)(0.16807)=0.54(0.16807)=0.0907578. $$

Therefore \(P(N=7)=0.0908\) to four decimal places.

(b) More than seven scans. This means fewer than two detections in the first seven scans: either zero detections or one detection. Those cases have probabilities \(0.7^7\) and \(\binom{7}{1}(0.3)(0.7)^6\), respectively:

$$ P(N>7)=(0.7)^7+7(0.3)(0.7)^6 =0.0823543+0.2470629 =0.3294172. $$

Thus \(P(N>7)=0.3294\) to four decimal places. As a check on the event interpretation, \(N>7\) is the complement of obtaining at least two detections by scan 7; it is not the event of exactly one detection on scan 7.

Conventions, Assumptions, and Common Traps

The term “negative binomial” is used with more than one counting convention. Here \(N\) counts trials through the \(r\)th success, so its support begins at \(r\). Another convention counts only failures before the \(r\)th success; that random variable equals \(N-r\) and has support beginning at zero. The formulas describe equivalent events after translating the count, but their values of \(n\) differ by \(r\).

Question wordingEvent to calculateUseful interpretation
The \(r\)th success is on trial \(n\)\(P(N=n)\)Exactly \(r-1\) successes in the first \(n-1\), then a success
The \(r\)th success occurs by trial \(m\)\(P(N\leq m)\)At least \(r\) successes in the first \(m\) trials
More than \(m\) trials are needed\(P(N>m)\)At most \(r-1\) successes in the first \(m\) trials

Before using the formula, verify that trials are independent, the success probability is constant, and the waiting times are being added for a fixed number of successes. If the success probability changes between trials, or if a success changes later trial probabilities, the common-\(p\) negative binomial formula does not apply as stated. If \(p=1\), the total is deterministically \(r\); if \(p=0\), the required successes never occur.

  • Using the wrong number of choices. For \(P(N=n)\), choose the \(r-1\) earlier successes from the first \(n-1\) trials, not from all \(n\). The last trial is already fixed as a success.
  • Mixing up exact and cumulative probabilities. “On trial \(n\)” means one probability mass. “By trial \(n\)” includes several possible final trial counts.
  • Switching counting conventions without adjusting. If a question counts failures rather than total trials, subtract \(r\) from the total-trial count before applying the corresponding formula.
Key takeaway: For independent trials with a constant success probability \(p\), the sum of \(r\) geometric waiting times counts trials through the \(r\)th success. The exact probability at \(n\) trials is \(\binom{n-1}{r-1}p^r(1-p)^{n-r}\), for \(n\geq r\).

Check Your Understanding

For each problem, use the convention that the count includes the success trial. Assume independence and a constant success probability whenever the problem specifies them.

  1. A device passes each independent test with probability \(0.25\). If \(N\) is the number of tests through the third pass, find \(P(N=5)\). (Answer: \(27/512=0.0527\) to four decimal places)
  2. A monitoring procedure has independent detection probability \(0.6\) per scan. If \(N\) counts scans through the second detection, find \(P(N\leq4)\). (Answer: \(0.8208\))
  3. An independent trial succeeds with probability \(0.5\). For the number of trials through the third success, find the probability that the third success occurs on trial 6. (Answer: \(10/64=0.1563\) to four decimal places)
  4. A hypothetical sensor has independent success probability \(0.2\) per reading. For the number of readings through the second success, find the probability that more than five readings are needed. (Answer: \(0.7373\) to four decimal places)
  5. A hypothetical assay gives an independent positive result with probability \(0.4\) on each test. Let \(N\) count tests through the fifth positive result. Find \(P(N=7)\). (Answer: \(0.0553\) to four decimal places)
Clinical Biostats