Conditional Expectation

For two r.v.s , we have

This is because

For discrete , this gives

This can be seen as the law of total expectation.

Conditional Variance

For two r.v.s , we have

Tip

The variance of a r.v. is the sum of variance of conditional expectation and the expectation of conditional variance

This is because

and

Adding the two formulas above gets the result.