p.d.f of function of random variable Suppose $X$ is a continuous random variable with p.d.f:
$$
f_X(x) = \begin{cases}1 &amp; x \in [0, \frac{1}{2}) \\ 1 &amp; x \in [1, \frac{3}{2}) \\ 0 &amp; \text{otherwise} \end{cases}
$$

What is the p.d.f of $Y = {(X - 1)}^2$?

Let's plot $g(X) = {(X - 1)}^2$ over the interval $0 \leq x \leq \frac{3}{2}$:


$g(X)$ is one-to-one over the interval $0 \leq x &lt; \frac{1}{2}$ and is not one-to-one over $\frac{1}{2} \leq x \leq \frac{3}{2}$

So, consider $0 \leq y &lt; \frac{1}{4}\quad$ ($\frac{1}{2} \leq x &lt; \frac{3}{2}$):

$$
\begin{eqnarray*}
F_Y(y)&amp;=&amp;P(Y \leq y)\\
&amp;=&amp;P({(X - 1)}^2 \leq y)\\
&amp;=&amp;P(\sqrt{{(X - 1)}^2} \leq \sqrt{y})\\
&amp;=&amp;P(1 - \sqrt{y} \leq X \leq 1 + \sqrt{y})\\
&amp;=&amp;F_X(1 + \sqrt{y}) - F_X(1 - \sqrt{y})\\
f_Y(y)&amp;=&amp;F'_Y(y)\\
&amp;=&amp;F'_X(1 + \sqrt{y}) - F'_X(1 - \sqrt{y})\\
&amp;=&amp;f_X(1 + \sqrt{y})\cdot(1 + \sqrt{y})' - f_X(1 - \sqrt{y})\cdot(1 - \sqrt{y})'\\
&amp;=&amp;1\cdot\frac{1}{2}y^{-\frac{1}{2}} - 0\cdot(1 - \sqrt{y})'\\
&amp;=&amp;\frac{1}{2}y^{-\frac{1}{2}}
\end{eqnarray*}
$$

Note that $f_X(1 - \sqrt{y}) = 0$ because $f_X(x) = 0$ over $\frac{1}{2} \leq x &lt; 1$

Now, consider $\frac{1}{4} \leq y &lt; 1\quad$ ($0 \leq x &lt; \frac{1}{2}$):

$$
\begin{eqnarray*}
F_Y(y)&amp;=&amp;P(Y \leq y)\\
&amp;=&amp;P((X - 1)^2 \leq y)\\
&amp;=&amp;P(\sqrt{(X - 1)^2} \leq \sqrt{y})\\
&amp;=&amp;P(- (X - 1) \leq \sqrt{y})\\
&amp;=&amp;P(X \geq 1 - \sqrt{y})\\
&amp;=&amp;1 - P(X \leq 1 - \sqrt{y})\\
&amp;=&amp;1 - F_X(1 - \sqrt{y})\\
f_Y(y)&amp;=&amp;F'_Y(y)\\
&amp;=&amp;- F'_X(1 - \sqrt{y})\\
&amp;=&amp;- f_X(1 - \sqrt{y})\cdot(1 - \sqrt{y})'\\
&amp;=&amp;- 1\cdot(- \frac{1}{2}y^{-\frac{1}{2}})\\
&amp;=&amp;\frac{1}{2}y^{-\frac{1}{2}}
\end{eqnarray*}
$$

Note that $\sqrt{(X - 1)^2} = - (X - 1)$ because $g$ is a decreasing function of $X$ over $0 \leq x &lt; \frac{1}{2}$

So,

$$
f_Y(y) = \begin{cases}\frac{1}{2}y^{-\frac{1}{2}} &amp; y \in [0, \frac{1}{4}) \\ \frac{1}{2}y^{-\frac{1}{2}} &amp; y \in [\frac{1}{4}, 1) \\ 0 &amp; \text{otherwise} \end{cases}
$$

Is this correct?

I did check and $\int_0^1 f_Y(y)\,\mathrm{d}y = 1$, but I am interested in the reasoning too.
Actually, the function is one-to-one on the relevant domain. And the image (and hence the range of $Y$) is $(1/4,1] \cup [0,1/4]=[0,1]$

Hence, you can simply apply the formula $$f_Y(y)= \frac{f_X(x)}{|g'(x)|}=\frac{1}{2 |x-1|}$$

But $|x-1|= \sqrt{y}$

Hence  $$f_Y(y) = \frac{1}{2 \sqrt{y}} , \hspace{1cm} y\in (0,1]$$

Your procedure is right, of course.
For a starter, the pdf of $X$ you posted is not a valid pdf. $\int_{-\infty}^{\infty} f_X(x) dx = \frac{3}{2}$. This also results in an incorret plot of $g(X)$. Which pdf do you mean?

Edit: Excuse me, I misread your definition.