Negative Binomial Probability Calculator
The negative binomial distribution answers the question: what is the probability that the r-th success occurs on exactly the k-th trial, given that each trial independently succeeds with probability p? This is useful whenever you are counting how many attempts are needed to reach a fixed number of successes, such as games won, sales closed, or components passed quality inspection. Enter the trial number (k), the target number of successes (r), and the per-trial success probability (p as a percentage) to get the exact probability.
Negative binomial formula
P(X = k) = C(k-1, r-1) × p^r × (1-p)^(k-r)
Where C(k-1, r-1) = (k-1)! / ((r-1)! times (k-r)!) is the binomial coefficient counting the ways to arrange the first r-1 successes among the first k-1 trials. The r-th success must fall on trial k.
Distribution properties
- Mean (expected trials): r / p. For r = 3 successes at p = 0.4, expected trials = 3/0.4 = 7.50.
- Variance: r(1-p) / p squared.
- k must be at least r (you cannot achieve 3 successes in fewer than 3 trials).
- When r = 1, the negative binomial reduces to the geometric distribution.
Frequently asked questions
What is the negative binomial distribution?
The negative binomial distribution models the probability that the r-th success occurs on exactly the k-th trial in a sequence of independent Bernoulli trials, each with the same probability of success p. It generalizes the geometric distribution (which handles r = 1).
What is the formula for negative binomial probability?
P(X = k) = C(k-1, r-1) times p^r times (1-p)^(k-r), where k is the trial number of the r-th success, r is the target number of successes, p is the success probability on each trial, and C(k-1, r-1) is the binomial coefficient.
What are examples of negative binomial situations?
Classic examples include: the number of coin flips needed to get 5 heads; the number of job applications before receiving r offers; the number of oil wells drilled before r are productive; and in genomics, modeling over-dispersed count data.
What constraints apply to the inputs?
The number of trials k must be at least r (you need at least r trials to achieve r successes). The success probability p must be strictly between 0 and 1. The number of required successes r must be a positive integer.
What is the expected number of trials to get r successes?
The expected value of the total number of trials is r divided by p. For example, if each trial has a 20% success rate and you need 5 successes, the expected number of trials is 5 divided by 0.2 = 25 trials.
Official sources
- NIST/SEMATECH e-Handbook of Statistical Methods: Negative Binomial Distribution.
- NIST Digital Library of Mathematical Functions: Chapter 26: Combinatorial Analysis.
Reviewed by the CalculatorHub team, edited by James Graham, 15 June 2026. See our methodology.