The continuous random variable $X$ has a $\text{Uniform}[-1, 3]$ distribution and let $Y = X^2$ .
Find the probability density function of $ Y$.
My attempt.
I know that it has to be between $0 < y < 1$. So $F(Y = y) = P(Y \leq y) = P(X^2 \leq y) = P(-\sqrt{y} \leq X \leq \sqrt{y}) = \frac{2\sqrt{y}}{3+1} = \frac{\sqrt{y}}{2}$
I'm not sure how to go forward from this
Let $f_X$ and $f_Y$ denote the densities of $X$ and $Y$ respectively.
$$f_X(x)=\frac{1}{4}\mathbf1_{-1<x<3}$$
We have $y=g(x)$ where $g(x)=x^2$. So the function $g$ must be such that
$$g:(-1,3)\mapsto(0,9)$$
We define $g_i(x)=x^2$ for $i=1,2$ such that $g_1:(-1,0)\mapsto(0,1)$ and $g_2:(0,3)\mapsto (0,9)$.
(I have excluded the end-points in the supports of the random variables as it does not make a difference for continuous distributions)
So, $y=g_1(x)\implies x=g_1^{-1}(y)=-\sqrt y$ and $y=g_2(x)\implies x=g_2^{-1}(y)=\sqrt y$
To directly apply the transformation formula, we have
\begin{align}f_Y(y)&=f_X(-\sqrt y)\left|\frac{d}{dy}(-\sqrt y)\right|+f_X(\sqrt y)\left|\frac{d}{dy}(\sqrt y)\right| \\&=\frac{1}{4}\cdot\frac{1}{2\sqrt y}\mathbf1_{0<y<1}+\frac{1}{4}\cdot\frac{1}{2\sqrt y}\mathbf1_{0<y<9} \\&=\frac{1}{4\sqrt y}\mathbf1_{0<y<1}+\frac{1}{8\sqrt y}\mathbf1_{1<y<9} \end{align}