# Two objects from the same company. What is the probability that the second object is defective, given that the first is defective.

Two companies, $$A$$ and $$B$$, produce the same objects.
- The objects that come from the company $$A$$ are defective with a probability of $$0.05$$;
- The objects that come from the company $$B$$ are defective with a probability of $$0.01$$;
Assuming that someone bought two objects from the same company, with a probability of $$50 \%$$. If the first object is defective, what is the probability that also the second one is defective?

I have calculated the probability to find the first defective object, that object can come from A or B:
In the formula:

• $$D_1$$ denote the event "the first defective object";
• $$P(A)$$ denote the probability to buy an object from the company $$A$$;
• $$P(B)$$ denote the probability to buy an object from the company $$B$$;
• $$P(D_1|A)$$ denote the probability to buy the first object knowing that come from $$A$$;
• $$P(D_1|B)$$ denote the probability to buy the first object knowing that come from $$A$$;

$$\begin{array}{rcl}P(D_1) & = & P(A) \cdot P(D_1 | A) + P(B) \cdot P(D_1|B) \\ & = & 50 \% \cdot 0.05 + 50 \% \cdot 0.01 \\ & = & \frac{0.05}{2} + \frac{0.01}{2} \\ & = & 0.03\end{array}$$

but, I am unable to find the second part of the problem.

I have tried to do with a diagram, and I don't know if it is right, I think that those $$0.05$$ and $$0.01$$ are means, or approximations, and not exact quantities, i.e. in a bundle of 100 objects I can find 5 but also 0 or 1 etc... defective objects, or better if I consider a numerous bundle of 100 objects I can find a value that reaches 5 defective for each bundle. For this reason the second part of the diagram contains the same quantities, because I think that they are independent.

Considering what I have done, the probability "also the second is defective given the first is defective" should be:

$$\begin{array}{rcl}P(D_2|D_1) & = & 50 \% \cdot 0.05 \cdot 0.05 + 50 \% \cdot 0.01 \cdot 0.01 \\ & = & \frac{0.0025}{2} + \frac{0.0001}{2} \\ & = & 0.0013& \end{array}$$

Please, can you help me? Thanks! :)

• @Peter Yes, but I have some difficulties to apply here. Commented Sep 22, 2017 at 10:50
• @Peter No need for Bayes' here. Just the law of total probability, as he has done on the last line. And to me, that seems entirely correct. Commented Sep 22, 2017 at 10:55
• @Arthur Thanks for the clarification Commented Sep 22, 2017 at 10:56
• @Arthur It is not entirely correct. Commented Sep 22, 2017 at 11:45

Close, you have calculated $\mathsf P(D_1,D_2)= \mathsf P(D_2\mid A)\,\mathsf P(D_1\mid A)\,\mathsf P(A)+\mathsf P(D_2\mid B)\,\mathsf P(D_1\mid B)\,\mathsf P(B)$
$$\mathsf P(D_2\mid D_1)~{=\dfrac{\mathsf P(D_1,D_2)}{\mathsf P(D_1)}\\ = \dfrac{\mathsf P(D_2\mid A)\mathsf P(D_1\mid A)\mathsf P(A)+\mathsf P(D_2\mid B)\mathsf P(D_1\mid B)\mathsf P(B)}{\mathsf P(D_1\mid A)\mathsf P(A)+\mathsf P(D_1\mid B)\mathsf P(B)}\\=\dfrac{(0.05^2+0.01^2)/2}{(0.05+0.01)/2}\\= \dfrac{0.0013}{0.03}\\=0.04\dot3}$$
Reality check.   $\mathsf P(D_2\mid A)=0.05$ and $\mathsf P(D_2\mid B)=0.01$.   We should find that $\mathsf P(D_2\mid \text{some evidence for which source''})$ lies somewhere between these values, and the evidence that the first item was defective is suggestive that the items are more likely to be from source $A$.
• Can you explain better your notation? you have written $P(D_1, D_2)$, but me $P(D_2|D_1)$, is it the same, or am I wrong? Commented Sep 22, 2017 at 18:23
• and also, in $P(D_2|D_1)$, do you apply Bayes' theorem? But, why $P(D_1, D_2)$ isn't contained within $P(D_1)$? Commented Sep 22, 2017 at 18:35
• Use the definition of conditional probability: $\mathsf P(D_2\mid D_1)=\dfrac{\mathsf P(D_1, D_2)}{\mathsf P(D_1)}$, where $\mathsf P(D_1, D_2)$ is the joint probability for the events, $D_1$ and $D_2$ ; that is the event that both objects are defective. Commented Sep 23, 2017 at 4:32