# Defective items probability question.

Hi I'm working with probability as part of an engineering course, and I'm struggling with the following tutorial question: Components of a certain type are shipped to a supplier in batches of ten. Suppose that 50% of all such batches contain no defective components, 35% contain one defective component while 15% contain two defective components. If two components are randomly selected from the batch. What are the probabilities associated with 0, 1 and 2 defective components being in the batch under each of the following conditions? a) Neither selected component is defective. b) One of the two components is defective. c) Both components are defective.

I've considered using hypergeometric probability distribution for events P(35%) and P(15%) while comparing to P(50%) but this yields no result.

-
Have you learned about the law of total probability? I would suggest that you try and solve the simpler problem of one item being selected at random from a randomly selected batch and finding the probability that it is defective, and then tackle the problem of two items. – Dilip Sarwate Aug 31 '12 at 11:48

Let $B_0$ be the event that the batch has $0$ defectives, $B_1$ be the event the batch has $1$ defective, and $B_2$ be the event the batch has $2$ defectives.

Let $D_0$ be the event that neither selected component is defective. Problem (a) asks us to find the conditional probabilities $\Pr(B_0|D_0)$, $\Pr(B_1|D_0)$, and $\Pr(B_2|D_0)$. Now the hardest part, identifying precisely what we are after, has been done!

For the calculation, we use the general conditional probability formula $$\Pr(X|Y)\Pr(Y)=\Pr(X\cap Y).$$ Put $X=B_0$ and $Y=D_0$. We need $\Pr(D_0)$ and $\Pr(B_0\cap D_0)$.

The event $D_0$ can happen in three different ways: (i) Our batch of $10$ is perfect, and we get no defectives in our sample of two; (ii) Our batch of $10$ has $1$ defective, but our sample of two misses them; (iii) Our batch has $2$ defective, but our sample misses them. If it helps, draw a tree that shows the three different paths through which we can end up with no defectives.

For (i), the probability is $(0.5)(1)$. For (ii), the probability that our batch has $1$ defective is $0.35$. Given that it has $1$ defective, the probability that our sample misses it is $\binom{9}{2}/\binom{10}{2}$, which is $8/10$. So the probability of (ii) is $(0.35)(8/10)$. For (iii), the probability our batch has $2$ defective is $0.15$. Given that it has $2$ defective, the probability that our sample misses both is $\binom{8}{2}/\binom{10}{2}$, which is $56/90$. So the probability of (iii) is $(0.15)(56/90)$. We have therefore found that $$\Pr(D_0)=(0.5)(1)+(0.35)(8/10)+(0.15)(56/90).$$ The probability $\Pr(B_0\cap D_0)$ has been calculated during our calculation of $\Pr(D_0)$. It is $(0.5)(1)$. We conclude that $$\Pr(B_0|D_0)=\frac{(0.5)(1)}{(0.5)(1)+(0.35)(8/10)+(0.15)(56/90)}.$$ The rest of the calculations for $D_0$ are easy, we have all the information needed. We get $$\Pr(B_1|D_0)=\frac{(0.35)(8/10)}{(0.5)(1)+(0.35)(8/10)+(0.15)(56/90)}$$ and $$\Pr(B_2|D_0)=\frac{(0.15)(56/90)}{(0.5)(1)+(0.35)(8/10)+(0.15)(56/90)}.$$

Alternately, we could have used Bayes' Formula directly . I wanted to do it in the above more basic way so that the logic would be clear.

Now unfortunately we have to deal with (b) and (c). But (c) is trivial! For (b), the calculation is as above, a little simpler, because if our sample of two has a defective, it cannot come from a perfect batch.

-
André, how is your calculation not a use of Bayes' formula, since you are simply replacing $P(D_i)$ in the expression $$P(B_j \mid D_i) = \frac{P(B_j \cap D_i)}{P(D_i)}$$ by its value as obtained via the law of total probability? In over 35 years experience teaching probability to recalcitrant engineering undergraduate students, I have always tried to emphasize the formulation that you have used, pointing out that the numerator term is one that is computed as part of the denominator and thus need not be calculated again: cf. your "The probability $P(B_0\cap D_0)$ has been calculated during " – Dilip Sarwate Aug 31 '12 at 13:25
It is certainly absolutely the use of the Bayes' Formula idea. just going back one little step. (Before the divorce of Math and Stat, I used to teach the standard probability and statistics for engineers pretty often. One has to do a delicate balance between ideas and cookbook.) – André Nicolas Aug 31 '12 at 13:37
Thanks a lot, this answer is making sense too now, this stuff isn't so bad if you really start understanding it. Thank you – Tertius Aug 31 '12 at 14:01

Try using Bayes' theorem: $$P(A|X) = P(X|A) \dfrac{P(A)}{P(X)}$$

For instance, let event $A_m$ be "there are $m$ defective components in the batch" and let event $X_n$ be "$n$ of the selected components are defective". Then we have the given marginal probabilities for $A_m$:

\begin{aligned} P(A_0) &= 0.5 & P(A_1) &= 0.35 & P(A_2) &= 0.15 \end{aligned}

and the conditional probabilities for $X_n$ given $A_m$:

\begin{aligned} P(X_0|A_0) &= 1 & P(X_0|A_1) &= \frac45 & P(X_0|A_2) &= \frac{28}{45} \\ P(X_1|A_0) &= 0 & P(X_1|A_1) &= \frac15 & P(X_1|A_2) &= \frac{16}{45} \\ P(X_2|A_0) &= 0 & P(X_2|A_1) &= 0 & P(X_2|A_2) &= \frac1{45} \end{aligned}

(Exercise: Why those probabilities? It's just a simple case of sampling without replacement.)

From the conditional probabilities, we can also calculate the marginal probabilities for $X_n$ using the law of total probability:

$$\begin{eqnarray} P(X_0) &= 1\cdot0.5 &+& \frac45\cdot0.35 &+& \frac{28}{45}\cdot0.15 =& \frac{131}{150} =& 0.87333\dots \\ P(X_1) &= 0\cdot0.5 &+& \frac15\cdot0.35 &+& \frac{16}{45}\cdot0.15 =& \frac{37}{300} =& 0.12333\dots \\ P(X_2) &= 0\cdot0.5 &+& 0\cdot0.35 &+& \frac{1}{45}\cdot0.15 =& \frac{1}{300} =& 0.00333\dots \\ \end{eqnarray}$$

Now apply Bayes' theorem to get the conditional probabilities $P(A_m|X_n)$.

-
Thanks man, just went to see my lecturer about this problem. He confirmed everything you've said. Nice answer. – Tertius Aug 31 '12 at 13:47