SOLVETUTORMATH SOLVER

Instrument MI-07-109 · Statistics

Negative Binomial Distribution Calculator

Not just the first success, but the rth one — the negative binomial distribution counts how many failures pile up before you finally rack up r successes.

Instrument MI-07-109
Sheet 1 OF 1
Rev A
Verified
Type 07 — Probability Distributions SER. 2026-07109

P(X = k) — probability of exactly k failures before the rth success

0.18750000

P(X=k) = C(k+r-1,k) x (1-p)^k x p^r

The working Every figure verified twice
  1. pmf = comb(2 + 3 − 1, 2)·pow(1 − 0.5, 2)·pow(0.5, 3) = 0.18750000
Worksheet log
  1. No entries yet — change an input to log a scenario.

How this instrument works

The negative binomial distribution generalizes the geometric distribution from asking about the first success to asking about the rth success. In a sequence of independent trials, each with the same success probability p, it gives the probability of seeing exactly k failures before the rth success finally lands — for example, the probability of exactly 3 missed sales calls before landing your 5th sale, or exactly 2 defective parts inspected before finding the 3rd good one.

This instrument uses the failures-before-the-rth-success convention: k counts only the failures, starting from 0, not the total number of trials. If r = 3 and k = 2, that describes a sequence of 5 total trials — 2 failures scattered among the first 4, then the 3rd success arriving on trial 5. This is a different counting convention from this site's Geometric Distribution calculator, which counts the trial number of the success itself (starting from 1), so a direct numeric comparison between the two needs the conversion in mind.

The PMF, P(X = k) = C(k+r−1, k) × (1−p)^k × p^r, breaks into three pieces: the binomial coefficient C(k+r−1, k) counts the number of ways to arrange k failures among the first k+r−1 trials (the very last trial, the r-th success, is fixed by definition), (1−p)^k is the probability that those k trials are all failures, and p^r is the probability that all r successes occur. Set r = 1 and the formula collapses exactly to the geometric distribution's PMF, since C(k, k) = 1 for any k.

P(X=k)=(k+r1k)(1p)kprP(X=k) = \binom{k+r-1}{k}(1-p)^{k} p^{r}
r — target number of successes · p — probability of success on a single trial · k — number of failures occurring before the rth success, k ≥ 0 · C(a,b) — the number of ways to choose b items from a, read "a choose b".
  • Enter how many total successes you're waiting for into Target number of successes (r) — for example, 3 to ask about the 3rd success.
  • Enter the per-trial success chance into Probability of success on each trial (p), a value greater than 0, up to and including 1.
  • Enter the number of failures you want the probability for into Number of failures before the rth success (k ≥ 0, not total trials) — this counts failures only, starting from 0.
  • Read P(X = k) — probability of exactly k failures before the rth success — the resulting negative binomial probability.
  • Set r = 1 to reproduce a geometric-distribution-style answer for 'trials until the first success', reinterpreted in this instrument's failures-counted convention.

Worked example — 2 failures before the 3rd success, p = 0.5

Enter r = 3 into Target number of successes, p = 0.5 into Probability of success, and k = 2 into Number of failures before the rth success — a 50% success rate, asking for the probability of exactly 2 failures occurring before the 3rd success arrives. The instrument computes C(2+3−1, 2) = C(4,2) = 6, the number of ways to arrange 2 failures among the first 4 trials, then multiplies by (1−p)^k = 0.5^2 = 0.25 and p^r = 0.5^3 = 0.125.

P(X = k) reads 0.1875, computed as 6 × 0.25 × 0.125. That means there's an 18.75% chance the sequence plays out as exactly 2 failures and 3 successes across 5 total trials, with the 3rd success landing precisely on the final, 5th trial — the requirement that the last trial specifically be the rth success is what the negative binomial formula builds in.

Questions

How is this different from the geometric distribution?

The geometric distribution is the special case of the negative binomial distribution with r = 1 — waiting for just the first success. This calculator's own r = 1, p = 0.5, k = 0 case gives P(X = 0) = 0.5, matching this site's Geometric Distribution calculator's p = 0.5, k = 1 result of 0.5 exactly, since 'zero failures before the 1st success' and 'first trial is already a success' describe the same event, just counted in different conventions (this instrument counts failures from 0; the geometric calculator counts the trial number of the success from 1).

How is this different from the binomial distribution?

The binomial distribution fixes the number of trials n in advance and asks for the probability of a given number of successes within them. The negative binomial distribution instead fixes the number of successes r in advance and asks for the probability of a given number of failures occurring along the way to reaching them — the roles of 'what's fixed' and 'what's random' are swapped between the two.

What does k actually represent here — failures, or total trials?

Failures only, not total trials. With r = 3 successes required and k = 2 failures, the total number of trials in that scenario is k + r = 5. Some textbooks define the negative binomial distribution in terms of total trials instead of failures alone; this instrument's convention (matching its field label) counts k as failures before the rth success, consistent with the k ≥ 0 minimum, since zero failures is a valid outcome (all r successes come consecutively from the start).

What is the mean number of failures before the rth success?

The mean is r × (1−p)/p. For the worked example (r = 3, p = 0.5), the mean number of failures before the 3rd success is 3 × 0.5/0.5 = 3. The distribution's most probable counts are k = 1 and k = 2, tied at P(X = k) = 0.1875 each — both sitting at or below that mean of 3, which reflects the distribution's right-skewed shape at moderate p.

Can r or p take extreme values?

r must be a positive integer of 1 or more — there is no 'zeroth success' to wait for. p must be strictly greater than 0 and no greater than 1; a p of exactly 1 makes every trial succeed, so P(X = 0) = 1 (zero failures, r successes in a row) and every other k gives 0.

What real-world situations follow a negative binomial distribution?

Anywhere you're counting failures on the way to a fixed target number of successes: the number of rejected job applications before landing 3 offers, the number of defective units inspected before finding 5 good ones, or the number of missed free throws before making 10. It also shows up outside this strict Bernoulli-trial setting as a flexible model for overdispersed count data in fields like ecology and insurance claims, though that usage extends beyond this instrument's trials-and-successes framing.

References