A generalization of the Geometric distribution. Consider a sequence of independent Bernoulli trials, each with success probability $0<p<1$. Assume the trials continue until at least the $r$th success, where $r∈Z_{+}$.

Let $X$ be the r.v. that equals the number of failures before the $r$th success. Then $X$ has the **Negative Binomial distribution** and the textbook writes this as $X∼NBin(r,p)$.

Notice that when $r=1$, then this is just the Geometric distribution. Hence it’s a generalization.

## PMF

Similar to the intuition for the Geometric distribution’s PMF, we now have multiple successes $r$ along with our $k$ failures. However, the order in which the $r$ successes matters, because the sample space is all the *sequences* of trials that lead to the $r$th success.

Given $X=k$, this means we have $k+r$ total trials. The $k+r$th trial is the one where we get our $r$th success, so we need to place the $r−1$ successes among the other $k+r−1$ trials that occur before it. We fill in the remaining $k$ spots with our failures.

Let $q=1−p$. the PMF is given by

$P(X=k)=(r−1k+r−1 )p_{r}q_{k}$## Expectation

Consider $X∼NBin(3,p)$. We can define it in terms of 3 new r.v.s:

- $X_{1}$ equals the number of failures until the 1st success.
- $X_{2}$ equals the number of failures
*between*the 1st and 2nd success. - $X_{3}$ equals the number of failures
*between*the 2nd and 3rd success.

Then it must be true that $X=X_{1}+X_{2}+X_{3}$. In addition, they are all independent of one another, and all have the Geometric distribution.

By LOE, we have $E(X)=E(X_{1})+E(X_{2})+E(X_{3})$, and so the expectation of $X$ is given by

$E(X)=r⋅p1−p $for $r$ successes and success probability of $p$.