Example 4. The random variable $X$ is given by the probability density function

$$
p(x)= \begin{cases}1 & \text { if } 1 \leq x \leq 2 \\ 0 & \text { if } x < 1 \text{ or } x > 2\end{cases}
$$

Find the probability density function of the function $Y=X^{2}$.
Solution. On the interval of possible values of the random variable $X$, the function $y=x^{2}$ is monotonically increasing. The inverse function $x=\sqrt{y}$ is also monotonically increasing on the interval $[1 ; 4]$ - the range of possible values of the random variable $Y$. We find the derivative of the inverse function

$$
x_{y}^{\prime}=\frac{1}{2 \sqrt{y}}
$$

Applying formula (2.7.4), we find

$$
g(y)= \begin{cases}1 / 2 \sqrt{y} & \text { for } 1 \leq y \leq 4 \\ 0 & \text { for } y>4\end{cases}
$$