# How to calculate $E[X^2]$ for a die roll?

Apparently:

$$E[X^2] = 1^2 \cdot \frac{1}{6} + 2^2 \cdot \frac{1}{6} + 3^2\cdot\frac{1}{6}+4^2\cdot\frac{1}{6}+5^2\cdot\frac{1}{6}+6^2\cdot\frac{1}{6}$$

where $X$ is the result of a die roll.

How come this expansion?

• This is called the second moment of $X$. Does the Wikipedia page help? Have a look at the Uses and application section. Particularly, it is useful for calculating the Variance. Jan 11, 2015 at 13:05
• Kind of. So I would need to evaluate the moment generating function or so? Anyway, then for example evaluating $E[X^3]$ would require some work I guess. Jan 11, 2015 at 13:12
• The expected value for discrete random variables is just the sum of the products of the outcome times its probability...
– mfnx
May 11, 2022 at 22:36

Or consider the case $Y=X^2$ and computing $E(Y)$.
Here's another way to compute $E[X^2]$.
If you know how to compute $E[X]$ and $Var(X)$ for a dice roll, then you can work out $E[X^2]$ using this equivalence of variance: $Var(X) = E[X^2] - (E[X])^2$.