Why is Y|X the minimum

37 Views Asked by At

I want to show that

$$\underset{g(x)}{min} E \left ( (Y - g(X) )^2 \right ) = E \left ( (Y - E(Y|X) )^2 \right )$$

I understand intuitively why this works, and I have seen the proof, but I don't know how to show one of the lines.

The proof:

$$E \left ( (Y - g(X) )^2 \right ) $$ $$=E((Y - E(Y|X) + E(Y|X) -g(X))^2)$$ $$ =E \left [(Y - E(Y|X))^2 + (E(Y|X) -g(X))^2 -2(E(Y|X) -g(X))(Y - E(Y|X))\right ]$$

$$=E \left [(Y - E(Y|X))^2 + (E(Y|X) -g(X))^2 \right ]$$

$$=E \left [(Y - E(Y|X))^2 + (E(Y|X) -g(X))^2 \right ] \geq E \left ( (Y - E(Y|X) )^2\right )$$

Where we only have equality when $E(Y|X) = g(x)$.

Now I understand everything except why

$$-2E \left [(E(Y|X) -g(X))(Y - E(Y|X))\right] = 0$$

2

There are 2 best solutions below

0
On BEST ANSWER

Since $$E\bigg((E(Y|X) -g(X))(Y - E(Y|X))\bigg|X\bigg)= (E(Y|X) -g(X))E\bigg((Y - E(Y|X))\bigg|X\bigg) =(E(Y|X) -g(X))(0)=0$$ so by Law_of_total_expectation $$E\bigg((E(Y|X) -g(X))(Y - E(Y|X))\bigg)= E\left(E\bigg((E(Y|X) -g(X))(Y - E(Y|X))\bigg|X\bigg)\right)=0.$$

0
On

Because $E[Y|X]-g(X)$ is a $\sigma(X)$-measurable random variable. Indeed, if $Z$ is any such variable, we have by the tower law and "taking out what is known": \begin{equation} E[Z(Y-E[Y|\sigma(X)])] = E[E[Z(Y-E[Y|\sigma(X)])|\sigma(X)]] = E[ZE[Y-E[Y|\sigma(X)]|\sigma(X)]], \end{equation} and $E[Y-E[Y|\sigma(x)] | \sigma(X)] = 0$ by elementary properties of conditional expectation.