## Definition
==The Law of Total Probability== expresses the total probability of an event by partitioning the sample space into mutually exclusive, exhaustive events $B_1, B_2, \ldots, B_n$ and summing the conditional contributions:
$ P(A) = \sum_{i=1}^{n} P(A \mid B_i) \cdot P(B_i) $
> [!example]- A factory has three machines producing 50%, 30%, and 20% of output with defect rates of 2%, 3%, and 5% respectively. What is the overall defect rate?
> Let $M_1, M_2, M_3$ denote the machines and $D$ the event of a defect.
> $ P(D) = P(D \mid M_1)P(M_1) + P(D \mid M_2)P(M_2) + P(D \mid M_3)P(M_3) $
> $ = (0.02)(0.50) + (0.03)(0.30) + (0.05)(0.20) = 0.01 + 0.009 + 0.01 = 0.029 $
> The overall defect rate is 2.9%.