# Probability of Impurity Given 3 out of 5 test detections

A chemist is interested in determining whether a certain trace impurity is present in a product. An experiment has a probability of 0.80 of detecting the impurity if it is present. The probability of not detecting the impurity if it is absent in 0.90. The probabilities of the impurity being present and being absent are 0.40 and 0.60 respectively. Five separate experiments result in only three detections. What is the probability that the impurity is present?

Can someone help me get on the right track?

What I got out of this question is: $$T^+$$ = detection, $$T^-$$= no detection, I = impure, P = pure. $$P(T^+|I)$$ = 0.8 which implies $$P(T^-|I)$$ = 0.2; $$P(T^-|P)$$ = 0.9 which implies $$P(T^+|P)$$ = 0.1; P(I) = 0.4; P(P)=0.6

I assumed I'd need the reversed conditional probability of $$P(I|T^+)$$ and $$P(I|T^-)$$.

$$P(T^+)$$ = (0.8)(.4) + (0.1)(0.6) = 0.38 by law of total probability, and therefore $$P(T^-)$$ = 0.62.

$$P(I|T^+)$$ = $$\frac{P(T^+|I)P(I)}{P(T^+)} = \frac{(0.8)(0.4)}{0.38} = \frac{16}{19}$$

By similar computation, $$P(I|T^-)$$ = $$\frac{3}{19}$$

Final computation would be binomial distribution of $${5}\choose{3}(\frac{16}{19})^3(\frac{3}{19})^2$$

However this ends up not matching with the answer I'm given (studying for a test). Can anyone tell me where I've messed up or if my approach is all wrong?

• You can only use the binomial distribution when there are only two outcomes in an experiment, like rolling a die and using P(lower than three) and P(three or above). P$(I|T^+)\,$ and P$(I|T^-)\,$ don't qualify as such, though for example P$(T^+|I)\,$ and P$(T^-|I)\,$ would.
– A.J.
Nov 7, 2019 at 7:29

The probability of having an impurity present and getting three detections in five experiments is

$$\text{P}(I \,{\small\text{ AND }} \, 3 {\small\text{ out of }}5)=\left(\frac{2}{5}\right) \cdot \binom{5}{3} \left(\frac{4}{5}\right)^3\left(\frac{1}{5}\right)^2 = \frac{256}{3125}$$

The probability of not having an impurity present and getting three detections in five experiments is

$$\text{P}(P \,{\small\text{ AND }} \, 3 {\small\text{ out of }}5)=\left(\frac{3}{5}\right) \cdot \binom{5}{3} \left(\frac{1}{10}\right)^3\left(\frac{9}{10}\right)^2 = \frac{243}{50000}$$

We are looking for $$\,\text{P}(I \, | \, 3 {\small\text{ out of }}5).$$

\begin{align} \text{P}(I \, | \, 3 {\small\text{ out of }}5) &= \frac{\text{P}(I \,{\small\text{ AND }} \, 3 {\small\text{ out of }}5)}{\text{P}(3 {\small\text{ out of }}5)}\\[2ex] &= \frac{\dfrac{256}{3125}}{\dfrac{256}{3125} + \dfrac{243}{50000}}\\[2ex] &= \boxed{\frac{4096}{4339}} \end{align}

• Thanks for the clarification!! Can I ask, how am I from that wording know the difference between conditional and intersection? It seems to me like this is the sensitivity of a test which is conditional? Nov 7, 2019 at 18:22
• This IS a conditional probability but it requires some intersection calculations first. The formula for the probability of $\,A\,$ given $\,B\,$ is $$\text{P}(A \, | \, B) = \frac{\text{P}(A \, \cap \, B)}{\text{P}(B)}$$ However, the denominator often needs to be extended as in the next comment:
– A.J.
Nov 8, 2019 at 5:35
• \begin{align} \text{P}(A_i \, | \, B) &= \frac{\text{P}(A_i \, \cap \, B)}{\text{P}(B \, \cap \, A_1)+\text{P}(B \, \cap \, A_2)+\text{P}(B \, \cap \, A_3)+\dots} \\[1ex] &= \frac{\text{P}(A_i \, \cap \, B)}{\text{P}(A_1)\text{P}(B \, | \, A_1)+\text{P}(A_2)\text{P}(B \, | \, A_2)+\text{P}(A_3)\text{P}(B \, | \, A_3)+\dots} \end{align} Here the $\,A_i$'s are a partition of the event space, i.e. exactly one of them has to be true at any given time.
– A.J.
Nov 8, 2019 at 5:36
• In this particular question, the partition would be $\,P\,$ and $\,I\,$, as exactly one of those must be true. So the extended formula for the conditional probability would be \begin{align} \text{P}(I \, | \, 3 {\small\text{ out of }}5) &= \frac{\text{P}(I \, \cap \, 3 {\small\text{ out of }}5)}{\text{P}(3 {\small\text{ out of }}5)} \\ &= \frac{\text{P}(I \,\cap \, 3 {\small\text{ out of }}5)}{\text{P}(3 {\small\text{ out of }}5 \cap P)+\text{P}(3 {\small\text{ out of }}5 \cap I)} \end{align}
– A.J.
Nov 8, 2019 at 5:47
• This is great! I realized I was looking for the wrong probability and then using that to calculate for the 3 out of 5 instead of focusing on that first. Thanks for the visualization, it feels like maybe setting up a sample space might help me wrap my head around this. I appreciate all your help! Nov 8, 2019 at 6:02

$$P(I|T^-)$$ is wrong.

$$P(I|T^-)=\frac{P(I\cap T^-)}{P(T^-)}=\frac{0.4\cdot 0.2}{0.4\cdot 0.2+0.6\cdot 0.9}=\frac{4}{31}$$

and you can guess from here that the subsequent use of binomial distribution is wrong too - you can't use it this way.

• Thanks for pointing this out! I was thinking $1 = P(A|B) + P(A|B^C)$ instead of $1 = P(A|B) + P(A^c|B)$ Nov 8, 2019 at 6:05