## Thursday, January 17, 2013

### Answer to the previous blog

If you are in Hong Kong and you need help for university mathematics courses, please visit www.all-r-math.com.

Suppose there are n lightbulbs, k of them have defects. A technician is allowed to check m lightbulbs and it turns out that exactly l defected ones among those checked.
1. Given n,k,m,l, what is the probability mass function (PMF) for l? What is the expected value?
2. Given n,m,l, what is the probability mass function (PMF) for k? What is the expected value?
(Sorry that I have to change the notations, so the presentation is clearer.)
• k≥n: In this case 0≤l≤m. The total number of ways for choosing m bulbs from the n bulbs is $C_m^n$. Number of ways that there are l defected bulbs among m chosen bulbs equals $C_l^kC_{m-l}^{n-K}$. Therefore the conditional probability for $L=l$ given $K=k$ is $$P(L=l|K=k)=\frac{C_l^kC_{m-l}^{n-k}}{C_m^n}.$$ Interestingly, rearranging the terms, we have (what does it mean?) $$P(L=l|K=k)=\frac{C_l^mC_{k-l}^{n-m}}{C_k^n}$$ The expected value equals the sum of (outcome × probability). Therefore $$E[L|K=k]=\sum_{k=0}^m\frac{lC_l^kC_{m-l}^{n-k}}{C_m^n}.$$
• k≤n: In this case 0≤l≤k. Again $$P(L=l|K=k)=\frac{C_l^kC_{m-l}^{n-k}}{C_m^n}.$$ The expected value is $$E[L|K=k]=\sum_{k=0}^k\frac{lC_l^kC_{m-l}^{n-k}}{C_m^n}.$$
2. Indeed there is something missing in the question: How is k distributed? Lets assume that it is K~Bin(N,p), that is, each bulb has a probability p to be defected and that $P(K=k)=C_k^np^k(1-p)^{n-k}$. Therefore $$P(K=k|L=l)=\frac{P(Y=K, L=l)}{P(L=l)} =\frac{P(K=k)P(L=l|K=l)}{\sum_{k=l}^nP(K=k)P(L=l|K=k)}$$ and $$E[K|L=1]=\frac{kP(K=k)P(L=l|K=l)}{\sum_{k=l}^nP(K=k)P(L=l|K=k)}.$$
Answer: The technician can find all the defected bulbs if either all the defected bulbs or all the normal bulbs are among those checked. Therefore the answer is $$P(\mbox{he finds all})=\begin{cases} \frac{C_{m-k}^{n-k}}{C_m^n} & n-k>m>k \\ \frac{C_{m-k}^{n-k}+C_{m-(n-k)}^k}{C_m^n}& m\ge n-k,k \\ \frac{C_{m-(n-k)}^k}{C_m^n} & k>m>n-k \end{cases}$$