Q:

If $X$~$U(0,1)$, and $Y=2x-4$. What is the density function of Y?

If $X$ is uniformly distributed $\mathcal{U}(0,1)$
, then what is the distribute density function of $Y$?
I thought that if $$fx(x) = 1/(1-0), \; \mbox{for} \; 0<x<1$$
then $$fy(Y=2x-4)=fx((y+4)/2) = 1(1-0), \; \mbox{for} \; -2<(y+4)/2<2$$
Am I right?

A:

No:
The cdf of $2X-4$ is
$$F_{2X-4}(x)=P(2X-4<x)=P\left(X<\frac{x+4}2\right)=
\begin{cases}
0,& \text{ if } x<-4\\
\frac{x+4}2,& \text{ if } -4\le x\le -2\\
1,&\text{ if } x>-2
\end{cases}.$$
The density is
$$f_{2X-4}(x)=\frac{dF_{2X-4}(x)}{dx}=
\begin{cases}
\frac 12,& \text{ if } -4\le x\le -2\\
0,&\text{ otherwise }
\end{cases}.$$

