The binomial distribution fixes the number of trials and counts successes. The negative binomial flips the question: fix the number of successes and count the trials. How many free throws until the third make? How many interviews until the second offer? How many components off the line until the fifth defect? This negative binomial distribution calculator gives the probability that the r-th success lands exactly on trial k, the cumulative probability that it arrives by trial k, and the distribution’s mean and variance.
The Negative Binomial Formula
For the r-th success to land exactly on trial k, two things must happen: exactly r − 1 successes occur in the first k − 1 trials, and trial k itself is a success. The first event is an ordinary binomial count, the second has probability p, giving P(X = k) = C(k − 1, r − 1) × pr × (1 − p)k − r. The combination C(k − 1, r − 1) counts the orders the early successes and failures can arrive in. This calculator evaluates that formula with log-gamma arithmetic (so large trial counts do not overflow), sums it for the cumulative probability, and reports the mean r ÷ p and variance r(1 − p) ÷ p².
Worked Example: The Third Make
A player shoots free throws at p = 0.5 (a coin-flip shooter, chosen for clean arithmetic). The probability that her third make lands exactly on her fifth attempt: the first four attempts must contain exactly 2 makes — C(4, 2) = 6 orders — and the fifth must go in. P = 6 × (0.5)³ × (0.5)² = 6 × 0.03125 = 0.1875, or 18.75 percent. The cumulative chance the third make has arrived by attempt five is P(X ≤ 5) = 0.125 + 0.1875 + 0.1875 = 0.5000 — exactly fifty-fifty, a memorable symmetry of the p = 0.5 case. Her expected wait for three makes is r ÷ p = 6 attempts.
Negative Binomial vs Geometric vs Binomial
The three are one family viewed from different chairs. The binomial fixes trials and counts successes. The negative binomial fixes successes and counts trials. The geometric distribution is the negative binomial with r = 1 — trials until the first success — so every geometric question is a special case of this calculator. The negative binomial also wears a second costume in applied work: with r reinterpreted, it models overdispersed counts (insurance claims, disease cases) where variance exceeds the mean, something the Poisson distribution cannot bend to fit.
Mean, Variance, and What They Tell You
The expected number of trials to collect r successes is r ÷ p — double the target, double the wait; halve the success rate, double it again. The variance, r(1 − p) ÷ p², grows faster than the mean as p shrinks, which matches experience: rare-success hunts are not just long, they are unpredictably long. In the worked example the mean is 6 trials with a standard deviation of about 2.45 — planning around "about 6, give or take 2 to 3" is the honest summary, and exactly the kind of statement this distribution exists to make.
Real Uses
Quality engineers ask how many items they will inspect before the r-th defective appears, and design acceptance sampling around the answer. Sales organizations model calls until the r-th close. Reliability engineers count cycles until the r-th failure when a system is replaced at a set failure count. Ecologists counting surveys until the r-th sighting of a rare species are running a negative binomial whether they name it or not. Anywhere the quota is in successes and the cost is in trials, this is the distribution.
Common Mistakes
Feeding the formula k successes in k trials logic from the binomial — the combination here is C(k − 1, r − 1), built on the first k − 1 trials, not C(k, r). Defining X as failures before the r-th success instead of trials: some textbooks use that version, whose probabilities attach to k − r rather than k; this calculator counts trials, the more common convention, and says so on its labels. Finally, the model demands independent trials at constant p — a shooter who is improving, or a machine that is wearing out, breaks the assumption mid-count.
Related Tools
The rest of the distribution family is in the Statistics Calculators hub, including the Binomial Distribution Calculator and the Central Limit Theorem Calculator.
Frequently Asked Questions
What is the negative binomial distribution?
It gives the probability that the r-th success occurs on exactly trial k, for independent trials with success probability p: P(X = k) = C(k − 1, r − 1) p^r (1 − p)^(k − r). You fix the successes; the trials are what vary.
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 — the same experiments, with the roles of the two numbers swapped.
What is the mean of a negative binomial distribution?
r ÷ p. Needing 3 successes at p = 0.5 takes 6 trials on average. The variance is r(1 − p) ÷ p², here 6, giving a standard deviation of about 2.45 trials.
Is the geometric distribution a negative binomial?
Yes — it is the special case r = 1, trials until the first success. Set r to 1 in this calculator and every result is the geometric distribution's.
What is the probability the third success takes exactly 5 trials at p = 0.5?
C(4, 2) × 0.5³ × 0.5² = 0.1875, or 18.75 percent. The chance it happens by trial 5 is exactly 50 percent — both figures are this page's worked example.
Why do some sources define X as failures instead of trials?
It is an alternate parameterization: failures before the r-th success, Y = X − r. The probabilities are the same events relabeled. This calculator uses the trials convention; check any formula you borrow against its definition of X.
When does the negative binomial model break down?
When trials are not independent or p drifts — learning, fatigue, wear, and changing conditions all violate the constant-p assumption, and the tail probabilities are where the error shows first.