How it’s calculated
The negative binomial distribution asks: how many independent trials does it take to get the r-th success, if each trial succeeds with probability p? It generalizes the geometric distribution (r = 1) and is often used for "how many tries until I have 3 sales" or "how many games until the 4th win".
The factor C(k − 1, r − 1) counts the ways to place the first r − 1 successes among the first k − 1 trials; trial k itself must be the r-th success.
Worked example: a fair coin (p = 0.5). What is the chance the 3rd head comes on flip 5? C(4, 2) × 0.5³ × 0.5² = 6 ÷ 32 = 0.1875. The chance of getting 3 heads within 5 flips is (10 + 5 + 1) ÷ 32 = 0.5, so P(X > 5) is also 0.5. The mean number of flips is 3 ÷ 0.5 = 6, with variance 3 × 0.5 ÷ 0.25 = 6.
Some software counts only the failures before the r-th success. That variable is X − r, with mean r(1 − p) ÷ p and the same variance. This calculator counts all trials.
Frequently asked questions
How is it different from the binomial distribution?
The binomial fixes the number of trials and counts successes. The negative binomial fixes the number of successes and counts trials.
Why must k be at least r?
You need at least r trials to get r successes, so P(X = k) is 0 for smaller k.
What if my textbook counts failures instead of trials?
Let Y be the failures before the r-th success. Then Y = X − r, so P(Y = j) equals P(X = j + r) here, and the mean of Y is r(1 − p) ÷ p.
Is there an upper limit on k?
The calculator accepts k up to 200,000, which keeps the page fast. Beyond that the probabilities are usually tiny or the normal approximation is adequate.
Embed this calculator
Add this free calculator to your own website. Copy the code below into your page’s HTML:
Need this calculator branded, changed or built around your own prices?See custom business solutions →
Sources
- Probability, Mathematical Statistics, and Stochastic Processes (Siegrist), §11.4 The Negative Binomial Distribution — LibreTexts
Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.
Added · Last updated · How we check our calculators
Spotted a mistake or missing option? Report a problem· Suggest a calculator