Minimal value of $\mathbb{E}[(X-g(Y))^2]$. In a test I have two true/false question and I'm not sure if I got it properly:
Given X and Y as two random variable (we don't know if indipendent), with $g:\mathbb{R}\to\mathbb{R}$:

*

*$g(Y)=\mathbb{E}[X|Y]$ makes $\mathbb{E}[(X-g(Y))^2]$ minimal

*$c=var[X]$ makes $\mathbb{E}[(X-c)^2]$ minimal

Now, in both cases the second part resemble the formula of the variance, but I don't think I need it.
Due to the fact that both $\mathbb{E}[(X-g(Y))^2]$ and $\mathbb{E}[(X-c)^2]$ are the expected value of a square, the minimal value that they can get is zero, and they get it when $g(Y)=X$ and $c=X$.
So both the the answers should be false, but I'm not really sure if I'm missing something, can you confirm that my logic is right?

The key point here is that when trying to define an estimator function such as $g(\cdot )$, we should note it to be deterministic rather than stochastic. The substitution $g(X)=X$ may sound reasonably good, but impractical due to it uselessness because we don't know the exact amount of $X$. Instead, we can exploit additional information, say $Y$, to make a best possible (from the aspect of minimum error variance) estimation of $X$. The more $Y$ is dependent to $X$, the better the estimator is .
