  ## Exercises - Hypergeometric Distribution

1. In a small pond there are 50 fish, 10 of which have been tagged. A fisherman's catch consists of 7 fish (assume his catch is a random selection done without replacement). What is the probability that exactly 2 tagged fish are caught?

$$P(X=2) = \frac{({}_{10} C_2)({}_{40} C_5)}{({}_{50} C_7)} = 0.296$$
R:
dhyper(2,10,40,7)

Excel:
=HYPGEOM.DIST(2,7,10,50,FALSE)


2. A lot of 100 fuses is inspected by choosing 5 at random and testing them individually. If all 5 "blow" at the correct amperage, the lot is accepted. Suppose the lot contains 20 defective fuses. Find the probability of accepting the lot.

$\displaystyle{\frac{({}_{80}C_5)}{({}_{100}C_5)} \doteq 0.32}$
R:
dhyper(5,80,20,5)

Excel:
=HYPGEOM.DIST(5,5,80,100,FALSE)


3. The following problems involve being dealt, at random and without replacement, a bridge hand (i.e., 13 cards) from a standard deck of 52 cards. Find the probability of being dealt a bridge hand that:

1. does not contain a spade?
2. contains exactly 5 hearts?
3. contains at most one ace?

1. $\displaystyle{\frac{({}_{39}C_{13})}{({}_{52}C_{13})} \doteq 0.0128}$

2. $\displaystyle{\frac{({}_{13}C_5)({}_{39}C_8)}{({}_{52}C_{13})} \doteq 0.1247}$

3. $\displaystyle{P(\textrm{no aces}) + P(\textrm{one ace}) = \frac{({}_{48}C_{13})}{({}_{52}C_{13})} + \frac{({}_{48}C_{12})({}_4C_1)}{({}_{52}C_{13})} \doteq 0.7427}$
R:
a. dhyper(13,39,13,13)
b. dhyper(5,13,39,13)
c. phyper(1,4,48,13)

Excel:
a. =HYPGEOM.DIST(13,13,39,52,FALSE)
b. =HYPGEOM.DIST(5,13,13,52,FALSE)
c. =HYPGEOM.DIST(1,13,4,52,TRUE)


4. A bag contains 24 pieces of candy, of which 12 are peppermints and 12 are butterscotch. Let $X$ be the number of peppermints in a sample of 5 pieces of candy selected at random and without replacement from the bag. Find

1. $P(2)$
2. $P(X \le 2)$
3. $\mu = E(X)$
4. $\sigma^2 = Var(X)$

Note $\displaystyle{P(x) = \frac{({}_{12}C_x)({}_{12}C_{5-x})}{({}_{24}C_5)}}$, and then

1. $P(2) \doteq 0.3416$

R:
dhyper(2,12,12,5)

Excel:
=HYPGEOM.DIST(2,5,12,24,FALSE)

2. $P(X \le 2) = P(0) + P(1) + P(2) \doteq 0.5$

R:
phyper(2,12,12,5)

Excel:
=HYPGEOM.DIST(2,5,12,24,TRUE)

3. $\mu = E(X) = \Sigma \; XP(X) = 1 \cdot P(1) + 2 \cdot P(2) + \cdots 5 \cdot P(5) = 2.5$

4. $\sigma^2 = Var(X) = [\Sigma \; X^2 P(X)] - \mu^2 \doteq 1.0326$

Note, (c) and (d) can be solved simultaneously with the following:

R:
X.outcomes = 0:5
X.probabilities = dhyper(X.outcomes,12,12,5)
X.exp = sum(X.outcomes * X.probabilities)
X.var = sum(X.outcomes^2 * X.probabilities) - X.exp^2
X.exp
X.var