Tutorials › Introduction to Statistics › Deriving the Geometric Mean and Variance

Binomial and Geometric Models · Tutorial 413 of 996

Deriving the Geometric Mean and Variance

Learn how the geometric waiting-time formulas follow from its probability mass function, and how to interpret their units and assumptions.

Intermediate 9 min read

What You'll Learn

  • Define the geometric random variable as the number of trials through and including the first success.
  • State the independent-trials and constant-success-probability assumptions.
  • Derive the mean by differentiating a geometric series.
  • Derive the second moment and variance from the probability mass function.
  • Apply the formulas to hypothetical waiting-time settings and interpret their units.
  • Recognize why the mean is not the same as a guaranteed or typical individual wait.

Why Derive the Geometric Mean and Variance?

A geometric model describes a wait measured in repeated trials: how many attempts are needed until the first success? The model's probability mass function gives the probability of each possible wait. From it, we can derive the distribution's average waiting time and its variability, rather than treating those formulas as rules to memorize.

The convention matters. In this tutorial, the random variable counts trials through and including the first success. Thus its possible values are \(1,2,3,\ldots\), not \(0,1,2,\ldots\). Changing that convention changes the mean, so it must be made explicit before calculating.

Model and Probability Mass Function

Definition: Suppose trials are independent, each trial has the same probability \(p\) of success, and \(0<p\leq 1\). Let \(X\) be the number of trials through and including the first success. Then \(X\) has a geometric distribution with probability mass function $$ P(X=k)=(1-p)^{k-1}p,\qquad k=1,2,3,\ldots. $$

Write \(q=1-p\) for the probability of failure on any one trial. For the first success to occur on trial \(k\), the first \(k-1\) trials must all be failures and trial \(k\) must be a success. Independence gives the product \(q^{k-1}p\). In particular, \(P(X=1)=p\), and \(P(X=2)=qp\).

The assumptions are substantive: success and failure must be defined for each trial; the success probability must remain \(p\); and outcomes on different trials must be independent. If those conditions do not reasonably describe the process, the geometric formulas need not apply. When \(p=1\), success occurs on the first trial with certainty. The derivations below use \(0<p<1\), and the formulas also hold for \(p=1\) by direct evaluation.

Deriving the Mean

For a discrete random variable, its expected value is the probability-weighted sum of its possible values. Applying that definition to \(X\) gives

$$ E[X]=\sum_{k=1}^{\infty} kP(X=k) =p\sum_{k=1}^{\infty} kq^{k-1}. $$

To evaluate this sum, start with the geometric series. For \(0\leq q<1\), its sum is \(1/(1-q)\). Differentiating both sides with respect to \(q\) gives the series of terms needed for the mean:

$$ \sum_{k=0}^{\infty}q^k=\frac{1}{1-q} \quad\Longrightarrow\quad \sum_{k=1}^{\infty}kq^{k-1}=\frac{1}{(1-q)^2}. $$

This term-by-term differentiation is valid for a power series inside its interval of convergence, here \(|q|<1\). Since \(1-q=p\), substitution into the expectation yields the mean:

$$ E[X]=p\frac{1}{(1-q)^2} =p\frac{1}{p^2} =\frac{1}{p}. $$
Theorem: For a geometric random variable counting trials through and including the first success, the mean is $$ \mu_X=E[X]=\frac{1}{p}\text{ trials}. $$

Deriving the Variance

The variance measures the probability-weighted squared distance from the mean. A useful way to calculate it is first to find the second moment \(E[X^2]\), then use \(\operatorname{Var}(X)=E[X^2]-(E[X])^2\). The second moment from the probability mass function is

$$ E[X^2]=\sum_{k=1}^{\infty} k^2P(X=k) =p\sum_{k=1}^{\infty} k^2q^{k-1}. $$

For the required sum, first differentiate the geometric series once, then multiply by \(q\). Differentiating that resulting identity once more gives:

$$ \sum_{k=1}^{\infty}kq^{k-1}=\frac{1}{(1-q)^2} \quad\Longrightarrow\quad \sum_{k=1}^{\infty}kq^k=\frac{q}{(1-q)^2}, $$ $$ \sum_{k=1}^{\infty}k^2q^{k-1} =\frac{d}{dq}\left(\frac{q}{(1-q)^2}\right) =\frac{1+q}{(1-q)^3}. $$

The last equality follows by differentiating \(q(1-q)^{-2}\): its derivative is \((1-q)^{-2}+2q(1-q)^{-3}=(1+q)(1-q)^{-3}\). As before, the power-series operations are valid for \(0\leq q<1\). Therefore,

$$ E[X^2] =p\frac{1+q}{(1-q)^3} =p\frac{1+q}{p^3} =\frac{1+q}{p^2}. $$

To see why subtracting the squared mean gives the variance, expand the squared distance: \(E[(X-\mu_X)^2]=E[X^2-2\mu_XX+\mu_X^2]=E[X^2]-2\mu_XE[X]+\mu_X^2=E[X^2]-\mu_X^2\), because \(E[X]=\mu_X\). Now substitute the moments and \(q=1-p\):

$$ \operatorname{Var}(X) =E[X^2]-(E[X])^2 =\frac{1+q}{p^2}-\frac{1}{p^2} =\frac{q}{p^2} =\frac{1-p}{p^2}. $$
Theorem: For a geometric random variable counting trials through and including the first success, $$ \operatorname{Var}(X)=\frac{1-p}{p^2}\text{ trials}^2, \qquad \sigma_X=\sqrt{\frac{1-p}{p^2}}\text{ trials}. $$

Variance is measured in squared trials because it averages squared differences in the number of trials. The standard deviation, its square root, is in trials, like \(X\) and its mean. When \(p=1\), \(X=1\) with certainty, so its mean is \(1\) and its variance is \(0\), agreeing with both formulas.

Worked Applications

Worked Example: A Success Probability of 0.25

Suppose, hypothetically, that an independent trial has a 0.25 probability of success each time, and a process repeats trials until its first success. Find the mean, variance, and standard deviation of the number of trials. The constant probability and independence conditions are assumed to hold.

Here \(p=0.25\), so \(1-p=0.75\). Applying the derived mean formula,

$$ E[X]=\frac{1}{p}=\frac{1}{0.25}=4\text{ trials}. $$

The variance and standard deviation are

$$ \operatorname{Var}(X)=\frac{1-p}{p^2} =\frac{0.75}{(0.25)^2} =\frac{0.75}{0.0625} =12\text{ trials}^2, $$ $$ \sigma_X=\sqrt{12}\approx 3.464\text{ trials}. $$

Under this model, the long-run average number of trials through success is 4. The standard deviation describes the distribution's spread around that mean; it does not mean every wait is close to 4 trials.

Worked Example: A High Probability of Success

Imagine a hypothetical process in which each independent trial succeeds with probability \(p=0.60\). Let \(X\) count trials through the first success. Find its mean and variance. The calculation is appropriate provided each trial has the same 0.60 success probability and trials are independent.

The mean is

$$ E[X]=\frac{1}{0.60}=1.666\ldots\approx 1.667\text{ trials}. $$

The variance is

$$ \operatorname{Var}(X) =\frac{1-0.60}{(0.60)^2} =\frac{0.40}{0.36} =1.111\ldots\approx 1.111\text{ trials}^2. $$

Thus the standard deviation is \(\sqrt{1.111\ldots}\approx 1.054\) trials. The mean need not be a possible observed value: an individual wait is a whole number of trials, while an average across many waits can be non-integer.

Worked Example: A Low Probability of Success

Suppose, hypothetically, that independent attempts each have success probability \(p=0.10\), and attempts continue until the first success. Find the mean and variance of the number of attempts. We assume the success chance remains 0.10 on every attempt, as required by the model.

Using the mean formula,

$$ E[X]=\frac{1}{0.10}=10\text{ attempts}. $$

Using \(1-p=0.90\), the variance is

$$ \operatorname{Var}(X) =\frac{0.90}{(0.10)^2} =\frac{0.90}{0.01} =90\text{ attempts}^2. $$

The standard deviation is \(\sqrt{90}\approx 9.487\) attempts. Compared with a higher success probability, this model has both a larger mean wait and greater variability in the waiting time.

Interpreting the Results and Avoiding a Common Mistake

The formulas describe features of a probability distribution, not a promise about an individual sequence of trials. For example, a mean of 10 attempts does not say that success will occur on attempt 10, nor that each set of 10 attempts must contain a success. The variance quantifies spread in squared units; to describe spread in the original units, use the standard deviation.

A common error is to use a version of the geometric distribution that counts failures before the first success while applying the trials-through-success formula. If the variable counts trials through success, its support starts at 1 and its mean is \(1/p\). A variable counting failures before success instead has support starting at 0 and is one less than the trials-through-success count. Mixing these definitions shifts the mean by one trial. Always define what \(X\) counts before using a formula.

The derivation also shows why both formulas depend on the model assumptions. The sums used the geometric probability mass function, which came from independent trials with a fixed success probability. If success probabilities change from trial to trial, or outcomes are dependent, the probabilities \(q^{k-1}p\) may no longer describe the waiting time, and these derived moments may not apply.

Check Your Understanding

Use the trials-through-success convention and show the main substitutions in your calculations.

  1. State the support and probability mass function of \(X\) when each independent trial succeeds with probability \(p\).
  2. In one sentence, explain why \(P(X=k)=(1-p)^{k-1}p\).
  3. If \(p=0.20\), find the mean and variance of \(X\), including their units.
  4. What geometric-series identity is used to derive \(E[X]\), and what condition on \(q=1-p\) makes the series valid?
  5. Explain why a variance of 12 trials squared has standard deviation \(\sqrt{12}\) trials, rather than 12 trials.
  6. What changes if a waiting-time variable counts failures before the first success instead of trials through and including it?