Hypergeometric Distribution Calculator

Hypergeometric Distribution Calculator

Find the chance of drawing a number of successes when sampling without replacement, such as hearts in a poker hand, winning lottery numbers or faulty items in a batch.

P(X = k) = C(K, k) × C(N − K, n − k) ÷ C(N, n)

Everything you could draw from.

How many of those count as a success.

Drawn without putting any back.

The count you’re asking about.

Fill in all four boxes

What is the Hypergeometric Distribution?

The hypergeometric distribution gives the chance of drawing a certain number of successes from a finite group without putting anything back. Each draw changes what's left, so the chance of a success shifts as you go.

Card hands, lottery draws, picking jurors from a pool and inspecting a sample from a small batch all work this way. It's the without-replacement counterpart of the binomial distribution.

When the group is much bigger than the sample (say, 20 times bigger) removing a few items barely changes the odds, and the binomial gives almost the same answers.

Hypergeometric Distribution Formula

As given in OpenStax Introductory Statistics, section 4.5. See Sources.

1. Ways to pick the successes and the rest

C(K, k) × C(N − K, n − k)

2. Divide by every possible draw

P(X = k) = C(K, k) × C(N − K, n − k) ÷ C(N, n)

3. Mean and spread

mean = nK ÷ N
variance = n (K/N)(1 − K/N) × (N − n) ÷ (N − 1)

The last factor, the finite population correction, makes the spread smaller than the binomial's.

Worked Example: Two Hearts in a Five-Card Hand

Given:
Deal 5 cards from a 52-card deck with 13 hearts. What's the chance of exactly 2 hearts?
Step 1:
Ways to choose 2 hearts and 3 others:
C(13, 2) × C(39, 3) = 78 × 9,139 = 712,842
Step 2:
All possible hands:
C(52, 5) = 2,598,960
Step 3:
Divide:
712,842 ÷ 2,598,960 = 0.2743
Result:
P(exactly 2 hearts) = 27.4%

A binomial model with p = 1/4 would give 26.4%: close, but not right, because each heart dealt leaves fewer in the deck.

Matching Numbers in a 6-from-59 Lottery

Pick 6 numbers; 6 are drawn from 59. N = 59, K = 6 (your numbers), n = 6.

Chance of matching each number of balls in a 6-from-59 lottery
MatchesChanceAbout 1 in
050.95%2
138.21%3
29.75%10
31.04%96
40.05%2,180
57.06e-6141,690
62.22e-845,057,474

Common Hypergeometric Mistakes

  • Using the binomial for small populations. Drawing 5 from 52 changes the odds noticeably. Use the binomial only when the sample is a small fraction of the population.
  • Mixing up K and n. K is how many successes exist in the whole population; n is how many items you draw.
  • Forgetting the non-successes. The C(N − K, n − k) term counts ways to fill the rest of the draw. Leaving it out gives impossible answers.
  • Asking for impossible counts. You can't draw more successes than exist, or fewer than n − (N − K). The chart shows the possible range.

Hypergeometric Distribution FAQs

What’s the chance of winning the jackpot in a 6-from-59 lottery?

One in C(59, 6) = 45,057,474.

When can I use the binomial instead?

When the population is at least about 20 times the sample, the two give nearly the same answers. Use p = K/N.

How is this used in quality control?

Acceptance sampling: inspect n items from a lot of N and accept the lot if at most c are defective. The hypergeometric gives the chance of accepting a lot with K defects.

What is Fisher’s exact test?

A test for 2 × 2 tables built on the hypergeometric distribution. It asks how surprising a table is if the row and column totals are fixed.

How do I calculate it in Excel?

=HYPGEOM.DIST(k, n, K, N, FALSE) for exactly k, TRUE for at most k.

Why is the variance smaller than the binomial’s?

Without replacement, early draws tell you about later ones, which reduces the variation. The factor (N − n) ÷ (N − 1) captures this.

How do card players use it?

To find the chance of drawing the cards they need, such as at least one ace in an opening hand of seven from a 60-card deck with four aces.

How large can the population be?

Up to 100,000 here. The calculator works in logarithms, so large populations don’t overflow.

Sources

Related Tools