PDF of a piecewise transformation This is a question that a friend asked me (has the final answer too).
The pdf of a random variable $X$ is
$$ f(x) = 0.5,\quad -1 < x < 1 $$
The random variable Y is defined as 
$$ Y = \begin{cases}
-2X,  & -1 < X < 0 \\
X+1, & 0 < X <1
\end{cases}$$
I tried using the inverse transform method but I'm unsure of how to go about this since $Y$ takes values in $[1, 2)$ in both intervals provided above. I get the fact that there should be some sort of an overlapping in this case but can someone provide me with a rigorous way to solve this problem.
The answer was given to be
$$ f(y) = \begin{cases}
0.25,  & 0 < y < 1 \\
0.75, & 1 < y <2
\end{cases}$$
Here is what I did:
$P(Y \leq y) = P(-2X \leq y) = \frac{1}{2} + \frac{y}{4}$.
Taking the derivative of the above CDF, I get $f_Y(y) = 0.25$ when $0 < y < 2$. 
I carried out the same procedure for the other interval and obtained $f_Y(y) = 0.5$ when $1 < y < 2$.
Is it alright to conclude that the pdf is as provided in the solution because there is an overlap between the two intervals? Is there a more rigorous way of showing this?
 A: Yes.  It's called folding;  when two disjoint intervals of the support of $X$ fold into the same interval in the support of $Y$, then the change of variables transformation folds the combined influence.   $$\begin{align}f_Y(y)~=~& \Big\lvert\dfrac{\mathrm d x_1(y)}{\mathrm d y}\Big\rvert~f_X(x_1(y))+\Big\lvert\dfrac{\mathrm d x_2(y)}{\mathrm d y}\Big\rvert~f_X(x_2(y)) \\[1ex] ~=~& \tfrac 12 {f_X(-\tfrac 12y)}~\mathbf 1_{-1<-y/2<0} + {f_X(y+1)}~\mathbf 1_{0<y-1<1} \\[2ex] ~=~&\tfrac 1 4~\mathbf 1_{0<y<2}+\tfrac 12~\mathbf 1_{1<y<2}  \\[2ex] ~=~&\tfrac 1 4~\mathbf 1_{0<y\leq 1}+\tfrac 34~\mathbf 1_{1< y<2}\end{align}$$
Where $x_1(Y), x_2(Y)$ are the two semi-inverses (the functions that map $Y$ back into the preimage).
A: You are right intuitively, but I think it is not rigorous
how about this
for $[0,1)$, the inverse is $x=-\frac{y}{2}$ with absolute jacobian is $\frac{1}{2}$, hence
\begin{eqnarray*}
f_Y(y)=f_X\left(-\frac{y}{2}\right)\frac{1}{2}=\frac{1}{4}
\end{eqnarray*}
and for $[1,2)$, we get two inverses, that are $x=-\frac{y}{2}$ and $x=y-1$, with their respective absolute jacobians are $\frac{1}{2}$ and $1$, hence
\begin{eqnarray*}
f_Y(y)=f_X\left(-\frac{y}{2}\right)\frac{1}{2}+f_X(y-1)1=\frac{3}{4}
\end{eqnarray*}
why i used $+$? because when $y\in[1,2)$, then $y$ is $-2x$ OR $x+1$
