Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Negative Binomial Distribution






Negative Binomial Distribution: Trials Until the r-th Success


The negative binomial distribution extends the geometric experiment by continuing the sequence of independent Bernoulli trials until a specified number of successes is reached. Rather than stopping at the first success, the experiment proceeds until the
rr-th success occurs. The random variable measures the total number of trials required to reach this target, capturing variability in how long repeated success takes to accumulate.

Key Terms

Negative Binomial Distributiontrials needed to achieve rr successes
Geometric Distributionthe r=1r=1 special case
Bernoulli Experimentthe single trial repeated until rr successes
Sequence of Bernoulli Trialsthe repeated structure of the negative binomial
Expected ValueE[X]=r/pE[X] = r/p
VarianceVar(X)=r(1p)/p2\operatorname{Var}(X) = r(1-p)/p^2

See All Probability Definitions


The Probabilistic Experiment Behind negative binomial distribution


The negative binomial distribution generalizes the geometric distribution by counting the number of trials required until a fixed number of successes is reached, rather than just the first success. Trials are independent Bernoulli experiments with constant success probability, and the process continues until the target number of successes is achieved.

Here, the random variable counts the total number of trials, including both successes and failures. The number of successes is fixed in advance, while the number of failures — and thus the total length of the experiment — is random.

This distribution is useful when success must occur multiple times before stopping, and the timing of those successes is uncertain. When the required number of successes is 11, the negative binomial distribution reduces exactly to the geometric distribution.


Example:

Flipping a coin until you obtain 33 heads. If X=7X=7, this means the third head appears on the seventh flip. The sequence ends at the moment the third success occurs.

Negative Binomial Notation

Notation

Negative Binomial Notation

The negative binomial inherits the geometric's two-definitions problem and raises it: two rival counts, a coefficient with a deliberate shift in both slots, and a support that starts at rr instead of zero or one. The marks below are how to tell which negative binomial a source means. All catalogued among the probability symbols.
The declaration tilde and capital/lowercase split come from random variable notation and distribution notation; q=1pq = 1 - p from binomial notation; the coefficient's spellings from binomial coefficient notation; E[X]E[X] and Var(X)\operatorname{Var}(X) from expected value and variance notation.
XNB(r,p)X \sim \operatorname{NB}(r, p)
negative binomial: repeat until the r-th success, with success probability p
NB\operatorname{NB}, NegBin\operatorname{NegBin}, spelled-out NegativeBinomial\operatorname{NegativeBinomial} — and, in older texts, the Pascal distribution for the trials-counting version. The new slot is rr, the target number of successes; setting it to one collapses the family onto the geometric: NB(1,p)=Geom(p)\operatorname{NB}(1, p) = \operatorname{Geom}(p), conventions and all.
CasesBoth of the geometric's rival definitions scale up: XX counts the trials up to the rr-th success, or the failures before it — and software leans failures while texts lean trials, exactly as before; every fingerprint from the geometric's entry applies here with rr in place of one.
Do not confuseThe binomial. The names differ by one word and the letters overlap, but the roles flip: the binomial fixes the trials and counts successes, the negative binomial fixes the successes and counts trials — what is held constant is the entire difference, and the declaration's slots encode it.
P(X=k)=(k1r1)prqkrP(X{=}k) = \dbinom{k-1}{r-1} p^r q^{k-r}
arrange the first k-minus-one trials; the last one is pinned as the r-th success
The coefficient's double shift is the formula's signature: the final trial must be the rr-th success, so only the first k1k{-}1 trials are free to arrange, and only r1r{-}1 successes go among them — (k1r1)\binom{k-1}{r-1}, not (kr)\binom{k}{r}. The failure abbreviation $q$ compresses the tail as usual.
CasesThe failures-counting convention wears a different coat: (k+r1k)prqk\binom{k+r-1}{k} p^r q^k — same pinned-last-trial logic, re-indexed so kk counts failures alone; the coefficient's shape (shifted top-and-bottom vs summed top) is itself a fingerprint of which convention is in force.
Do not confuseThe binomial's unshifted (nk)\binom{n}{k}. Restoring the "missing" ones — writing (kr)\binom{k}{r} — counts arrangements where the last trial is a failure, sequences that never stop at kk; the shift is the mathematics, not a typo.
k=r, r+1, r+2, k = r,\ r{+}1,\ r{+}2,\ \ldots
the support opens at r: fewer trials cannot hold r successes
The family's fourth support style: a shifted open list — unbounded above like the Poisson's, but starting at rr, since rr successes need at least rr trials. The failures convention starts its list at 00 instead — the support line, once again, is the convention's fingerprint.
CasesAll four family support styles are now on record: the binomial's closed list, the Poisson's open ellipsis, the hypergeometric's computed clamps, and this shifted open list — reading the support clause identifies the family before the formula does.
Do not confuseA sum from zero. Summing the trials-convention pmf from k=0k = 0 adds terms with negative factorial arguments — the support clause is not decoration but the guard that keeps the coefficient meaningful.

Parameters


rr: number of successes to achieve (a positive integer)

pp: probability of success in each trial, with 0<p10<p≤1

This distribution models the number of trials needed to observe rr successes, assuming each trial is independent and has the same probability pp of success.

The outcomes are integers rr, r+1r+1 ,r+2r+2 ,…, since at least rr trials are needed.

rr controls the target (how many successes), and pp controls the chance of achieving each one — together, they define how spread out or concentrated the distribution is.

Probability Mass Function (PMF) and Support (Range)


The probability mass function (PMF) of a negative binomial distribution is given by:

P(X=k)=(k1r1)pr(1p)kr,k=r,r+1,r+2,P(X = k) = \binom{k-1}{r-1} p^r (1-p)^{k-r}, \quad k = r, r+1, r+2, \ldots


where (k1r1)=(k1)!(r1)!(kr)!\binom{k-1}{r-1} = \frac{(k-1)!}{(r-1)!(k-r)!} is the binomial coefficient.

Fixed Number of Successes: The negative binomial distribution models the number of trials needed to achieve exactly rr successes in a sequence of independent Bernoulli trials.

Support (Range of the Random Variable):
* The random variable XX can take on values r,r+1,r+2,r, r+1, r+2, \ldots (integers starting from rr).
* X=kX = k means the rr-th success occurs on the kk-th trial.
* The support is thus a countably infinite set.

Logic Behind the Formula:
* (k1r1)\binom{k-1}{r-1}: The number of ways to arrange r1r-1 successes in the first k1k-1 trials (the kk-th trial must be the rr-th success)
* prp^r: The probability of getting exactly rr successes
* (1p)kr(1-p)^{k-r}: The probability of getting exactly krk-r failures
* The total probability sums to 1:

k=rP(X=k)=k=r(k1r1)pr(1p)kr=1\sum_{k=r}^{\infty} P(X = k) = \sum_{k=r}^{\infty} \binom{k-1}{r-1} p^r (1-p)^{k-r} = 1

* This follows from the negative binomial series expansion.

Negative Binomial Distribution

Trials until r-th success (generalization of geometric)

Explanation

The negative binomial distribution models the number of trials needed to achieve rr successes in repeated independent trials. The probability mass function is P(X=k)=(k1r1)pr(1p)krP(X = k) = \binom{k-1}{r-1} p^r (1-p)^{k-r}. The expected value is E[X]=rpE[X] = \frac{r}{p} and the variance is Var(X)=r(1p)p2\text{Var}(X) = \frac{r(1-p)}{p^2}. This distribution is used for modeling scenarios like the number of calls until rr sales are made, games played until rr wins are achieved, or attempts until rr successes occur.


Cumulative Distribution Function (CDF)


The cumulative distribution function (CDF) of a negative binomial distribution is given by:

FX(k)=P(Xk)=i=rk(i1r1)pr(1p)irF_X(k) = P(X \leq k) = \sum_{i=r}^{k} \binom{i-1}{r-1} p^r (1-p)^{i-r}


Where:
rr = number of successes desired (fixed, positive integer)
pp = probability of success on each trial
kk = number of trials until the rr-th success (where krk \geq r)
(i1r1)\binom{i-1}{r-1} = binomial coefficient

Intuition Behind the Formula


Definition: The CDF gives the probability that the rr-th success occurs on or before trial kk.

Summation of Probabilities:
We sum the PMF values from the minimum possible value (rr trials) up to kk trials:

P(Xk)=P(X=r)+P(X=r+1)+P(X=r+2)++P(X=k)P(X \leq k) = P(X=r) + P(X=r+1) + P(X=r+2) + \cdots + P(X=k)


Alternative Formulation via Regularized Incomplete Beta Function:
The CDF can also be expressed using the regularized incomplete beta function:

FX(k)=Ip(r,kr+1)F_X(k) = I_p(r, k-r+1)


This relationship connects the negative binomial distribution to the beta distribution and is often used in statistical software for efficient computation.

Complementary Form:
The probability that the rr-th success occurs after trial kk is:

P(X>k)=1FX(k)P(X > k) = 1 - F_X(k)

Negative Binomial Distribution CDF

CDF for waiting time until r-th success

CDF Explanation

The negative binomial CDF is F(k)=P(Xk)=i=rk(i1r1)pr(1p)irF(k) = P(X \leq k) = \sum_{i=r}^{k} \binom{i-1}{r-1} p^r (1-p)^{i-r} for krk \geq r. This gives the probability that the rr-th success occurs on or before trial kk. The CDF begins at k=rk = r (minimum trials needed for rr successes) with value F(r)=prF(r) = p^r. As kk increases, the CDF approaches 1.0. The distribution generalizes the geometric distribution (which is the special case r=1r = 1), and its shape depends on both the number of required successes rr and the success probability pp.

Expected Value (Mean)


As explained in the general case for calculating expected value, the expected value of a discrete random variable is computed as a weighted sum where each possible value is multiplied by its probability:

E[X]=xxP(X=x)E[X] = \sum_{x} x \cdot P(X = x)


For the negative binomial distribution, we apply this general formula to the specific probability mass function of this distribution.

Formula


E[X]=rpE[X] = \frac{r}{p}


Where:
rr = number of successes desired (fixed, positive integer)
pp = probability of success on each trial

Derivation and Intuition


The negative binomial random variable XX represents the number of trials needed to achieve rr successes. It can be viewed as the sum of rr independent geometric random variables, where each represents the number of trials needed to achieve one additional success.

Since each geometric variable has expected value 1p\frac{1}{p}, and we need rr such successes:

E[X]=r1p=rpE[X] = r \cdot \frac{1}{p} = \frac{r}{p}


This result follows directly from the linearity of expectation applied to the sum of rr geometric random variables.

The result E[X]=rpE[X] = \frac{r}{p} extends the geometric distribution's intuition: if you need one success and expect 1p\frac{1}{p} trials, then needing rr successes should require rr times as many trials on average.

Example


Consider rolling a die until you get three 6's, where r=3r = 3 and p=16p = \frac{1}{6}:

E[X]=31/6=18E[X] = \frac{3}{1/6} = 18


On average, you expect to roll the die 18 times before accumulating three 6's. This is exactly three times the expected wait for a single 6.

Variance and Standard Deviation


The variance of a discrete random variable measures how spread out the values are around the expected value. It is computed as:

Var(X)=E[(Xμ)2]=x(xμ)2P(X=x)\mathrm{Var}(X) = \mathbb{E}[(X - \mu)^2] = \sum_{x} (x - \mu)^2 P(X = x)


Or using the shortcut formula:

Var(X)=E[X2]μ2\mathrm{Var}(X) = \mathbb{E}[X^2] - \mu^2


For the negative binomial distribution, we apply this formula to derive the variance.

Formula


Var(X)=r(1p)p2\mathrm{Var}(X) = \frac{r(1-p)}{p^2}


Where:
rr = number of successes desired (fixed, positive integer)
pp = probability of success on each trial
(1p)=q(1-p) = q = probability of failure on each trial

Derivation and Intuition


The negative binomial random variable can be viewed as the sum of rr independent geometric random variables, each representing the trials needed for one additional success.

Since each geometric variable has variance 1pp2\frac{1-p}{p^2}, and variances add for independent variables:

Var(X)=r1pp2=r(1p)p2\mathrm{Var}(X) = r \cdot \frac{1-p}{p^2} = \frac{r(1-p)}{p^2}


The result Var(X)=r(1p)p2\mathrm{Var}(X) = \frac{r(1-p)}{p^2} extends the geometric distribution's variance by a factor of rr. As with the geometric case, variance increases rapidly as pp decreases (rare successes create high variability) and grows linearly with the number of required successes rr.

Standard Deviation


σ=r(1p)p2=r(1p)p\sigma = \sqrt{\frac{r(1-p)}{p^2}} = \frac{\sqrt{r(1-p)}}{p}


Example


Consider rolling a die until you get three 6's, where r=3r = 3 and p=16p = \frac{1}{6}:

Var(X)=3×56(16)2=156136=52×36=90\mathrm{Var}(X) = \frac{3 \times \frac{5}{6}}{(\frac{1}{6})^2} = \frac{\frac{15}{6}}{\frac{1}{36}} = \frac{5}{2} \times 36 = 90


σ=909.487\sigma = \sqrt{90} \approx 9.487


The variance of 90 and standard deviation of about 9.5 indicate high variability around the expected 18 rolls. The actual number of rolls needed could vary substantially from this average.

Mode and Median

Mode


The mode is the value of kk (number of failures before the rr-th success) with the highest probability—the peak of the PMF.

For the negative binomial distribution, the mode depends on the parameters rr and pp:

If r>1r > 1:
The mode is (r1)(1p)p\lfloor \frac{(r-1)(1-p)}{p} \rfloor

If r=1r = 1:
The mode is 0 (this reduces to the geometric distribution)

Intuition: The mode sits near the expected value r(1p)p\frac{r(1-p)}{p}, representing the most likely number of failures before achieving rr successes. As pp decreases (success becomes rarer), the mode shifts rightward, reflecting that more failures are expected before accumulating the required successes.

Example: For r=5r = 5 and p=0.3p = 0.3:

Mode = (51)(10.3)0.3=4×0.70.3=9.33=9\lfloor \frac{(5-1)(1-0.3)}{0.3} \rfloor = \lfloor \frac{4 \times 0.7}{0.3} \rfloor = \lfloor 9.33 \rfloor = 9

Getting exactly 9 failures before the 5th success is more likely than any other outcome.

Example: For r=1r = 1 and p=0.4p = 0.4:

Mode = 0 (geometric case: most likely to succeed on first trial)

Median


The median is the value mm such that P(Xm)0.5P(X \leq m) \geq 0.5 and P(Xm)0.5P(X \geq m) \geq 0.5.

For the negative binomial distribution, there is no simple closed-form expression for the median, but it can be found numerically by solving:

k=0m(k+r1k)pr(1p)k0.5\sum_{k=0}^{m} \binom{k+r-1}{k} p^r (1-p)^k \geq 0.5


Properties of the median:
• The median is always close to the mean r(1p)p\frac{r(1-p)}{p}
• For r=1r = 1, the median follows the geometric distribution formula
• The distribution is right-skewed, so median < mean typically

Example:
For r=3r = 3 and p=0.5p = 0.5:
Mean = 3(10.5)0.5=3\frac{3(1-0.5)}{0.5} = 3

The median is approximately 2-3 (found numerically)

Example:
For r=5r = 5 and p=0.3p = 0.3:
Mean = 5(10.3)0.311.67\frac{5(1-0.3)}{0.3} \approx 11.67

The median is approximately 11 (close to the mean)

Unlike continuous distributions where finding the median requires integration, for discrete distributions, the median is found by summing probabilities until reaching 0.5.

Applications and Examples


### Practical Example

Suppose you're flipping a coin until you get r=3r = 3 heads, where the probability of heads is p=0.5p = 0.5. The probability that you need exactly k=6k = 6 flips to get your third head is:

P(X=6)=(6131)(0.5)3(0.5)63=(52)(0.5)3(0.5)3=100.1250.125=0.15625P(X = 6) = \binom{6-1}{3-1} (0.5)^3 (0.5)^{6-3} = \binom{5}{2} (0.5)^3 (0.5)^3 = 10 \cdot 0.125 \cdot 0.125 = 0.15625

This means there's a 15.625% chance that you'll need exactly 6 flips to get your third head.

Note: The geometric distribution is a special case of the negative binomial distribution where r=1r = 1.

Interactive Calculator


This interactive calculator computes probabilities for the negative binomial distribution, which models the number of failures before achieving a target number of successes. Enter your target successes (rr), success probability (pp), and choose whether you want the full distribution or specific probabilities to see how many failures you might encounter. Perfect for modeling customer acquisition, manufacturing quality targets, or any scenario where you need multiple successes and want to know about the failures along the way.

1. Select probability type: 'All values' for full distribution, or choose a specific query
2. Enter r (number of successes) - how many successes you want to achieve
3. Enter p (success probability) - probability of success on each trial (0 < p ≤ 1)
4. For specific queries, enter k (number of failures) - failures before achieving r successes
5. Click Calculate to see probabilities and distribution

Negative Binomial Distribution Calculator

Calculate probabilities and distribution properties

Target number of successes

Probability of success on each trial

,

Negative Binomial at a Glance

The table below collects the full anatomy of the negative binomial distribution into a single reference card — its parameters and support, the PMF and CDF, the mean and variance formulas, mode and median behavior, the geometric special case, and a canonical example.
Aspect Formula / statement Note / example
Parameters r (target successes, positive integer); p (success probability, 0 < p ≤ 1) trials are independent with constant success probability p
Support k ∈ {r, r + 1, r + 2, ...} at least r trials are needed to accumulate r successes
PMF P(X = k) = C(k − 1, r − 1) · pr · (1 − p)k − r the k-th trial must be the r-th success; arrange r − 1 successes among the first k − 1 trials
CDF F(k) = ∑i=rk C(i − 1, r − 1) · pr · (1 − p)i − r = Ip(r, k − r + 1) no closed form; expressible via the regularized incomplete beta function
Expected value E[X] = r / p r times the geometric wait — by linearity over r independent geometric trials
Variance Var(X) = r(1 − p) / p2; σ = √(r(1 − p)) / p grows linearly with r; explodes as p → 0
Mode and median mode = ⌊(r − 1)(1 − p) / p⌋ (failures form); median ≈ mean, computed numerically right-skewed; median typically slightly below mean
Special case NegBin(1, p) = Geom(p) setting r = 1 collapses to the geometric distribution
Canonical example rolling a die until three 6s: r = 3, p = 1/6 E[X] = 18 rolls, Var(X) = 90, σ ≈ 9.49

Negative Binomial Distribution FAQ

What is the difference between the binomial and negative binomial?

+
What is held fixed. The binomial fixes the number of trials and counts successes; the negative binomial fixes the number of successes and counts trials. Everything else follows from that swap — the binomial's support is bounded by n, while the negative binomial's runs upward without limit, since any number of trials might be needed.Read more →

How is the negative binomial related to the geometric?

+
The geometric is the case r = 1: NB(1, p) = Geom(p), conventions and all. Going the other way, a negative binomial variable is the sum of r independent geometrics — wait for the first success, then start over and wait for the second, r times. That is why the mean is r/p, exactly r times the geometric's 1/p.Read more →

Why is the coefficient C(k−1, r−1) and not C(k, r)?

+
Because the last trial is pinned. The k-th trial must be the r-th success, or the sequence would have stopped earlier — so only the first k−1 trials are free to arrange, and only r−1 successes go among them. Writing C(k, r) counts sequences ending in a failure, which never stop at k. The shift is the mathematics, not a typo.Read more →

Why does the negative binomial support start at r?

+
Because r successes need at least r trials — fewer is impossible, so the list opens at k = r and runs upward without bound. Summing the pmf from k = 0 instead feeds negative arguments into the binomial coefficient. Under the failures convention the list starts at 0, which is itself a fingerprint of which convention is in force.Read more →