Example 2. A discrete random variable $X$ is given by the distribution law

| $X$ | -2 | -1 | 0 | 1 | 2 |
| :---: | :---: | :---: | :---: | :---: | :---: |
| $P$ | 0.1 | 0.2 | 0.15 | 0.25 | 0.3 |

Find the distribution law and the mathematical expectation of the random variable $Y=X^{2}$.
Solution. The square of a random variable $X$, i.e., $Y=X^{2}$, is a new random variable that takes values equal to the squares of its values with the same probabilities as the random variable $X$.

The squares of the random variable $X$ are: $(-2)^{2}=4,(-1)^{2}=1$, $0^{2}=0,1^{2}=1,2^{2}=4$, i.e., the random variable $Y=X^{2}$ takes the values: $y_{1}=0, y_{2}=1, y_{3}=4$. The distribution law of the random variable $Y=X^{2}$ can be written as:

| $Y=X^{2}$ | 0 | 1 | 4 |
| :---: | :---: | :---: | :---: |
| $P$ | 0.15 | 0.45 | 0.4 |

The probability 0.45 for the value $y_{2}=1$ is obtained by the theorem of addition of probabilities with which the random variable $X$ takes the values $x_{2}=-1, x_{4}=1$. Similarly, the probability 0.4 for the value $y_{3}=4$ is obtained.

According to formula (2.7.2), we find the mathematical expectation of the function $Y=X^{2}$:

$$
M(Y)=M\left(X^{2}\right)=0 \cdot 0.15+1 \cdot 0.45+4 \cdot 0.4=2.05
$$