The Law of the Unthinking Statistician (LOTUS) is a useful shortcut for transforming expectations of random variables. In short, you can simply plug in the random variable into the transformation $g(x)$ and multiply by the [[probability density function|pdf]] =$F_X(x)$
$E[g(x)] = \int\limits_{-\infty}^{\infty} g(x)f_x(x)dx$
For example, if we have the [[probability mass function]]
| x | P(x) |
| ---- | ---- |
| 1 | 0.25 |
| 2 | 0.25 |
| 3 | 0.5 |
the expected value of X is
$E(X) = 1*0.25 + 2*0.25 + 3*0.5 = 2.25$
and the expected value of $X^2$ is
$E(X^2) = 1^2 * 0.25 + 2^2 * 0.25 + 3^2 * 0.5 = 5.75$