297. Find the variance of the random variable $X$, given by the distribution function

$$
F(x)=\left\{\begin{array}{ccc}
0 & \text { for } & x \leqslant-2 \\
x / 4+1 / 2 & \text { for } & -2 < x \leqslant 2 \\
1 & \text { for } & x > 2
\end{array}\right.
$$
Solution. Let's find the density function:

$$
f(x)=F^{\prime}(x)=\left\{\begin{array}{ccc}
0 & \text { for } & x2
\end{array}\right.
$$

Let's find the expected value

$$
M(X)=\int_{-2}^{2} x f(x) \mathrm{d} x=\int_{-2}^{2} x \cdot \frac{1}{4} \mathrm{~d} x=0
$$

(the integrand function is odd, and the limits of integration are symmetric about the origin).

Let's find the required variance, considering that $M(X)=0$:

$$
D(X)=\int_{-2}^{2}[x-M(X)]^{2} f(x) \mathrm{d} x=\int_{-2}^{2} x^{2} \cdot \frac{1}{4} \mathrm{~d} x=\frac{2}{4} \int_{0}^{2} x^{2} \mathrm{~d} x=\frac{4}{3}
$$