Part B. Computing expectations by conditioning: Consider two random variables X and Y. Let the conditional expectation of X given that Y = y be denoted by E[X|Y = y] or simply E[X|Y]. An important property of conditional expectation is that for all random variables X and Y, we have
E[X] = E[E[X|Y]]
For discrete random variables, the formula is computed as follows:
E[X] = ̑y E[X|Y = y]P(Y = y)
Can you prove this equation? Hint: Notice that ̑y E[X|Y = y]P(Y = y) = ̑y ̑x xP(X = x|Y = y)P(Y = y), then replace the conditional probability with its equivalent and compute marginal probability to eliminate Y.