This example is from the book first course in probability Example 4a.
Let $X$ denote a random variable that takes on any of the values −1, 0, and 1 with respective probabilities $P\{X=−1\}=.2 \quad P\{X=0\}=.5 > \quad P\{X=1\}=.3$ Compute $E[X^2]$.
Solution.Let $Y=X^2$. Then the probability mass function of $Y$ is given by
$P\{Y=1\}=P\{X=−1\}+P\{X=1\}=.5$
$P\{Y=0\}=P\{X=0\}=.5$
What rule is used to compute $P\{Y=1\}$ ? When $Y=X^2$ Why addition is used ?
$P(Y=1) = P(X^2 = 1) = P(X = \pm 1) = P(X = 1) + P(X = - 1).$
Addition can be used since events $\{X = 1\}$ and $\{X = - 1\}$ are naturally disjoint.