I am awkard to understand the basic things so I have suffered from the procedure of proving the minimize the mean square error.
the mean square error is
$$ E[(X-g(Y))^{2}]=\int_{-\infty }^{\infty}E[(X-g(Y))^2|Y=y]f_y(y)dy $$
and I understand the $E[(X-g(Y))^2|Y=y] \ge 0 $ and $f_y(y) \ge 0$
After the only $g(y)$ is chosen to be minimized the inner expectation $E[(X-g(Y))^2|Y=y]$
I don't understand to consider only this formula to find $g(y)$
So I could not understand the why $f_y(y)$ is disappeared and
it only cares just case $ E[(X-g(Y))^2|Y=y] $
( I think that it seems to be considered about $ \int_{-\infty }^{\infty}E[(X-g(Y))^2|Y=y] $ if $f_y(y) $ is disappeared )
Thank you very much in advance. Welcome to think for hint and advice :)