# How is this result derived?

I have been trying this for an hour now, but I can't seem to find out how this conclusion is drawn. This is from the book by Greene (Econometric analysis p 53).

What may be confusing me is that I don't know what the difference between $E_{x,y}$ and $E_yE_x$ is. I have interpreted the first as expectation over both variables, and the second as $E(E(\cdot|Y))$ which by the law of iterated expectations is equal to simply the expectation. Therefore, I have interpreted them to be equivalent.

Is this correct? And So how do we derive this result?

This notation is really imprecise, it would be better to write $E_y E_{x|y}$ for it does not make sense to integrate over $p(x)$ and then $p(y)$ unless $x\perp y$.
$$E_{y, x}[g] = \int_{y, x}gp(y,x) d(y,x) = \int_y \int_x gp(y,x)dxdy = E_yE_x[g]$$
\begin{align} E_yE_x[g] &=\int_y \int_x gp(y,x)dxdy \\ &=\int_y \int_x gp(x|y)p(y)dxdy \\ &= \int_y \left( \int_x gp(x|y)dx \right) p(y)dy\\ &= E[E[g|y]] \end{align}
Finally, to prove the mean squared error decomposition, take $(y - \gamma x)^2$ and sum and subtract $E[y|x]$: $(y - \gamma x)^2 =(y - E[y|x] + E[y|x]- \gamma x)^2$. Expanding this square gives you: $(y - E[y|x])^2 + (E[y|x]- \gamma x)^2 + 2(y - E[y|x])(E[y|x]- \gamma x)$. Then just take the expectation.