# Why total probability is the sum of conditional probabilities?

Consider the following question taken from this link, question number $25$:

We have four boxes. Box $1$ contains $2000$ components of which $5$ percent are defective. Box $2$ contains $500$ components of which $40$ percent are defective. Boxes $3$ and $4$ contain $1000$ each with $10$ percent defective. We select at random one of the boxes and we remove at random a single component. What is the probability that the selected component is defective?

The solution is given in the form of conditional probabilities as

$$P(B) = P(A1) P(B/A1) + P(A2) P(B/A2) + P(A3) P(B/A3) + P(A4) P(B/A4)$$

$$P(B) = 1/4 (0.05 + .4 + .1 + .1) = 0.1625$$

I wonder, since the probabilities of selecting each of the box is equal, why the probability of a defective part is not: $$\frac{\text{Total defective components}}{\text{Total Number of Components}} = 500/4500 =0.1111$$

An extreme example will I think make things clear. Suppose Boxes 1, 2, and 3 each hold one component, which is defective. Box 4 holds $97$ components, all of them good. It is clear that if we pick a box at random, and then a component, the probability the component chosen is bad is $3/4$. If we used Total Number of Bad divided by Total Number of Components, we would get $3/100$, very far from the truth.
• Box selection probability proportional to its size. So Box 1 with probability $2000/4500$, box 2 with probability $500/4500$, and so on. – André Nicolas Feb 8 '16 at 8:31