E(XY)=E(XE(Y|X) Joint Conditional Expectations [duplicate]

This question already has an answer here:

Why is E(XY)=E(XE(Y|X))?

Is this using the properties of conditional expectation and is there a general formula that can be applied when you have E(...)=E(..(E(Y|X))?

marked as duplicate by Xi'an, Michael Chernick, Peter Flom♦May 27 at 14:04

By the expression $$\mathbb{E}(XY),$$ we mean the expectation of XY under their joint distribution. I.e., if these both are continuous, we have that

$$\mathbb{E}(XY) = \int\int xyf(x, y)dxdy,$$

where $$f(x, y)$$ is the joint pdf of X and Y. For this reason, we sometimes write $$\mathbb{E}_{(X, Y)}(\cdot),$$ or $$\mathbb{E}_f(\cdot)$$ in order to make it explicit which distribution the expectation is to be taken over.

We can factorise distributions in a certain way, specifically we can write the pdf of a $$d$$-dimensional continuous random vector as $$f(x_1, \dots, x_d) = g_1(x_1)g_2(x_2\vert x_1)g_3(x_3\vert x_2, x_1)\cdots g_d(x_d\vert x_1, \dots, x_{d-1}).$$ Applying this to $$(X, Y),$$ we can write $$f(x, y) = g(x)h(y\vert x).$$ We can then see that \begin{align*} \mathbb{E}_{(X,Y)}(XY) &= \int\int xyf(x, y)dxdy\\ &= \int\int xyg(x)h(y\vert x)dxdy\\ &= \int x\int yh(y\vert x) dy f(x)dx\\ &= \mathbb{E}_X\left(X\int y h(y\vert x) dy\right)\\ &= \mathbb{E}_X\left(\mathbb{E}_{(Y\vert X)}\left(Y\right)\right). \end{align*} This is also true for distributions that are not continuous, and can be generalised to a higher dimension analoguosly to the factorisation property of distributions. To show this in a very general context, you need some measure-theoretic arguments. The general formula that you request is often referred to as the law of iterated expectations, the tower rule, the smoothing theorem, or the law of total expectation.

Another way to show it is directly using Law of iterated expectations:

\begin{align}E[XY] &= E[E[XY|X]]=E[XE[Y|X]]\end{align}

• Thank you. Could we similarly have E(XY)=E[E(XY|Y)]=E[YE(X|Y)] – Maths May 27 at 11:29
• yes, exactly, it holds both ways. – gunes May 27 at 11:30