Let $X$ have the uniform distribution $U(-1,3)$. Find the pdf of $Y=X^2$.
As $X \sim U(-1,3)$, then the pdf of $X$ is $f:S_x \to \mathbb{R}$ defined as $f(x)=\frac{1}{4}$, where $S_x=[-1,3]$.
Because $Y=X^2$, and because $-1\le x \le3$, we have $X=\pm\sqrt Y$. Now, $X=-\sqrt Y$ when $-1\le x <0$ and $X=\sqrt Y$ when $0\le x \le 3$. That means $0\le y \le 1$ and $1< y \le 9$.
Let $v_1(Y)=-\sqrt Y$ and $v_2(Y)=\sqrt Y$. Then $\frac{d}{dy}[v_1(Y)]=-\frac{1}{2\sqrt Y}$ and $\frac{d}{dy}[v_2(Y)]=\frac{1}{2\sqrt Y}$.
So when $0 \le y \le 1$, we have $x \in [-1,1]=[-1,0] \cup (0,1]$, and thus $G(y)=P(Y\le y)=P(X^2 \le y)=P(X \le \pm \sqrt y)=P(X\le -\sqrt y) \cup P(X\le \sqrt y)=\int_{-1}^{v_1(y)} f(x)dx+\int_{0}^{v_2(y)}f(x)dx \Rightarrow g(y)=G'(y)=\frac{d}{dy}\int_{-1}^{v_1(y)} f(x)dx+ \frac{d}{dy}\int_{0}^{v_2(y)}f(x)dx=f[v_1(y)] \cdot |v_1'(y)|+f[v_2(y)] \cdot |v'_2(y)|=\frac{1}{4} \cdot \frac{1}{2\sqrt y}+\frac{1}{4} \cdot \frac{1}{2\sqrt y}=\frac{1}{4\sqrt y}$
And when $1 < y\le 9$, we have $G(y)=\int_{0}^{v_2(y)}f(x)dx \Rightarrow g(y)=f[v_2(y)] \cdot |v_2'(y)|=\frac{1}{4} \cdot \frac{1}{2 \sqrt y}=\frac{1}{8 \sqrt y}$
Therefore $g(y)=\left\{ \begin{array}{lr} \frac{1}{4 \sqrt y}, & \hspace{2mm} 0\le y \le1 \\ \frac{1}{8 \sqrt y}, & \hspace{2mm} 1< y \le9\\ \end{array} \right.$
Is this correct? I want to make sure my reasoning here is correct, thanks!