Negative Binomial Calculator
The negative binomial distribution answers how many trials it takes to reach a target number of successes. Enter the success probability per trial, the target number of successes r, and a trial number x. The calculator returns the probability that the r-th success occurs exactly on trial x, the probability it occurs on or before trial x, and the distribution's mean and variance.
Negative binomial formula
P(X = x) = C(x - 1, r - 1) * p^r * (1 - p)^(x - r), for x ≥ r
P(X ≤ x) = sum of P(X = i) for i from r to x
Mean = r / p
Variance = r * (1 - p) / p^2
X is the trial on which the r-th success occurs. The combination counts how the earlier r minus 1 successes can fall among the first x minus 1 trials, with the final success fixed on trial x.
Worked example
With p = 0.3 and r = 3, the probability that the third success arrives exactly on trial 7 is C(6, 2) times 0.3^3 times 0.7^4 = 15 times 0.027 times 0.2401 = 0.0972, about 9.72%. The mean number of trials to three successes is 3 divided by 0.3 = 10.
Negative binomial: frequently asked questions
What does the negative binomial distribution model?
It models the number of independent Bernoulli trials needed to reach a fixed number of successes r, where each trial succeeds with probability p. A common question is the chance that the r-th success lands exactly on trial number x.
What is the formula for the r-th success on trial x?
P(X = x) = C(x - 1, r - 1) times p^r times (1 - p)^(x - r), for x at least r. The first factor counts the arrangements of the earlier r minus 1 successes among the first x minus 1 trials, with the r-th success fixed on trial x.
What are the mean and variance?
For the trials-until-r-successes form, the mean is r divided by p and the variance is r times (1 - p) divided by p squared. The mean tells you the expected trial on which the r-th success arrives.
How does it relate to the geometric distribution?
The geometric distribution is the special case r equals 1: the number of trials to the first success. The negative binomial generalises this to the r-th success.
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods: Negative binomial distribution.
Reviewed by the CalculatorHub team, edited by James Graham, 19 June 2026. See our methodology.