St · Statistics & Probability

How to Prove the Variance of a Geometric Distribution

Updated 13 October 2026

At a glance

  1. 1. Choose a convention

    Let X count trials up to and including the first success, with success probability p.

  2. 2. Write the generating function

    Use the probability-generating function G(s) = ps / (1 − (1 − p)s).

  3. 3. Differentiate

    Evaluate G′(1) and G″(1) to obtain the mean and the second factorial moment.

  4. 4. Calculate variance

    Use Var(X) = E[X(X − 1)] + E[X] − E[X]² to get (1 − p) / p².

A geometric random variable models the number of independent trials needed to get the first success. Its variance depends on the success probability, but the distribution is defined using two common counting conventions. This proof starts with the convention that counts the successful trial, then shows why the other convention has the same variance.

Define the geometric distribution

Let each trial succeed with probability pp, where 0<p≤10 < p \leq 1, and write q=1−pq = 1-p. Define XX to be the number of trials up to and including the first success. Then XX takes values 1,2,3,…1,2,3,\ldots, and

Pr⁡(X=k)=qk−1p.\Pr(X=k)=q^{k-1}p.

For example, X=3X=3 means the first two trials fail and the third succeeds. The probability-generating function (PGF) is

G(s)=E[sX]=∑k=1∞qk−1psk=ps1−qs.G(s)=\mathbb{E}[s^X]=\sum_{k=1}^{\infty}q^{k-1}p s^k=\frac{ps}{1-qs}.

The geometric series converges when ∣qs∣<1|qs|<1. Since q<1q<1 when p>0p>0, the function and its derivatives are well-defined at s=1s=1.

Derive the mean and second factorial moment

For a PGF, the first derivative at 1 gives the mean, and the second derivative at 1 gives the second factorial moment, E[X(X−1)]\mathbb{E}[X(X-1)]. Differentiate:

G′(s)=p(1−qs)2,G′′(s)=2pq(1−qs)3.\begin{aligned} G'(s) &= \frac{p}{(1-qs)^2},\\ G''(s) &= \frac{2pq}{(1-qs)^3}. \end{aligned}

At s=1s=1, the denominator 1−q1-q equals pp. Therefore,

E[X]=G′(1)=1p,E[X(X−1)]=G′′(1)=2qp2.\mathbb{E}[X]=G'(1)=\frac{1}{p}, \qquad \mathbb{E}[X(X-1)]=G''(1)=\frac{2q}{p^2}.

The second derivative does not directly give E[X2]\mathbb{E}[X^2]. Instead, use X2=X(X−1)+XX^2=X(X-1)+X, so

E[X2]=2qp2+1p.\mathbb{E}[X^2]=\frac{2q}{p^2}+\frac{1}{p}.

Now apply Var⁡(X)=E[X2]−E[X]2\operatorname{Var}(X)=\mathbb{E}[X^2]-\mathbb{E}[X]^2:

Var⁡(X)=2qp2+1p−1p2=2q+p−1p2=qp2=1−pp2.\begin{aligned} \operatorname{Var}(X) &=\frac{2q}{p^2}+\frac{1}{p}-\frac{1}{p^2}\\ &=\frac{2q+p-1}{p^2}\\ &=\frac{q}{p^2}\\ &=\frac{1-p}{p^2}. \end{aligned}

Thus, for the convention that counts the successful trial, the mean is 1/p1/p and the variance is (1−p)/p2(1-p)/p^2.

Worked example

Suppose a trial succeeds with probability p=0.2p=0.2. Then q=0.8q=0.8. The expected number of trials is

E[X]=10.2=5,\mathbb{E}[X]=\frac{1}{0.2}=5,

and the variance is

Var⁡(X)=0.8(0.2)2=20.\operatorname{Var}(X)=\frac{0.8}{(0.2)^2}=20.

The standard deviation is therefore 20≈4.47\sqrt{20}\approx 4.47 trials. A variance larger than the mean is possible here: many trials may be needed when success is relatively unlikely, creating a broad distribution.

As a boundary case, if p=1p=1, the first trial always succeeds. The formula gives variance 00, as expected for a constant random variable.

If you count failures instead

Some texts define a geometric random variable YY as the number of failures before the first success. Its possible values are 0,1,2,…0,1,2,\ldots, with Y=X−1Y=X-1. Subtracting a constant changes the mean but not the variance, so

E[Y]=1−pp,Var⁡(Y)=1−pp2.\mathbb{E}[Y]=\frac{1-p}{p}, \qquad \operatorname{Var}(Y)=\frac{1-p}{p^2}.

Check which convention a problem uses before quoting the mean. The variance formula is the same for both conventions, provided pp means the probability of success on each trial.

Common mistakes

  • Mixing the two conventions: The means 1/p1/p and (1−p)/p(1-p)/p correspond to different definitions. State whether the variable counts trials or failures.
  • Treating G′′(1)G''(1) as the second moment: It equals E[X(X−1)]\mathbb{E}[X(X-1)], not E[X2]\mathbb{E}[X^2]. Add E[X]\mathbb{E}[X] to obtain the second moment.
  • Using the failure probability as pp without saying so: If a source uses pp for the probability of failure, rewrite the formula in terms of the success probability before comparing results.
  • Forgetting the squared mean: Variance is E[X2]−(E[X])2\mathbb{E}[X^2]-(\mathbb{E}[X])^2, not just the second moment.

References

  1. A First Course in Probability — Sheldon Ross

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.