# $E(X^2)$ - subbing in $X^2$ into the formula for mean

In calculating the standard deviation of the number on a fair die we need to find $E(X^2)$ which I want to calculate using the formula for expectation where

$E(X)$ = $\sum\limits_{x=1}^{6} xP(x)$

and substitute $X^2$ instead of $X$.

I expect to then have to sum up $x^2P(x^2)$ for 1,2,3,4,5,6

However the solution shows

$1^2(\frac{1}{6})+2^2(\frac{1}{6})+3^2(\frac{1}{6})+4^2(\frac{1}{6})+5^2(\frac{1}{6})+6^2(\frac{1}{6})$

which means it only squares the $x$ while $P(x)$ remains $\frac{1}{6}$ .

I want to be able to solve $E(X^2)$ strctly using the summation formula (unless it is completely wrong to do so). How can this summation formula be used for this specific case? How is it possible that the $x$ is only getting squared in one place?

• $P (x^2)$ remains $\frac {1}{6}$. Why wouldn't it? If $x$ can be 1, 2, 3, 4, 5 or 6 with equal probability $\frac {1}{6}$, then $x^2$ will be $1^2$, $2^2$,..., $6^2$ with equal probability $\frac {1}{6}$. – user491874 Nov 26 '17 at 16:37
• – Clement C. Nov 26 '17 at 16:58
• @user8734617 has the right perspective here. In particular, the subtle confusion from the OP is that we square the $x$ in $P(x)$, but we don't square the entire term $[P(x)]$. – Aaron Montgomery Nov 26 '17 at 18:46

Your (correct) formula for $E(X)$ is a special case of a more general formula: $E(g(X))=\sum_{x=1}^6 g(x) \,P(x)$. Use that formula with the function $g(x)=x^2$.