St · Statistics & Probability

What Is the MGF of the Negative Binomial Distribution?

Updated 13 October 2026

At a glance

  1. 1. Choose the convention

    Let X count failures before the rth success, with success probability p.

  2. 2. Write the probability mass

    Use the probability of x failures: choose(x + r − 1, x) p^r (1 − p)^x.

  3. 3. Form the generating sum

    Multiply each probability by e^(tx) and sum over x from zero to infinity.

  4. 4. Check the domain

    The sum converges when t is less than −ln(1 − p).

The negative binomial distribution has more than one common convention, so its moment-generating function (MGF) depends on what the random variable counts. The formula below uses the convention that XX is the number of failures before the rrth success, with success probability pp on each independent trial.

With that convention, the MGF is finite for t<−ln⁡(1−p)t<-\ln(1-p). If your variable counts total trials instead, the adjustment is a factor of erte^{rt}.

MGF for failures before the rth success

Let rr be a positive integer and let 0<p<10<p<1. The probability mass function is

P(X=x)=(x+r−1x)pr(1−p)x,x=0,1,2,….P(X=x)=\binom{x+r-1}{x}p^r(1-p)^x,\qquad x=0,1,2,\ldots.

The MGF is MX(t)=E[etX]M_X(t)=\mathbb{E}[e^{tX}]. Substituting the probability mass function gives

MX(t)=∑x=0∞etx(x+r−1x)pr(1−p)x=pr∑x=0∞(x+r−1x)((1−p)et)x.\begin{aligned} M_X(t) &=\sum_{x=0}^{\infty}e^{tx}\binom{x+r-1}{x}p^r(1-p)^x\\ &=p^r\sum_{x=0}^{\infty}\binom{x+r-1}{x}\bigl((1-p)e^t\bigr)^x. \end{aligned}

The binomial-series identity

∑x=0∞(x+r−1x)zx=(1−z)−r,∣z∣<1,\sum_{x=0}^{\infty}\binom{x+r-1}{x}z^x=(1-z)^{-r},\qquad |z|<1,

then yields

MX(t)=(p1−(1−p)et)r.\boxed{M_X(t)=\left(\frac{p}{1-(1-p)e^t}\right)^r}.

For a real value of tt, the series converges when (1−p)et<1(1-p)e^t<1, which is equivalent to

t<−ln⁡(1−p).t< -\ln(1-p).

This domain includes t=0t=0, as an MGF must, and MX(0)=1M_X(0)=1. When p=1p=1, there are no failures and X=0X=0 with probability one, so its MGF is 11 for every real tt. The usual negative-binomial model assumes 0<p<10<p<1.

Worked example

Suppose you count failures before the third success, and each trial succeeds with probability p=0.4p=0.4. Then r=3r=3 and 1−p=0.61-p=0.6, so

MX(t)=(0.41−0.6et)3,t<−ln⁡(0.6)≈0.511.M_X(t)=\left(\frac{0.4}{1-0.6e^t}\right)^3, \qquad t< -\ln(0.6)\approx 0.511.

At t=0t=0, the expression equals (0.4/0.4)3=1(0.4/0.4)^3=1. The mean and variance can also be checked by differentiating the logarithm of the MGF:

ddtln⁡MX(t)=r(1−p)et1−(1−p)et,E[X]=MX′(0)=r(1−p)p=4.5,Var⁡(X)=d2dt2ln⁡MX(t)∣t=0=r(1−p)p2=11.25.\begin{aligned} \frac{d}{dt}\ln M_X(t)&=\frac{r(1-p)e^t}{1-(1-p)e^t},\\ \mathbb{E}[X]&=M_X'(0)=\frac{r(1-p)}{p}=4.5,\\ \operatorname{Var}(X)&=\left.\frac{d^2}{dt^2}\ln M_X(t)\right|_{t=0} =\frac{r(1-p)}{p^2}=11.25. \end{aligned}

The mean of 4.5 is the expected number of failures before the third success; it need not be an integer.

If the variable counts total trials

Let NN be the number of trials up to and including the rrth success. Since N=X+rN=X+r, its MGF is

MN(t)=E[et(X+r)]=ertMX(t)=(pet1−(1−p)et)r.M_N(t)=\mathbb{E}[e^{t(X+r)}]=e^{rt}M_X(t) =\left(\frac{pe^t}{1-(1-p)e^t}\right)^r.

The domain is unchanged. For the example above, NN has mean r/p=7.5r/p=7.5 and variance r(1−p)/p2=11.25r(1-p)/p^2=11.25. The fixed shift by rr increases the mean by rr but does not change the variance.

A different convention counts successes before a specified number of failures. If the target is rr failures and each trial succeeds with probability pp, then the failure probability is 1−p1-p, and the MGF for the success count YY is

MY(t)=(1−p1−pet)r,t<−ln⁡(p).M_Y(t)=\left(\frac{1-p}{1-pe^t}\right)^r, \qquad t< -\ln(p).

The formula changes because the counted outcome and the event being repeated until are different.

Common mistakes

  • Mixing up pp and 1−p1-p. State which outcome has probability pp and which outcome your variable counts before using a formula.
  • Forgetting the fixed shift. Counting total trials rather than failures adds rr to the random variable, so its MGF needs the factor erte^{rt}.
  • Ignoring the convergence condition. The expression is not finite for every real tt; for failures before the rrth success, require t<−ln⁡(1−p)t< -\ln(1-p).
  • Treating conventions as interchangeable. A formula from a source may use the number of successes before a fixed number of failures. Compare the random variable’s definition and support before applying it.

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.