Skip to content

Hypergeometric Distribution Calculator

Exact probabilities for draws without replacement: P(X = k), P(X ≤ k), P(X ≥ k), mean, variance and full table.

Your details

Items with the feature you count, e.g. 13 spades in a deck.

Results update as you type

P(X = k) — exactly k

0.27427971

P(X < k) — fewer than k
0.63295318
P(X ≤ k) — at most k
0.90723289
P(X > k) — more than k
0.09276711
P(X ≥ k) — at least k
0.36704682
Mean nK/N
1.25
Variance
0.863971
Standard deviation
0.9295
Mode (most likely k)
1

Possible values of k: 0 to 5.

Step-by-step solution
  1. P(X = 2) = C(13, 2) × C(39, 3) / C(52, 5) = 0.27427971
  2. P(X ≤ 2) = Σ P(X = i), i = 0…2 = 0.90723289
  3. P(X ≥ 2) = Σ P(X = i), i = 2…5 = 0.36704682
  4. μ = 5 × 13 / 52 = 1.25 ; σ² = 5 × (13/52) × (1 − 13/52) × (52 − 5)/(52 − 1) = 0.863971

Probability of each number of successes in the sample

The hypergeometric distribution gives the probability of drawing exactly kk items of a certain kind when you take nn items without replacement from a population of NN items, KK of which have that feature. It answers questions such as: how likely is a five-card hand to hold two spades, how many winning numbers will a lottery ticket match, or what is the chance that a sample of 10 parts from a lot of 100 contains no defective part.

The difference from the binomial distribution is that each draw changes what is left. After a spade is dealt, there are fewer spades in the deck, so the draws are not independent. When the sample is small compared with the population, the two models give almost the same answer; when the sample is a large share of the population, only the hypergeometric model is correct.

Enter NN, KK, nn and kk to get P(X=k)P(X = k), the cumulative probabilities P(X≤k)P(X \le k), P(X<k)P(X < k), P(X≥k)P(X \ge k) and P(X>k)P(X > k), the mean, variance, standard deviation and the most likely value, plus a chart and a table of every possible outcome. The calculator works with exact ratios between neighbouring terms instead of huge factorials, so populations of millions are handled without overflow.

How to use this calculator

  1. Population size N: the total number of items (52 cards, 49 lottery balls, 100 parts in a lot).
  2. Successes in the population K: how many of them have the feature you count (13 spades, 6 winning numbers, 5 defective parts).
  3. Number of draws n: the sample size, drawn without putting items back.
  4. Successes in the sample k: the count you are asking about.

Read P(X=k)P(X = k) at the top. "At least" questions, like "at least one defective", use P(X≥k)P(X \ge k). The table lists every possible kk with its exact and cumulative probabilities; values outside the support (for example more spades than cards drawn) have probability 0.

The formula

P(X=k)=(Kk)(N−Kn−k)(Nn)max⁡(0, n−N+K)≤k≤min⁡(n, K)P(X = k) = \frac{\dbinom{K}{k}\dbinom{N-K}{n-k}}{\dbinom{N}{n}} \qquad \max(0,\ n-N+K) \le k \le \min(n,\ K)
E(X)=nKNVar⁡(X)=nKN(1−KN)N−nN−1E(X) = n\frac{K}{N} \qquad \operatorname{Var}(X) = n\frac{K}{N}\left(1-\frac{K}{N}\right)\frac{N-n}{N-1}

The numerator counts the ways to choose kk successes among KK and n−kn-k failures among N−KN-K; the denominator counts all possible samples of size nn. The factor N−nN−1\frac{N-n}{N-1} is the finite population correction: the variance is smaller than the binomial variance np(1−p)np(1-p) because sampling without replacement removes uncertainty. The mode is ⌊(n+1)(K+1)N+2⌋\left\lfloor \frac{(n+1)(K+1)}{N+2} \right\rfloor.

Worked example

Cards. Deal 5 cards from a standard 52-card deck that contains 13 spades (N=52N = 52, K=13K = 13, n=5n = 5).

  • Exactly 2 spades: (132)(393)/(525)=78×9139/2598960=\binom{13}{2}\binom{39}{3} / \binom{52}{5} = 78 \times 9139 / 2598960 = 0.2743 (27.4%).
  • At least one spade: 1−(395)/(525)=1 - \binom{39}{5}/\binom{52}{5} = 0.7785.
  • Expected number of spades: 5×13/52=5 \times 13/52 = 1.25.

Quality control. A lot of 100 parts contains 5 defective ones. An inspector takes 10 parts without replacement (N=100N = 100, K=5K = 5, n=10n = 10).

  • No defective part in the sample: (9510)/(10010)=\binom{95}{10}/\binom{100}{10} = 0.5838 (58.4%).
  • Two or more defective parts: 0.0769.

With replacement, the binomial model would give 0.9510=0.95^{10} = 0.5987 for the first question: close, but not identical, because 10 % of the lot is sampled.

Hypergeometric or binomial?

Use the hypergeometric model whenever the population is finite and items are not put back: card games, lotteries, audits, acceptance sampling, capture–recapture estimates of animal populations, and gene-set enrichment tests (Fisher's exact test is built on this distribution). The binomial distribution with p=K/Np = K/N is a convenient approximation when the sample is less than about 5 % of the population. In the example above, sampling 10 out of 100 is 10 %, and the gap between the two answers is visible in the third decimal.

Frequently asked questions

What does "without replacement" mean?

Each item drawn is kept out, so it cannot be drawn again and the composition of what remains changes after every draw. Dealing cards and drawing lottery balls work this way.

How do I calculate the probability of at least one success?

Use the complement: P(X ≥ 1) = 1 − P(X = 0). For one spade or more in a five-card hand, that is 1 − C(39, 5)/C(52, 5). The calculator shows it directly as P(X ≥ k) with k = 1.

When can I use the binomial distribution instead?

When the sample is small compared with the population, roughly n ≤ 5 % of N. Draws then barely change the proportion of successes, and the binomial with p = K/N gives nearly the same result.

Why do some values of k have probability 0?

k cannot exceed the number of draws or the number of successes available, and it cannot be smaller than n − (N − K), the minimum forced when there are not enough failures to fill the sample.

How are the lottery odds computed with this distribution?

In a 6-out-of-49 lottery, N = 49, K = 6 winning numbers and n = 6 numbers on your ticket. Matching all six has probability 1/C(49, 6) = 1 in 13,983,816; matching exactly three is C(6, 3) × C(43, 3)/C(49, 6) ≈ 0.0177.

Sources

Last updated:

More Statistics calculators

People also use