Suppose we have 3 different providers, A, B and C, each of which accounts for 20%, 40% and 40% of light bulbs produced respectively.
Of the bulbs the 3 companies produced, fractions of $k$, $k/2$, $k/4$ of the light bulbs they produced are defective.
- I want to find the probability of a defective bulb produced by A. To this end I used bayes theorem:
$$P(A|D) = \frac{P(D|A)\times P(A)}{P(D)} = \frac{k/5 \ \times 1/5}{k/5\ + (2/5)(k/2) \ + (2/5)(k/4)} = \frac{2}{25}$$
However, the required answer is $2/5$ instead. Where did I go wrong?
- Finally, I want to find the probability of a working light bulb provided by company C. This is quite similar to part 1.
$$P(C|W) = \frac{P(W|C)\times P(C)}{P(W)} = \frac{k/10 \ \times 4/10}{1-k/2} = \frac{8k/100}{2-k}$$
But the answer is $(0.8-0.2k)/(2-k)$ instead. What went wrong?
For the first, substitute more carefully. You had it right in the denominator, you should have used the same in the numerator.
$$\mathsf P(A\mid D) ~{= \dfrac{\mathsf P(A)\mathsf P(D\mid A)}{\mathsf P(A)\mathsf P(D\mid A)+\mathsf P(B)\mathsf P(D\mid B)+\mathsf P(C)\mathsf P(D\mid C)}\\ = \dfrac{(1/5)k}{(1/5)k+(2/5)(k/2)+(2/5)(k/4)}\\= \dfrac{2}{5}}$$
For the second,... From what hat are you pulling those magic numbers? They make no sense.
Just use the same rule as the first.
$$\mathsf P(C\mid W) ~{= \dfrac{\mathsf P(C)\mathsf P(W\mid C)}{\mathsf P(A)\mathsf P(W\mid A)+\mathsf P(B)\mathsf P(W\mid B)+\mathsf P(C)\mathsf P(W\mid C)}\\ ~~\vdots\\ = \dfrac{4-k}{10-5k}}$$
Just recall $\mathsf P(W\mid C)~=~1 -\mathsf P(D\mid C) ~=~ 1-(k/4)$ and so on.