# Hypergeometric Probabilities Distributions Examples



The hypergeometric probability distribution is used in situations where items are selected and NOT replaced.
In what follows, we will use the mathematical formula for combinations given by $\displaystyle {M \choose m} = \dfrac{M!}{m!(M-m)!} \quad , \quad \text{read as } \quad \text{"} m \quad\text{choose} \quad M \text{"}$.
where $M! = 1 \times 2 \times 3 ... \times (M-1) \times M$ , read as "M factorial".
The above formula gives the number of ways $m$ items are selected from $M$ items without repetitions. ( $m \le M$ )

## Hypergeometric Probability Formula

The hypergeometric formula is better explained through a question.

Question
A box contains $N$ balls of which $R$ are red balls and the remaining ones are blue balls.
$n$ balls are selected (without replacement) from the box at random. What is the probability that $x$ balls from the $n$ balls selected are red?

Solution

There are $\displaystyle {N \choose n}$ ways of selecting $n$ balls from a total of $N$ balls

There are $\displaystyle {R \choose x}$ ways of selecting $x$ red balls from a total of $R$ red balls
If $N$ is the total number of balls and $R$ are red, then $N - R$ are blue.
If $x$ balls out of the $n$ are red, then $n - x$ are blue.
Hence there are $\displaystyle {N - R \choose n - x}$ ways of selecting $n - x$ blue balls from a total of $N - R$ blue balls.
The diagram below explain visually the situation described above.

The number of ways of selecting $x$ red balls from a total of $R$ red balls and selecting $n - x$ blue balls from a total of $N - R$ blue balls is given by the counting principle as the product
$\displaystyle {R \choose x} \displaystyle {N - R \choose n - x}$
Hence using the classical probability formula, the probability that $x$ balls from the $n$ balls selected are red is given by
$P(X = x) = \dfrac{ \displaystyle {R \choose x} \displaystyle {N - R \choose n - x} }{ \displaystyle {N \choose n} }$

## Hypergeometric Probabilities Examples with Detailed Solutions

Example 1
Four balls are to be randomly selected from a a box containing 5 red balls and 3 white balls.
a) What is the probability that an equal number of red and white balls are selected?
b) What is the probability that at least 2 red ball are selected?

Solution to Example 1
a)

There is a total of 8 balls; hence $N = 8$.
There are 5 red balls, hence $R = 5$ and $N - R = 3$ white balls.
Equal number of red and white balls when $n = 4$ are randomly selected means $x = 2$ red and $n - x = 2$ white.
The number of ways of selecting 2 red from a total of 5 red is given by ${ R \choose x} = { 5 \choose 2}$
The number of ways of selecting 2 white from a total of 3 white is given by ${N-R \choose x - 2} = {3 \choose 2}$
The number of ways of selecting 4 balls from a total of 8 balls is given by ${N \choose n} = {8 \choose 4}$
Let $X$ be the number of red balls selected.
Hence
$P(X = 2) = \dfrac{{5 \choose 2}{3 \choose 2} }{{8 \choose 4}} = 3/7$

b)
$P (X \ge 2) = P (X = 2 ) + P (X = 3 ) + P (X = 4 )$

$= \dfrac{{5 \choose 2}{3 \choose 2} }{{8 \choose 4}} + \dfrac{{5 \choose 3}{3 \choose 1} }{{8 \choose 4}} + \dfrac{{5 \choose 4}{3 \choose 0} }{{8 \choose 4}}$

$= 3/7 + 3/7 + 1/14 = 13/14$

Example 2
A quality control inspector is to inspect 15 tools 2 of which are defective by selecting 4 at random.
a) What is the probability that there will one defective tool among the 4 randomly selected?
b) What is the probability that there will no defective tools among the 4 randomly selected?
c) How many non defective tools do we need to add, to the tools to inspect, in order that the probability of having non defective tools among the 4 selected is 0.70?

Solution to Example 2
a)
There are 15 tools with 2 defective and 13 non defective.
The probability that there will one defective tool among the 4 randomly means $x = 3$ are non defective. Hence
$P(X = 3) = \dfrac{{13 \choose 3}{2 \choose 1} }{{15 \choose 4}} = 0.41905$

b)
All four tools are non defective. Hence
$P(X = 4) = \dfrac{{13 \choose 4}{2 \choose 0} }{{15 \choose 4}} = 0.52381$

b)
Let y be the number of non defective tools to be added so that $P(X = 4) = 0.70$ . Hence
$P(X = 4) = \dfrac{{13 + y \choose 4}{2 \choose 0} }{{15 + y \choose 4}} = 0.70$

We now need to solve the equation
$\dfrac{{13 + y \choose 4}{2 \choose 0} }{{15 + y \choose 4}} = 0.70$

Use formula for combinations
$\dfrac{\dfrac{(13 + y )!}{4!(13+y-4)!}} {\dfrac{(15 + y )!}{4!(15+y-4)!}} = 0.70$

Simplify
${\dfrac{(13 + y )!}{(9+y)!}} {\dfrac{(11+y)!}{(15 + y )!}} = 0.70$

Note that $(15 + y )! = (13 + y )! (14+y)(15+y )$
and $(11 + y )! = (9 + y )! (10+y)(11+y )$
and simplify
$\dfrac{(10+y)(11+y )}{ (14+y)(15+y )} = 0.70$

Cross multiply
$(10+y)(11+y ) = 0.7 (14+y)(15+y )$

Expand and group like terms and rewrite the equation in standard form
$0.3y^2+0.7y-37 = 0$

Solve for $y$ and select positive solution
$y = 10$
We need to add 10 non defective tools for the probability to reach 0.7.

Example 3
A committee of 6 people is to be selected at random from a a group of 4 men and 8 women.
a) What is the probability that an equal number of men and women will be in the committee?
a) What is the probability that at most 3 men will be in the committee?

Solution to Example 3
a)

There is a total of 12 people (4 men and 8 women); hence $N = 12$.
Equal number of men and women $n = 6$ are randomly selected means $x = 3$ men and $n - x = 3$ women.
Let $X$ be the number of men selected.
Hence
$P(X = 3) = \dfrac{{4 \choose 3}{8 \choose 3} }{{12 \choose 6}} = 8/33$

b)
$P (X \le 3) = P (X = 0 ) + P (X = 1 ) + P (X = 2 ) + P (X = 3 )$

$= \dfrac{{4 \choose 0}{8 \choose 6} }{{12 \choose 6}} + \dfrac{{4 \choose 1}{8 \choose 5} }{{12 \choose 6}} + \dfrac{{4 \choose 2}{8 \choose 4} }{{12 \choose 6}} + \dfrac{{4 \choose 3}{8 \choose 3} }{{12 \choose 6}}$

$= 1/33 + 8/33 + 5/11 + 8/33 = 32/33$

Example 4
Six balls are to be randomly selected from a box containing 6 red balls, 4 blue balls and 5 white balls.
a) What is the probability that 3 red, 2 blue and 1 white balls are selected?

Solution to Example 4
a)
There is a total of 15 balls; hence $N = 15$ and we select $6$; hence
There are ${15 \choose 6}$ ways to select 6 balls out of 15

There are ${6 \choose 3}$ ways to select 3 red out of 6
There are ${4 \choose 2}$ ways to select 2 blue out of 4
There are ${5 \choose 1}$ ways to select 1 white out of 5
Let $X$ be the number of red balls selected.
Hence
$P(X = 3) = \dfrac{{6 \choose 3}{4 \choose 2} {5 \choose 1}}{{15 \choose 6}} = 120/1001$

Example 5
Seven numbers are to be randomly selected from the integers between 1 and 49 inclusive. Let $P(X = x)$ be the probability of having $x$ even numbers among the 7 selected?
For what value of $x$ is $P(X=x)$ the highest?

Solution to Example 5
a)
There are 24 even numbers between 1 and 49 inclusive and they are: 2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48
There are 25 odd numbers between 1 and 49 inclusive and they are: 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49
There are ${49 \choose 7}$ ways to select 7 numbers of 49
If $x$ out of 7 are even, then $7 - x$ are odd.
There are ${24 \choose x}$ ways to select $x$ even numbers from the 24 odd listed above.
There are ${25 \choose 7-x}$ ways to select $7-x$ odd numbers from the 25 odd listed above.
The probability $P(X = x)$ is given by

$P(X = x) = \dfrac{{24 \choose x}{25 \choose 7 - x}}{{49 \choose 7}}$

We now calculate $P(X = x)$ for all possible values of $x$.

$P(X = 0) = \dfrac{{24 \choose 0}{25 \choose 7}}{{49 \choose 7}} = 0.00560$

$P(X = 1) = \dfrac{{24 \choose 3}{25 \choose 4}}{{49 \choose 7}} = 0.04948$

$P(X = 2) = \dfrac{{24 \choose 3}{25 \choose 4}}{{49 \choose 7}} = 0.170708$

$P(X = 3) = \dfrac{{24 \choose 3}{25 \choose 4}}{{49 \choose 7}} = 0.29806$

$P(X = 4) = \dfrac{{24 \choose 3}{25 \choose 4}}{{49 \choose 7}} = 0.284513$

$P(X = 5) = \dfrac{{24 \choose 3}{25 \choose 4}}{{49 \choose 7}} = 0.148441$

$P(X = 6) = \dfrac{{24 \choose 3}{25 \choose 4}}{{49 \choose 7}} = 0.039172$

$P(X = 7) = \dfrac{{24 \choose 3}{25 \choose 4}}{{49 \choose 7}} = 0.004029$

The probability distribution is graphed below and the probability of having $x = 3$ even numbers among the 7 selected is the highest.