# Law of total probability and total expectation

## In words...

Given an exhaustive set of events (a set of disjoint events whose union coincides with the sample space), the law of total probability allows the probability of any event to be expressed as a sum running over the exhaustive set of simpler probabilities involving the events of the exhaustive set.

## In maths...

### Law of total probability

Given a probability space $(\Omega,\Sigma,P)$ and an exhaustive set of events $\{B_i\}_{i=1}^n$ such that $$\bigcup_{i=1}^n B_i = \Omega,\qquad \mbox{and } \quad\forall (i,j), \ B_i\cap B_j = \emptyset,$$ the law of total probability states that $$\forall A\in\Sigma,\qquad P(A) = \sum_{i=1}^n P(A\ |\ B_i) P(B_i).$$

### Law of total expectation

Given a random pair $(X,Y)\in\X\times\Y$, the law of total expectation states that $$\E_{X,Y} [f(X,Y)] = \E_Y \ \E_{X|Y} \left[ f(X,Y)\ |\ Y=y\right] = \E_X \ \E_{Y|X} \left[ f(X,Y)\ |\ X=x\right] .$$