Skip to content

Hypergeometric Distribution Calculator

Find the probability of drawing k successes in a sample of n taken without replacement from a population of N that contains K successes — exactly k, at most, at least, or a range — with the mean, variance, a full table, a bar chart and a comparison with sampling with replacement. Free, no sign-up.

Adds P(k ≤ X ≤ this value) to the results.

Results

ProbabilityMeaningValue
P(X = 2)exactly 20.0399
P(X ≤ 2)at most 20.9982
P(X < 2)fewer than 20.9583
P(X ≥ 2)at least 20.0417
P(X > 2)more than 20.0018

k can only take values from 0 to 4 with these inputs.

0.3846

Mean (nK/N)

0.3272

Variance

0.572

Standard deviation

Drawn with replacement instead, the count would be binomial with n = 5 and p = K/N = 0.0769, giving P(X = 2) = 0.0465 against 0.0399 here. The finite population correction (N − n)/(N − 1) = 0.9216 is why the variance here is smaller.

Probability distribution

Hypergeometric probabilities for N = 52, K = 4, n = 5
kP(X = k)P(X ≤ k)P(X ≥ k)
00.65880.65881.0000
10.29950.95830.3412
20.03990.99820.0417
30.00171.00000.0018
41.85 × 10−51.00001.85 × 10−5

How to Use the Hypergeometric Distribution Calculator

  1. 1. Describe the population. N is the number of items in total and K the number of them that count as successes — 52 cards with 4 aces, a lot of 50 parts with 5 defectives.
  2. 2. Enter the sample size. n is how many items are drawn, without putting any back.
  3. 3. Enter k, and optionally a second value. k is the number of successes in the sample you are asking about; a second value adds the probability of a whole range.
  4. 4. Read the results. Every probability for k, the possible range of k, the mean, variance and standard deviation, the binomial answer for comparison, and a full table and bar chart.

What the Hypergeometric Distribution Models

The hypergeometric distribution counts successes in a sample drawn without replacement from a finite population: aces in a poker hand, defective parts in an inspection sample, winning numbers on a lottery ticket. Because nothing is put back, every draw changes the odds for the next one — exactly what the binomial distribution, with its constant p, cannot handle.

The probability of exactly k successes is P(X = k) = C(K, k) × C(N − K, n − k) / C(N, n): the ways to choose k of the K successes and n − k of the N − K failures, divided by the ways to choose any n items. The mean is nK/N, as for a binomial with p = K/N, but the variance is multiplied by the finite population correction: nK/N × (1 − K/N) × (N − n)/(N − 1).

Hypergeometric or binomial?
FeatureHypergeometricBinomial
SamplingWithout replacementWith replacement, or from an unlimited population
Chance of successChanges after every drawConstant p
ParametersN, K, nn, p
Variancenp(1 − p) × (N − n)/(N − 1), with p = K/Nnp(1 − p)
Use it whenThe sample is a sizeable share of the populationThe sample is under about 5% of the population

When the sample is only a small fraction of the population — under 5% is the usual rule — the correction is close to 1, the two distributions agree closely, and the binomial is a convenient approximation.

Worked Examples: Cards, Inspections and Lotteries

Cards. A 5-card hand from a 52-card deck holding 4 aces has N = 52, K = 4, n = 5. The chance of exactly 2 aces is C(4, 2) × C(48, 3) / C(52, 5) = 6 × 17,296 / 2,598,960 = 0.0399, and of at least one ace 0.3412. If each card were replaced and the deck reshuffled, the binomial would give 0.0465 for exactly two: drawing without replacement makes a second ace less likely, because the first one is no longer in the deck.

Quality control. A lot of 50 parts contains 5 defectives, and an inspector tests 10 at random. The chance of finding at least one defective is 0.6894 — so a lot this bad still passes an inspection that demands zero defectives about 31% of the time.

Lottery. In a 6/49 lottery, 6 of the 49 numbers win and you pick 6. Matching exactly 3 has probability 0.0177, about 1 in 57; matching all six has probability 7.15 × 10−8, or 1 in 13,983,816.

Frequently Asked Questions

When should I use the hypergeometric distribution instead of the binomial?
Whenever you sample without replacement from a finite population and the sample is more than a small fraction of it — roughly 5% or more. Each draw then changes the chance of success on the next, and only the hypergeometric accounts for that. For a small sample from a huge population the two give nearly the same answer.
What is the formula for the hypergeometric distribution?
P(X = k) = C(K, k) × C(N − K, n − k) / C(N, n), where N is the population size, K the number of successes in it, n the sample size and k the number of successes in the sample. C(a, b) is the number of ways to choose b items from a.
What is the probability of getting 2 aces in a 5-card hand?
Exactly 2 aces: 0.0399, about 1 in 25. At least one ace: 0.3412. Both come from N = 52 cards, K = 4 aces and n = 5 cards drawn without replacement.
What are the mean and variance of a hypergeometric distribution?
The mean is nK/N and the variance nK/N × (1 − K/N) × (N − n)/(N − 1). For a 5-card hand the expected number of aces is 5 × 4/52 = 0.3846, with a variance of 0.3272.
Why can k only take some values?
A sample cannot contain more successes than the population holds, or more failures. So k runs from max(0, n − (N − K)) to min(n, K): in a 5-card hand you can hold at most 4 aces, and if you drew 50 cards you would hold at least 2.
How large can the population be?
Up to 100,000. The cumulative probabilities are exact sums over every possible value of k, which stay instant at that size. For a larger population and a small sample, the binomial with p = K/N is an excellent approximation.

Related Tools

More in Statistics Calculators

See all Statistics Calculators