Course contentsShow
← Data Science
Lesson 135 of 2,1454. Discrete Probability DistributionsFree lesson

The Negative Binomial Distribution: Waiting for r Successes

Extend geometric logic to count trials needed for r successes, defining the negative binomial distribution and its PMF.

The Negative Binomial Distribution: Waiting for r Successes

What you'll learn: How to model the number of trials needed to achieve a specific number of successes, generalizing the geometric distribution beyond just the first success.

Extending the Geometric Logic

You already know the geometric distribution counts trials until the first success. But what if you're waiting for the second success? Or the tenth? The negative binomial distribution answers this question: "How many trials will I need to get exactly r successes?"

Think of it like this: You're playing basketball and want to make 5 free throws (your r successes). Each shot is independent with probability p. The negative binomial tells you the probability it takes exactly n trials to sink those 5 shots.

The Setup

You need:

  • Independent Bernoulli trials
  • Constant success probability p
  • A target of r successes
  • The random variable X = number of trials to achieve r successes

The PMF (Probability Mass Function)

The probability it takes exactly n trials to get r successes is:

PMF: P(X = n) = C(n-1, r-1) × p^r × (1-p)^(n-r)

where n ≥ r (you can't get 5 successes in fewer than 5 trials).

Why This Formula?

  • The nth trial must be a success (that's your rth success)
  • The first n-1 trials contain exactly r-1 successes
  • C(n-1, r-1) counts arrangements of those r-1 successes
  • p^r gives probability of r successes
  • (1-p)^(n-r) gives probability of n-r failures

Key Takeaway: The negative binomial distribution models waiting for multiple successes, generalizing the geometric distribution from "first success" to "rth success" by counting all possible arrangements of earlier successes before the final, required success on trial n.