Hypergeometric Distribution Calculator

Calculate probabilities for drawing successes from a finite population without replacement.

About the Author: Created by Fotios Angelakis, MSc in Mechanical Engineering, with experience in probability calculations, statistical modeling, and applied calculator development. Learn more about the author's qualifications and experience.

Enter N, K, n, k, and choose a probability type.

What the Hypergeometric Distribution Models

The hypergeometric distribution models the number of successes in a sample drawn from a finite population without replacement.

P(X = k) = [C(K,k) × C(N − K, n − k)] / C(N,n)

This is different from the binomial distribution because the probability changes after each draw. Once an item is selected, it is not returned to the population.

Input Definitions

Symbol Meaning Example
N Total population size. 100 items in a batch.
K Number of successes in the population. 10 defective items.
n Sample size drawn without replacement. 5 inspected items.
k Number of successes in the sample. 2 defective items found.

Possible Values of k

Not every k value is possible. The valid support is:

max(0, n − (N − K)) ≤ k ≤ min(n, K)

For example, if the population has only 3 success items, then drawing 4 successes is impossible. The calculator checks this automatically and returns probability 0 when the event is outside the possible support.

Probability Types

Mode Meaning Range summed
Exact Exactly k successes. P(X = k)
Less than Fewer than k successes. P(X < k)
At most k or fewer successes. P(X ≤ k)
At least k or more successes. P(X ≥ k)
More than More than k successes. P(X > k)
Between From k to b successes, inclusive. P(k ≤ X ≤ b)

Why This Calculator Uses Log-Combinations

Combination values such as C(1000,50) can be extremely large. If the calculator multiplies combinations directly with normal JavaScript numbers, the result may overflow or lose precision.

log P(X = k) = log C(K,k) + log C(N−K,n−k) − log C(N,n)

This calculator works in logarithms and uses log-sum-exp when summing several probabilities. That makes the CDF and range probabilities more stable.

Example: Quality Control

A batch contains 100 items. Ten are defective. An inspector selects 5 items without replacement. The probability of finding exactly 2 defective items is:

N = 100
K = 10
n = 5
k = 2

P(X = 2) = [C(10,2) × C(90,3)] / C(100,5)
P(X = 2) ≈ 0.0702

Mean, Variance, and Standard Deviation

The hypergeometric distribution has these summary values:

Mean = n × K / N
Variance = n × (K/N) × (1 − K/N) × (N − n) / (N − 1)
Standard Deviation = √Variance

Hypergeometric vs Binomial

Distribution Sampling type Success probability
Hypergeometric Without replacement Changes after each draw.
Binomial With replacement or independent trials Constant for every trial.

Common Mistakes

  • Using the binomial distribution when sampling is actually without replacement.
  • Entering sample size n larger than population size N.
  • Entering successes in population K larger than N.
  • Trying to draw more sample successes than the number of successes available in the population.
  • Forgetting that the valid k range depends on N, K, and n together.

Frequently Asked Questions

What is the hypergeometric distribution?

It is a discrete probability distribution for the number of successes in a sample drawn without replacement from a finite population.

When should I use it?

Use it when the population is finite, the sample is drawn without replacement, and each item can be classified as success or failure.

How is it different from binomial?

In a binomial model, trials are independent and the success probability stays constant. In a hypergeometric model, sampling without replacement changes the probability after each draw.

Can the probability be zero?

Yes. If the requested k value is outside the possible support, the probability is zero.

What is the finite population correction?

The variance includes the factor (N − n)/(N − 1), which reduces variance when the sample is large relative to the population.