394. The random variable $X$ is given by the probability density function $f(x)=(1 / 2) \sin x$ in the interval $(0, \pi)$; outside this interval, $f(x)=0$. Find the variance of the function $Y=\varphi(X)=X^{2}$, using the density function $g(y)$.
Solution. We use the formula

$$
D(Y)=\int_{c}^{d} y^{2} g(y) \mathrm{d} y-[M(Y)]^{2}
$$

where $\boldsymbol{c}$ and $d$ are the endpoints of the interval in which the possible values of $Y$ are contained. Substituting $g(y)=\sin \sqrt{y} / 4 \sqrt{y}, M(Y)=\left(\pi^{2}-4\right) / 2$ (see problem 392) and noting that $c=0$ and $d=\pi^{2}$ (since $y=x^{2}$ and $0<x<\pi$, then $0<y<\pi^{2}$), we get

$$
D(Y)=D\left(X^{2}\right)=\int_{0}^{\pi^{2}} y^{2} \cdot \frac{\sin \sqrt{y}}{4 \sqrt{y}} \mathrm{~d} y-\left[\frac{\pi^{2}-4}{2}\right]^{2}
$$

Integrating first using the substitution $y=t^{2}$, and then integrating by parts four times, we have

$$
\frac{1}{4} \int_{0}^{\pi} \frac{y^{2} \sin \sqrt{y}}{\sqrt{y}} \mathrm{~d} y=\frac{\pi^{4}}{2}-6 \pi^{2}+24
$$

Substituting (**) into (*), we finally get

$$
D\left(X^{2}\right)=\left(\pi^{4}-16 \pi^{2}+80\right) / 4
$$