Why the Waiting-Time Mean and Variance Matter
A negative binomial waiting time describes how long a sequence of repeated trials continues until a specified number of successes has occurred. Its mean gives the long-run average number of trials required; its variance describes how much that waiting time varies around its mean. Both depend on the success probability and on how many successes are required.
The key to deriving these quantities is to view the wait for \(r\) successes as the sum of the waits between successive successes. Under independent trials with a constant success probability, each of these stage waits has a geometric distribution. This connection provides a direct derivation rather than requiring separate formulas for every value of \(r\).
Deriving the Mean and Variance
For each \(j=1,\ldots,r\), define \(W_j\) as the number of trials from immediately after the \((j-1)\)st success up to and including the \(j\)th success. For \(j=1\), this is the number of trials up to and including the first success. Each \(W_j\) counts trials, so it takes positive integer values.
The trials are independent and have the same success probability \(p\). Therefore, for any positive integers \(n_1,\ldots,n_r\), the event \(W_1=n_1,\ldots,W_r=n_r\) requires \(n_j-1\) failures followed by one success in each stage. Its probability is
This factorization shows that the stage waits are independent. Each has the same geometric distribution on \(1,2,\ldots\), with probability \(P(W_j=n)=q^{n-1}p\). Since the \(r\)th success occurs after all \(r\) stage waits have elapsed, \(T=W_1+\cdots+W_r\).
To justify the result, first obtain the mean and variance of one stage wait \(W\). Its tail probability is \(P(W\geq k)=q^{k-1}\) for \(k\geq1\): reaching at least trial \(k\) requires the first \(k-1\) trials to be failures. For a positive integer-valued random variable, the tail-sum identities are \(E[W]=\sum_{k\geq1}P(W\geq k)\) and \(E[W^2]=\sum_{k\geq1}(2k-1)P(W\geq k)\). Applying the geometric-series formulas gives
Consequently,
Now use \(T=W_1+\cdots+W_r\). Linearity of expectation gives \(E[T]=\sum_{j=1}^r E[W_j]=r/p\). Because the stage waits are independent, their covariances are zero, so the variance of their sum is the sum of their variances: \(\operatorname{Var}(T)=\sum_{j=1}^r\operatorname{Var}(W_j)=r(1-p)/p^2\). Independence is essential for this variance step; adding variances without it is not generally valid.
Record the required number of successes \(r\), and confirm that the random variable counts total trials through the \(r\)th success.
Confirm that trials are independent and that each has the same success probability \(p\), with \(0<p<1\).
Calculate \(E[T]=r/p\) and \(\operatorname{Var}(T)=r(1-p)/p^2\). Take the square root of the variance only if a standard deviation is requested.
Worked Applications
Worked Example: Three Successful Calibration Tests
A hypothetical calibration procedure is repeated until three tests pass. Assume each test passes independently with probability \(p=0.40\), and let \(T\) be the total number of tests through the third pass. Find the mean, variance, and standard deviation of \(T\).
Method and model check. The stopping rule requires \(r=3\) successes. The probability of success is fixed at \(p=0.40\) on every independent test, so the negative binomial total-trials formulas apply. The failure probability is \(1-p=0.60\).
Mean. Substitute \(r=3\) and \(p=0.40\):
Variance. Substitute both \(r=3\) and \(1-p=0.60\):
Standard deviation. Take the square root of the variance:
The mean need not be a whole number: it is a long-run average, not a possible observed count. As a check, a required three successes means \(T\geq3\), and the mean of 7.5 is consistent with that lower bound. The common mistake avoided here is treating the expected number of tests as \(r\) times \(1/p\) but then using \(r(1-p)/p\) for the variance; the variance requires \(p^2\) in the denominator.
Worked Example: Waiting for Two Successful Connections
In a hypothetical system test, each connection attempt succeeds independently with probability \(0.25\). Testing stops when the second successful connection is made. Let \(T\) count all attempts, including the successful one that ends the test. Find \(E[T]\), \(\operatorname{Var}(T)\), and the expected number of failed attempts before stopping.
Method and model check. Here \(r=2\), \(p=0.25\), and \(1-p=0.75\). The stated random variable counts total attempts, so it has support \(2,3,4,\ldots\).
Expected total attempts:
Variance of total attempts:
Every completed run contains exactly two successful attempts. Thus the number of failures is \(T-2\), and subtracting a constant changes the mean by that constant but does not change the variance:
The results are consistent: eight total attempts on average comprise two successes and six failures on average. The common mistake avoided is reporting eight as the expected number of failures; eight is the expected total number of attempts.
Worked Example: Four Positive Reviews
A hypothetical review workflow examines files one at a time. Each file independently receives a positive review with probability \(0.80\). The workflow ends at the fourth positive review. Find the expected number of files examined and the variance of that number.
Method and model check. Set \(r=4\), \(p=0.80\), and \(1-p=0.20\). The model requires the same probability on each review and independence across files, both of which are stipulated in the scenario.
Expected number examined:
Variance:
As a numerical check, \(E[T]\geq r\), since at least four files must be examined and the calculated mean is five. The variance is positive because \(0<p<1\); a zero variance would incorrectly imply that every run ends after exactly five files. The common mistake avoided is using \(1-p=0.20\) as the success probability in the mean formula: the expected wait is \(r/p\), not \(r/(1-p)\).
Common Exam Trap: Mixing Up the Convention
The formulas in this tutorial concern \(T\), the total number of trials through the \(r\)th success. If a problem instead asks for the number of failures \(F\) before that success, then \(F=T-r\). Therefore,
For example, with \(r=3\) and \(p=0.40\), the expected total number of trials is \(3/0.40=7.5\), whereas the expected number of failures is \(7.5-3=4.5\). The variance is \(3(0.60)/(0.40)^2=11.25\) under either convention. A wrong calculation would use \(3(0.60)/0.40=4.5\) as the variance; that expression is the mean number of failures, not the variance.
The formulas do not apply as stated if the success probability changes from trial to trial, if trials are dependent, or if the number of required successes is random. In those settings, the stage waits need not be independent and identically distributed geometric variables. Check the model assumptions before substituting values.
Check Your Understanding
For each problem, assume the stated trials are independent and have a constant success probability. Use the total-trials convention unless the question says otherwise.
- A sensor passes an independent check with probability \(0.50\). The procedure stops at the fourth pass. Find the expected total checks and the variance. (Answer: mean \(8\) checks; variance \(8\) checks\(^2\).)
- A hypothetical dispatch system successfully assigns a request with probability \(0.20\) on each attempt. It stops at the third successful assignment. Find the expected total attempts and the variance. (Answer: mean \(15\) attempts; variance \(60\) attempts\(^2\).)
- A quality screen marks an item acceptable with probability \(0.75\), independently from item to item. The screen continues until six acceptable items are found. Find the mean and variance of the total number screened. (Answer: mean \(8\) items; variance \(8/3\approx2.6667\) items\(^2\).)
- A hypothetical server makes independent requests, each successful with probability \(0.40\), until two successes occur. Find the expected number of failures before stopping and the variance of the total number of requests. (Answer: mean \(3\) failures; variance \(7.5\) requests\(^2\).)
- A project requires eight successful independent checks, each with success probability \(0.60\). Find the mean and variance of the total number of checks, and state whether the mean can be a possible observed count. (Answer: mean \(40/3\approx13.3333\) checks; variance \(80/9\approx8.8889\) checks\(^2\); the mean is not a possible observed count because it is not an integer.)