28 Conditional Expectation
Let us denote \(E [ X |Y ]\) as a function of the random variable Y whose value at \(Y = y\) is \(E[X|Y = y]\). Note that \(E[X|Y]\) is itself a random variable. An extremely important property of conditional expectation is that for all random variables \(X\) and \(Y\): \[\text E[X] = \text E\Big[\text E[X|Y]\Big]\] If \(Y\) is a discrete random variable, then \[\text E[X] = \sum_x \text E[X|Y=y] P\{Y=y\}\] while if Y is continuous with density \(f_Y(y)\), then \[\text E[X] = \int_{-\infty}^\infty \text E[X|Y=y] f_Y(y)dy\] Example: Suppose that the expected number of accidents per week at an industrial plant is 4. Suppose also that the numbers of workers injured in each accident are independent random variables with a common mean of 2. Assume also that the number of workers injured in each accident is independent of the number of accidents that occur. What is the expected number of injuries during a week?
Solution: Letting \(N\) denote the number of accidents and \(X_i\) the number injured in the i-th accident, \(i = 1, 2,...\), then the total number of injuries can be expressed as \(\sum_{i=1}^N X_i\). Now \[\begin{align}\text E\bigg[\sum_{i=1}^N X_i\bigg] &= \text E\bigg[\text E\bigg[\sum_{i=1}^N X_i|N\bigg]\bigg] \end{align}\] But \[\begin{align}\text E\bigg[\sum_{i=1}^N X_i | N = n\bigg] &= \text E\bigg[\sum_{i=1}^n X_i\bigg] = n\times \text E[X] \end{align}\] by independence of \(X_i\) and \(N\). Then \[\begin{align}\text E\bigg[\sum_{i=1}^N X_i\bigg] &= \text E\bigg[\text E\bigg[\sum_{i=1}^N X_i|N\bigg]\bigg] = \text E[N\times \text E[X]] = \text E[N] \times \text E[X] \end{align}\] Therefore, the expected number of injuries during a week equals \(4 × 2 = 8\)