# Law of total probability

In mathematics, the law of total probability states that if A and B are events, then

$P(B) = P(B|A)P(A) + P\left(B|A^c\right)P\left(A^c\right)$

(see [1])

In general, if $A_1, \ldots, A_n$ are mutually exclusive events that partition the sample space, and B is any event, then

$P(B) = \sum_{i=1}^n P\left(B|A_i\right) P\left(A_i\right)$

(see [2])

## References

1. Ghahramani, Saeed. Fundamentals of Probability: With Stochastic Processes. 3rd ed. Upper Saddle River (NJ): Pearson Prentice Hall, 2005. p. 88
2. Ghahramani, p. 93