# Homework Help: Show that the expectation is zero

1. Sep 12, 2006

### island-boy

In one of the proofs I'm reading, I need to show that the
$$\phi(X)$$
that will minimize $$E[Y - \phi(X)]^{2}$$ is
$$\phi(X) = E(Y|X)$$

the proof is shown to proceed as follows:
$$E[Y - \phi(X)]^{2}$$
$$=E[(Y - E(Y|X)) + (E(Y|X) - \phi(X))]^{2}$$

expanding, we have

$$=E[(Y - E(Y|X))^{2} + 2(Y - E(Y|X))(E(Y|X) - \phi(X)) + (E(Y|X) - \phi(X))^{2}]$$
$$=E[(Y - E(Y|X))^{2}] + 2E[(Y - E(Y|X))(E(Y|X) - \phi(X))] + E[(E(Y|X) - \phi(X))]^{2}]$$

the proof then states that the middle term is equal to zero. How is this true?
I got
$$2E[(Y - E(Y|X))(E(Y|X) - \phi(X))]$$
$$=2E[YE(Y|X) - (E(Y|X))^{2} - Y\phi(X) + E(Y|X)\phi(X)]$$
$$=2E[YE(Y|X)] - 2E[(E(Y|X))^{2}] - 2E[Y\phi(X)] + 2E[E(Y|X)\phi(X)]$$
$$=2E(Y|X)E(Y) - 2(E(Y|X))^{2} - 2E[Y\phi(X)] + 2E(Y|X)E(\phi(X))$$

I'm not sure on how to proceed next.
I'm thinking that the first 2 terms will cancel as will the last two...but how exactly I'm not sure.