= Solution
For $X=x$, the last flip must be the $r$th head. Among the preceding $x+r-1$ flips, exactly $x$ are tails and $r-1$ are heads. There are $\binom{x+r-1}{x}$ choices for their positions, and every resulting sequence has probability $(1-p)^x p^r$. The <negative binomial stopping argument> therefore gives
$$
\boxed{\mathbb P(X=x)=\binom{x+r-1}{x}(1-p)^x p^r},
\qquad x=0,1,\ldots,
$$
so $X$ has the failures-before-the-$r$th-success <negative binomial distribution>.
To put the mass function into <exponential family> form, set
$$
\theta=\log(1-p),
\qquad -\infty<\theta<0.
$$
Since $p=1-e^\theta$,
$$
\mathbb P_\theta(X=x)
=\binom{x+r-1}{x}
\exp\!\left\{\theta x+r\log(1-e^\theta)\right\}
=h(x)\exp\{\theta T(x)-A(\theta)\},
$$
where
$$
\boxed{T(x)=x},
\qquad
\boxed{A(\theta)=-r\log(1-e^\theta)},
\qquad
h(x)=\binom{x+r-1}{x}.
$$
Thus the <natural parameter of an exponential family> is $\theta$, and the <Fisher-Neyman factorization theorem> shows that $T(X)=X$ is a <sufficient statistic>. This is the <negative binomial exponential family>.
The <exponential-family derivative identities> now give
$$
\mathbb E[X]=A'(\theta)
=\frac{r e^\theta}{1-e^\theta}
=\boxed{\frac{r(1-p)}p}
$$
and
$$
\operatorname{var}(X)=A''(\theta)
=\frac{r e^\theta}{(1-e^\theta)^2}
=\boxed{\frac{r(1-p)}{p^2}}.
$$
Back to article page