392. A 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 mathematical expectation of the random variable $Y=\varphi(X)=X^{2}$, by first determining the density function $g(Y)$ of the variable $Y$.







Solution. First, we find the density $g(y)$ of the random variable $Y$. Since the function $y=\varphi(x)=x^{2}$ is strictly increasing for the considered values of $x (0<x<\pi)$, the density $g(y)$ will be found using the formula

$$
g(y)=f[\psi(y)] \cdot\left|\psi^{\prime}(y)\right|
$$

where $\Psi(y)=\sqrt{y}$ is the inverse function of $y=x^{2}$. Substituting $\psi(y)=\sqrt{y}$ and considering that $f(x)=(1 / 2) \sin x,\left|\psi^{\prime}(y)\right|=\left|(\sqrt[V]{y})^{\prime}\right|=$ $=1 /(2 \sqrt{y})$, we get

$$
g(y)=\sin \sqrt{y} y^{\prime}(4 \sqrt{y})
$$

We now find the expected value of the variable $Y$, noting that the possible values of $Y$ are in the interval $(0, \pi^{2})$ [since $y=x^{2}$ and $0<x<\pi$, then $0<y<\pi^{2}$]:

$$
M(Y)=\int_{0}^{\pi^{2}} y g(y) \mathrm{d} y=\frac{1}{4} \int_{0}^{\pi^{2}} \frac{y \sin \sqrt{y}}{\sqrt{y}} \mathrm{~d} y
$$

Using the substitution $y=t^{2}$, we get

$$
M(Y)=\frac{1}{2} \int_{0}^{\pi} t^{2} \sin t \mathrm{~d} t
$$

Integrating by parts twice, we finally have

$$
M(Y)=M\left(X^{2}\right)=\left(\pi^{2}-4\right) / 2
$$

Remark. The solution provided above serves educational purposes. A much faster approach is given by the formula

$$
M\left[X^{2}\right]=\frac{1}{2} \int_{0}^{\pi} x^{2} \sin x \mathrm{~d} x=\left(\pi^{2}-4\right) / 3
$$

This remark also applies to problem 393.