---
tag: 0XN7KEVSSS
kind: definition
name: Negative binomial distribution
msc: ["60E05"]
defines: 0XBRG3965F
uses: [0WF4EJP91W, 092GEF38YD, 0XCVV5Q500]
sources:
  - url: https://en.wikipedia.org/wiki/Negative_binomial_distribution
    locator: Probability mass function
---

## Definition

Let $r \ge 1$ be an integer and let $p \in (0, 1]$.
The negative binomial distribution with parameters $r$ and $p$ is the distribution on $\{0, 1, 2, \dots\}$ with the [[probability mass function|0WF4EJP91W]]
$$p(k) = \binom{k + r - 1}{k} p^r (1 - p)^k \quad \text{for } k = 0, 1, 2, \dots$$

## Remarks

It is the distribution of the number of failures before the $r$-th success in independent Bernoulli trials with success probability $p$. The last trial is a success, and the $k$ failures are among the other $k + r - 1$ trials.
For $r = 1$ it is the [[geometric distribution|0XCVV5Q500]]. The sum of $r$ independent geometric random variables with parameter $p$ has the negative binomial distribution with parameters $r$ and $p$.
The mean is $r(1 - p)/p$ and the variance is $r(1 - p)/p^2$.
Some authors count the trials, or the successes before a fixed number of failures. Check the convention of each source.

## Explanations

### L1 human

Toss a coin until you have seen $r$ heads, and count the tails on the way.
This count has the negative binomial distribution. For $r = 1$ you wait only for the first head.
