121. Find the mathematical expectation and variance of a random variable $X$ distributed uniformly for $x \in [a ; b]$.
S o l u t i o n. The expected value of a random variable $X$, uniformly distributed for $x \in[a ; b]$, will be found using formula (54), into which we will substitute the expression $f(x)$ given by formula (60):

$$
M(x)=\int_{a}^{b} x f(x) d x=\frac{1}{b-a} \int_{a}^{b} x d x=\frac{b^{2}-a^{2}}{2(b-a)}=\frac{a+b}{2}
$$

The variance of a random variable $X$, uniformly distributed for $x \in[a ; b]$, will be found using formula (56), into which we will substitute the expression $f(x)$ given by formula (60), and the found value of the expected value:

$$
\begin{aligned}
& D(X)=\int_{a}^{b} x^{2} f(x) d x-M^{2}(X)=\int_{a}^{b} \frac{1}{b-a} x^{2} d x-\frac{(a+b)^{2}}{4}= \\
& =\frac{b^{3}-a^{3}}{3(b-a)}-\frac{(a+b)^{2}}{4}=\frac{(b-a)^{2}}{12}
\end{aligned}
$$