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?
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$.