Skip to content
VidiMaster it, module by module
Module 7/Common Distributions

The Geometric & Negative Binomial Distributions

Independent repeated Bernoulli trials — each a success with probability pp, a failure with probability 1−p1-p — raise a question the binomial does not answer: not how many successes in a fixed number of trials, but how long until a success. The geometric distribution (Definition 12.9) answers the first version: X∼Geom(p)X\sim\mathrm{Geom}(p) is the trial on which the first success occurs, with probability mass function P{X=k}=(1−p)k−1p\mathbb{P}\{X=k\}=(1-p)^{k-1}p for k=1,2,3,…k=1,2,3,\dots — the price of k−1k-1 failures followed by one success. Its masses form a geometric series summing to 11, and its tail has a clean closed form P{X>k}=(1−p)k\mathbb{P}\{X>k\}=(1-p)^k (all of the first kk trials fail), so P{X≤k}=1−(1−p)k\mathbb{P}\{X\le k\}=1-(1-p)^k; Example 12.10 uses this to find the chance of needing more than seven rolls of a fair die for the first six, (5/6)7≈0.279(5/6)^7\approx0.279. The negative binomial distribution (Definition 12.10) generalises the idea to the trial of the rr-th success: X∼NegBin(r,p)X\sim\mathrm{NegBin}(r,p) has P{X=k}=(k−1r−1)pr(1−p)k−r\mathbb{P}\{X=k\}=\binom{k-1}{r-1}p^r(1-p)^{k-r} for k=r,r+1,…k=r,r+1,\dots, the coefficient (k−1r−1)\binom{k-1}{r-1} counting the arrangements of the r−1r-1 earlier successes among the first k−1k-1 trials. Remark 12.4 ties the two together: the geometric is exactly NegBin(1,p)\mathrm{NegBin}(1,p).

Before you start — give these a try

Attempting first primes your brain for the lesson — even if you miss. Nothing is graded or saved; it's just a warm-up.

A fair die is rolled; let X∼Geom(1/6)X\sim\mathrm{Geom}(1/6) be the roll of the first six. Find P{X>3}\mathbb{P}\{X>3\}, the probability that it takes more than three rolls to get the first six. Give your answer as a decimal to 33 places.

True or false: the geometric distribution Geom(p)\mathrm{Geom}(p) is the special case NegBin(1,p)\mathrm{NegBin}(1,p) of the negative binomial distribution.

What you’ll be able to do

  • State Definition 12.9: X∼Geom(p)X\sim\mathrm{Geom}(p) is the trial of the first success, with p.m.f. P{X=k}=(1−p)k−1p\mathbb{P}\{X=k\}=(1-p)^{k-1}p for k=1,2,3,…k=1,2,3,\dots, and explain the factor as k−1k-1 failures followed by one success.
  • Verify that the geometric masses sum to 11 via the geometric series p∑j=0∞(1−p)j=p⋅11−(1−p)=1p\sum_{j=0}^{\infty}(1-p)^{j}=p\cdot\dfrac{1}{1-(1-p)}=1, and compute individual probabilities P{X=k}\mathbb{P}\{X=k\}.
  • Derive and apply the geometric tail P{X>k}=(1−p)k\mathbb{P}\{X>k\}=(1-p)^k and c.d.f. P{X≤k}=1−(1−p)k\mathbb{P}\{X\le k\}=1-(1-p)^k, reproducing Example 12.10 (P{X>7}=(5/6)7\mathbb{P}\{X>7\}=(5/6)^7 for a fair die).
  • State Definition 12.10: X∼NegBin(r,p)X\sim\mathrm{NegBin}(r,p) is the trial of the rr-th success, with P{X=k}=(k−1r−1)pr(1−p)k−r\mathbb{P}\{X=k\}=\binom{k-1}{r-1}p^{r}(1-p)^{k-r} for k=r,r+1,…k=r,r+1,\dots, and interpret (k−1r−1)\binom{k-1}{r-1} combinatorially.
  • Use Remark 12.4 to recognise the geometric distribution as the special case NegBin(1,p)\mathrm{NegBin}(1,p), and compute negative binomial probabilities for small rr and kk.

In your course

· MATH2015 · Linear Algebra & Probability
§12.3 Common Probability Distributions
  • Definition 12.9Geometric distribution
    X∼Geom(p)X\sim\mathrm{Geom}(p) (0<p≤10<p\le1) is the trial of the first success: P{X=k}=(1−p)k−1p\mathbb{P}\{X=k\}=(1-p)^{k-1}p, k=1,2,3,…k=1,2,3,\dots
  • Example 12.10More than seven rolls for the first six
    For X∼Geom(1/6)X\sim\mathrm{Geom}(1/6), P{X>7}=(1−16)7=(56)7≈0.279\mathbb{P}\{X>7\}=(1-\tfrac16)^{7}=\left(\tfrac56\right)^{7}\approx0.279 (the first seven rolls all fail).
  • Definition 12.10Negative binomial distribution
    X∼NegBin(r,p)X\sim\mathrm{NegBin}(r,p) (0<p≤10<p\le1, r∈Nr\in\mathbb{N}) is the trial of the rr-th success: P{X=k}=(k−1r−1)pr(1−p)k−r\mathbb{P}\{X=k\}=\binom{k-1}{r-1}p^{r}(1-p)^{k-r}, k=r,r+1,…k=r,r+1,\dots
  • Remark 12.4Geometric as a negative binomial
    Geom(p)=NegBin(1,p)\mathrm{Geom}(p)=\mathrm{NegBin}(1,p): the geometric counts trials until the first success.
MATH2015 parameterises both distributions by the trial number of the first (resp. rr-th) success, so the supports begin at k=1k=1 and k=rk=r and the geometric tail is P{X>k}=(1−p)k\mathbb{P}\{X>k\}=(1-p)^{k}. Beware software that instead counts the number of failures (e.g. SciPy's nbinom\texttt{nbinom}), which shifts the variable by k↦k−rk\mapsto k-r.
1

The geometric distribution: waiting for the first success

Run independent Bernoulli(pp) trials — each a success with probability pp and a failure with probability 1−p1-p — and let XX be the trial on which the first success occurs. For X=kX=k, the first k−1k-1 trials must all fail and the kk-th must succeed; by independence these multiply: P{X=k}=(1−p)(1−p)⋯(1−p)⏟k−1 failures  p=(1−p)k−1p,k=1,2,3,…\mathbb{P}\{X=k\}=\underbrace{(1-p)(1-p)\cdots(1-p)}_{k-1\text{ failures}}\;p=(1-p)^{k-1}p,\qquad k=1,2,3,\dots This is Definition 12.9, written X∼Geom(p)X\sim\mathrm{Geom}(p) with 0<p≤10<p\le 1. The possible values start at k=1k=1 — at least one trial is needed — and run through all positive integers, so unlike the binomial the geometric is a genuinely infinite discrete distribution. The masses decay by the constant factor 1−p1-p at each step, P{X=k+1}=(1−p) P{X=k}\mathbb{P}\{X=k+1\}=(1-p)\,\mathbb{P}\{X=k\}, yet still account for all the probability, because the total is a geometric series: ∑k=1∞(1−p)k−1p=p∑j=0∞(1−p)j=p⋅11−(1−p)=pp=1.\sum_{k=1}^{\infty}(1-p)^{k-1}p=p\sum_{j=0}^{\infty}(1-p)^{j}=p\cdot\frac{1}{1-(1-p)}=\frac{p}{p}=1.

2

The tail $\mathbb{P}\{X>k\}=(1-p)^k$ and the c.d.f.

The geometric has an unusually clean tail probability. The event {X>k}\{X>k\} says the first success has not happened by trial kk — equivalently, the first kk trials are all failures. By independence that is just P{X>k}=(1−p)k.\mathbb{P}\{X>k\}=(1-p)^{k}. (The same value drops out of the series ∑j=k+1∞(1−p)j−1p=(1−p)k\sum_{j=k+1}^{\infty}(1-p)^{j-1}p=(1-p)^{k}, but the 'all kk fail' reading is faster and more memorable.) The complementary event {X≤k}\{X\le k\} — the first success arrives on or before trial kk — therefore has cumulative distribution function P{X≤k}=1−P{X>k}=1−(1−p)k.\mathbb{P}\{X\le k\}=1-\mathbb{P}\{X>k\}=1-(1-p)^{k}. These two formulas settle most geometric questions without summing anything: 'more than kk', 'at least kk', and 'within the first kk' all collapse to a single power of 1−p1-p. For instance P{X≥k}=P{X>k−1}=(1−p)k−1\mathbb{P}\{X\ge k\}=\mathbb{P}\{X>k-1\}=(1-p)^{k-1}.

3

The negative binomial distribution: waiting for the $r$-th success

Now wait longer: let XX be the trial on which the rr-th success occurs in the same stream of independent Bernoulli(pp) trials. For X=kX=k, two things must hold. The kk-th trial is a success (the rr-th and last one we count), and among the first k−1k-1 trials there are exactly r−1r-1 successes (hence k−rk-r failures). One specific such pattern has probability pr−1(1−p)k−rp^{r-1}(1-p)^{k-r} over the first k−1k-1 trials times pp on the last, i.e. pr(1−p)k−rp^{r}(1-p)^{k-r}; and there are (k−1r−1)\binom{k-1}{r-1} ways to choose which of the first k−1k-1 trials carry the r−1r-1 early successes. Multiplying, P{X=k}=(k−1r−1)pr(1−p)k−r,k=r,r+1,r+2,…\mathbb{P}\{X=k\}=\binom{k-1}{r-1}p^{r}(1-p)^{k-r},\qquad k=r,r+1,r+2,\dots This is Definition 12.10, written X∼NegBin(r,p)X\sim\mathrm{NegBin}(r,p) with 0<p≤10<p\le 1 and r∈Nr\in\mathbb{N}. The support starts at k=rk=r: you cannot gather rr successes in fewer than rr trials. Note the coefficient is (k−1r−1)\binom{k-1}{r-1}, not (kr)\binom{k}{r} — the final trial is pinned as a success, so only the first k−1k-1 trials are free to be arranged.

4

Geometric as $\mathrm{NegBin}(1,p)$, and how the two compare

Setting r=1r=1 recovers the geometric exactly. With a single success to wait for, (k−10)=1\binom{k-1}{0}=1 and the negative binomial mass becomes P{X=k}=1⋅p1(1−p)k−1=(1−p)k−1p\mathbb{P}\{X=k\}=1\cdot p^{1}(1-p)^{k-1}=(1-p)^{k-1}p — the geometric p.m.f. This is Remark 12.4: Geom(p)=NegBin(1,p)\mathrm{Geom}(p)=\mathrm{NegBin}(1,p). Conceptually the negative binomial is a sum of waits: the trial of the rr-th success is the wait to success 11, plus the wait from there to success 22, and so on — rr independent geometric waits laid end to end. Two cautions keep the formulas straight. First, mind the support: geometric values begin at 11, negative binomial values at rr. Second, mind the convention: here XX is the trial number of the rr-th success, so the exponent on 1−p1-p is k−rk-r (the number of failures). Some books and software instead let the variable count only the failures before the rr-th success (values 0,1,2,…0,1,2,\dots); the two differ by the shift k↦k−rk\mapsto k-r, and mixing them is the most common source of error.

Definition 12.9 — Geometric distribution

Let 0<p≤10<p\le 1. A random variable XX has the geometric distribution with success parameter pp, written X∼Geom(p)X\sim\mathrm{Geom}(p), if P{X=k}=(1−p)k−1p,k=1,2,3,…\mathbb{P}\{X=k\}=(1-p)^{k-1}p,\qquad k=1,2,3,\dots It models the trial on which the first success occurs in independent Bernoulli(pp) trials.

Intuition. To see the first success exactly on trial kk, the first k−1k-1 trials must fail — probability (1−p)k−1(1-p)^{k-1} by independence — and trial kk must succeed — probability pp. The masses decay by a constant ratio 1−p1-p and sum to 11 as a geometric series, which is where the name comes from.
Definition 12.10 — Negative binomial distribution

Let 0<p≤10<p\le 1 and r∈Nr\in\mathbb{N}. A random variable XX has the negative binomial distribution with parameters rr and pp, written X∼NegBin(r,p)X\sim\mathrm{NegBin}(r,p), if P{X=k}=(k−1r−1)pr(1−p)k−r,k=r,r+1,…\mathbb{P}\{X=k\}=\binom{k-1}{r-1}p^{r}(1-p)^{k-r},\qquad k=r,r+1,\dots It models the trial on which the rr-th success occurs.

Intuition. The rr-th success lands on trial kk precisely when the first k−1k-1 trials hold exactly r−1r-1 successes — in any of (k−1r−1)\binom{k-1}{r-1} arrangements, each weighted pr−1(1−p)k−rp^{r-1}(1-p)^{k-r} — followed by a success on trial kk, the final factor of pp. Pinning the last trial as a success is why the count is (k−1r−1)\binom{k-1}{r-1} and not (kr)\binom{k}{r}.
Remark 12.4 — Geometric is $\mathrm{NegBin}(1,p)$

The geometric distribution is the special case r=1r=1 of the negative binomial: Geom(p)=NegBin(1,p)\mathrm{Geom}(p)=\mathrm{NegBin}(1,p), where one counts trials until the first success.

Intuition. Put r=1r=1 in Definition 12.10: (k−10)=1\binom{k-1}{0}=1 and p1(1−p)k−1p^{1}(1-p)^{k-1} is exactly the geometric mass (1−p)k−1p(1-p)^{k-1}p. More vividly, the trial of the rr-th success is a sum of rr independent geometric waits, and with r=1r=1 there is only one such wait.

Worked examples

Example 1

Geometric p.m.f. A biased coin lands heads with probability p=0.3p=0.3 on each independent toss. Let XX be the toss on which the first head appears, so X∼Geom(0.3)X\sim\mathrm{Geom}(0.3). Find P{X=3}\mathbb{P}\{X=3\} (decimal to 33 places).

  1. 1

    Identify the model. XX counts trials until the first success with p=0.3p=0.3, so X∼Geom(0.3)X\sim\mathrm{Geom}(0.3) and P{X=k}=(1−p)k−1p=(0.7)k−1(0.3)\mathbb{P}\{X=k\}=(1-p)^{k-1}p=(0.7)^{k-1}(0.3).

  2. 2

    Read off what X=3X=3 requires. The first head on toss 33 means tosses 11 and 22 are tails and toss 33 is heads: two failures, then a success.

  3. 3

    Substitute k=3k=3. P{X=3}=(0.7)3−1(0.3)=(0.7)2(0.3)=0.49×0.3.\mathbb{P}\{X=3\}=(0.7)^{3-1}(0.3)=(0.7)^{2}(0.3)=0.49\times0.3.

  4. 4

    Compute. 0.49×0.3=0.147.0.49\times0.3=0.147.

Answer. P{X=3}=(0.7)2(0.3)=0.147.\mathbb{P}\{X=3\}=(0.7)^{2}(0.3)=0.147.
Example 2

Example 12.10. What is the probability that it takes more than seven rolls of a fair die to get the first six? Let XX be the roll of the first six, so X∼Geom(1/6)X\sim\mathrm{Geom}(1/6); find P{X>7}\mathbb{P}\{X>7\} (decimal to 33 places).

Example 3

Negative binomial p.m.f. A fair die is rolled repeatedly; let XX be the roll on which the second six appears, so X∼NegBin(2,1/6)X\sim\mathrm{NegBin}(2,1/6). Find P{X=5}\mathbb{P}\{X=5\} (decimal to 33 places).