Given $$ f(x) = \begin{cases} \frac12 &,\ -0.5 \le x\le 1.5\\0 &,\ \mbox{otherwise} \end{cases}$$
find the probability density function of $Y=X^2$.
To solve this I first divided up the pdf of X into three parts:
$$f(x) = \begin{cases} \frac12 &, \ -0.5 \le x\le 0\\\frac12 &, \ 0\le x\le 0.5 \\ \frac12 &,\ 0.5 \le x\le 1.5\\ 0 &, \ \mbox{otherwise} \end{cases}$$
Then applying $g^{-1}(y) = -\sqrt{y}$ for $-0.5 \le x \le 0 $ and $g^{-1}(y) = +\sqrt{y}$ for $ 0 \le x \le 0.5 $ and $ 0.5 \le x \le 1.5 $, I get:
$$ g(y) = \begin{cases} \frac{1}{4\sqrt{y}} &,\ 0 \le x \le 0.25\\ \frac{1}{4\sqrt{y}} &, \ 0\le x\le 0.25 \\ \frac{1}{4\sqrt{y}} &, \ 0.25 \le x \le 2.25 \\ 0 &, \ \mbox{otherwise} \end{cases}$$
Summing up the first two cases I get:
$$ g(y) = \begin{cases} \frac{1}{2\sqrt{y}} &, \ 0 \le x \le 0.25 \\ \frac{1}{4\sqrt{y}} &, \ 0.25 \le x \le 2.25\\ 0 &, \ \mbox{otherwise} \end{cases} $$
Could someone confirm whether my solution is correct or not? And whether my argumentation makes sense? Thanks!