Let $X \sim \text{Uniform} ( -1,3)$. Find the PDF of $Y= X^2$.
Solution:
The density of $X$ is
$$f_x(x) = \begin{cases}
\frac {1}{ 4} & \text{if } -1< x < 3 \\
0 & \text{otherwise} \end{cases} $$
$Y$ can only take values in $(0,9)$. Consider two cases: (i) $0 < y < 1$ and (ii) $1 < y < 9$. For case (i), $A_{y1} = [-\sqrt{y}, \sqrt{y}]$. For case (ii) $A_{y2} = [-1,\sqrt{y}] $
$$F_Y(y) = \int _{A_{y1}} f_X(x)dx = (1/2)\sqrt {y} $$
$$F_Y(y) = \int_{A_{y2}} f_X(x)dx = (1/2)(\sqrt {y} + 1)$$
Differentiating $F$ we get
$$f_Y(y) = \begin{cases} \frac {1}{ \sqrt y } & \text{ if } 0 < y < 1 \\ \frac {1}{8 \sqrt y } & \text{ if } 1 < y < 9 \\ 0 & \text{otherwise } \end{cases}$$
I don't get how the two cases were considered and then from those two cases limit of integrals $A_{y1} $ and $A_{y2} $ were calculated?
Let us start with CDF of $Y$: $$ F_Y(y) = \mathbb P(Y\leq y) = \mathbb P(X^2\leq y). $$
If $y\leq 0$, $X^2$ cannot be less or equal than $y$, so this probability is zero. Therefore we can consider $y>0$ only. In this case $$ F_Y(y) = \mathbb P(X^2\leq y)=\mathbb P(|X|\leq \sqrt{y})=\mathbb P(-\sqrt{y}\leq X\leq \sqrt{y}). $$ And $X$ takes only values from $-1$ to $3$. There are two cases:
1) If $[-\sqrt{y},\sqrt{y}]$ is inside $[-1,3]$, then to find probability, we need to integrate PDF $f_X(x)$ in these bounds. It happen when $0<y\leq 1$. For this case $$ F_Y(y) = \int\limits_{-\sqrt{y}}^{\sqrt{y}}f_X(x)dx. $$
2) If $1<y\leq 9$, then $\sqrt{y}\in[1,3]$ and $-\sqrt{y}<-1$ is outside $[-1,3]$, so the lower bound of integral should be $-1$. For this case $$ F_Y(y) = \int\limits_{-1}^{\sqrt{y}}f_X(x)dx. $$
And also for $y>9$, $[-1,3]\subset [-\sqrt{y}, \sqrt{y}]$, so $$ F_Y(y) = \int\limits_{-1}^{3}f_X(x)dx=1. $$