Hypergeometric distribution calculator

Example: the chance of exactly one ace in 5 cards from 52. Enter the population, the wanted items in it and the number drawn.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter population size n, wanted items in population k, number drawn n and wanted items drawn k.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

P(X = k) = C(K, k) × C(N - K, n - k) ÷ C(N, n), with population N, K wanted items in it and n draws. Mean = n × K ÷ N.

Example

Inputs: Population size N = 52, Wanted items in population K = 4, Number drawn n = 5, Wanted items drawn k = 1. Result: P(X = k): 0.2994736356; P(X < k): 0.6588419983; P(X ≤ k): 0.9583156339.

Limits and caveats

  • For draws without replacement from a population with two kinds: wanted and not wanted.
  • Population up to 100000.

Questions about this tool

When should I use it instead of the binomial?

When items are not put back, so the chance changes with each draw, as with cards or sampling a small batch.

What is the chance of at least one ace in 5 cards?

P(X ≥ 1) ≈ 34.12%, shown for N = 52, K = 4, n = 5 and k = 1.

Can it be used for batch quality checks?

Yes, put the batch size in N, the defective count in K and the sample size in n.