# $E^2[X]$ vs.$E[X^2]$, what's the difference?

This has come up in a homework problem, but I've never seen exponents defined in terms of random variables and expected values. I've tried googling this, but I must not be using the right words. If anyone could define both terms for me, or briefly explain the difference, it would help a lot.

-

I assume by $E^2[X]$ they mean $(E[X])^2$. So for a regular die throw that would be $E[X]\cdot E[X] = 3.5\cdot 3.5 = 12.25$. However, $E[X^2]$ is the expected value of the square of the outcome, so for a regular die: $$E[X\cdot X] = 1\cdot\frac{1}{6} + 4\cdot\frac{1}{6} + 9\cdot\frac{1}{6} + 16\cdot\frac{1}{6} + 25\cdot\frac{1}{6} + 36\cdot\frac{1}{6} = 15.1\overline{6}$$ It can be shown that $E[X^2]\geq E^2[X]$ for any random variable $X$, assuming they both exist (yes, some probability distributions have no expected value).

-
Concise, clear, and exactly the kind of explanation I was looking for. Thank you! – user62793 Feb 18 '13 at 11:32

$E^2[x]$ - means square of the mean, whereas $E[x^2]$ - mean of the squared value. To see the difference, take some simple example. Let's say you have some random sequence $$x = \{1,4,5,2,10\}$$ so arithmetic mean of this sequence is $E[x] = \frac{1+4+5+2+10}5 = 4.4$, and square of it $E^2[x] = 19.36$. Now, construct new sequence, which is square of previous one $$y = x^2 = \{1,16,25,4,100\}$$ so mean of this sequence $E[y] = E[x^2]=\frac{1+16+25+4+100}5 = 29.2$

## Update

if you're dealing with continuous random variables, then $$E^2[x] = (E[x])^2 = \left (\int_{-\infty}^\infty x f(x) dx \right )^2 \\ E[x^2] = \int_{-\infty}^\infty x^2 f(x) dx$$

-
+1 for the continuous variable. I didn't even think about that. – Arthur Feb 18 '13 at 11:13

We recognize $$\Bbb E^2[X] = \left(\Bbb E[X]\right)^2$$ and $$\Bbb E[X^2] = \sum_{x\in W_X} x^2 \cdot \Pr[X=x]$$ where $W_X$ holds the expected outcomes of $X$. Furthermore we can compute the variance with $$\text{Var}[X]=\Bbb E[X^2]-\Bbb E^2[X].$$ In general we can apply functions to random variables like $$\Bbb E[f(X)] = \sum_{x\in W_X}f(x)\cdot\Pr[X=x]$$ without considering that there are some cases where this rule does not apply. But for $f(x)=x^2$ it is allowed.

-

The difference is exactly the same as with $$a^2 + b^2 \neq (a+b)^2$$

Another thing to see is that $\rm E[X^2]$ is the $\rm L^2$-norm is $\rm X$ is centered ; $(\rm E[X])^2$ is the square of the $\rm L^1$-norm.

-