# Best MSE predictor : E(Y) vs conditionnal expectation?

I'm trying to understand my teacher's proof. He starts by showing that the c that minimizes $$E((Y-c)^2))$$ is $$E(Y)$$, which I understand.

But then he says that $$E((Y-g(X))^2) \geq E((Y-E(Y|X)^2)$$, as if that was obvious from the previous result. How can you go from one to the other?

Thanks!