Proving $\mathbb { E } \left[ ( f ( x ) - \mathbb { E } [ f ( x ) ] ) ^ { 2 } \right] = \mathbb { E } \left[f(x)^{2}\right]-\mathbb{E}[f(x)]^{2}$

51 Views Asked by At

I am struggling a bit proving the following,

$$\mathbb { E } \left[ ( f ( x ) - \mathbb { E } [ f ( x ) ] ) ^ { 2 } \right] = \mathbb { E } \left[ f(x) ^ { 2 } \right] - \mathbb { E } [ f(x) ] ^ { 2 }$$

This is what I have done so far (very basic, just expanded the square)

\begin{align*} \mathbb { E } \left[ ( f ( x ) - \mathbb { E } [ f ( x ) ] ) ^ { 2 } \right] &= \mathbb { E } \left[ f ( x )^{2} - f( x ) \mathbb { E } [ f ( x ) ] ) - f( x ) \mathbb { E } [ f ( x ) ] ) + \mathbb{ E } [ f ( x ) ] ^ { 2 } \right] \\ &= \mathbb { E } \left[ f ( x )^{2} - 2f( x ) \mathbb { E } [ f ( x ) ] ) + \mathbb{ E } [ f ( x ) ] ^ { 2 } \right] \end{align*}

this is where I kind of get stuck. I know that expectations are linear which means that I can do something like this using additivity and homogeneity

$$\mathbb { E } \left[ ( f ( x )^{2} \right] - 2\mathbb{ E } \left[f( x ) \mathbb { E } [ f ( x ) ] ) \right] + \mathbb{ E } \left[\mathbb { E } [ f ( x ) ] ^ { 2 } \right]$$

but I'm not sure where to go after this.

How do I finish this proof?

What am I missing?

2

There are 2 best solutions below

1
On BEST ANSWER

$\newcommand{\E}{\mathbb{E}}$Hints: Since $\E\left[f(x)\right]^2$ is a constant, we have $\E\left[\E[f(x)]^2\right] = \E[f(x)]^2$ (remember, the expected value of a constant is itself). Also, since $\color{blue}{\E[f(x)]}$ is a constant, we can pull it outside the expectation to get that $\E\left[f(x)\color{blue}{\E[f(x)]}\right] = \color{blue}{\E[f(x)]} \E[f(x)] = \E\left[f(x)\right]^2$.

0
On

Hint: $\mathbb{E}[f(x)]$ is a real number and as you said, expectations are linear. So, what is $\mathbb{E}[f(x)\mathbb{E}[f(x)]]$ equal to?