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}.$$
A: Hint:
If $X$ is uniformly distributed and $a,b\in\mathbb R$ with $a\neq0$ then $Y:=aX+b$ is also uniformly distributed. This in the meaning that its PDF has a positive constant value on a certain set and takes value $0$ on the complement of that set. 
If you know that the PDF of $Y$ takes constant positive value $c$ on e.g. some interval $(p,q)$ and takes value $0$ otherwise then you can find the determining constant on base of $$1=\int f_Y(y)dy=\int_{(p,q)}cdy=c(q-p)$$
In your case $X$ takes values in $(0,1)$ so that $2X-4$ takes values in $(-4,-2)$ leading to $1=c((-2)-(-4))=2c$ hence $c=\frac12$.
A: For a random variable $ X $ distributed according to the pdf $ p_X $ and a differentiable function $ f $ with positive derivative, you can show that the random variable $ f(X) $ is distributed according to 
$$
p_{f(X)}(y) = \frac{p_X(f^{-1}(y))}{f^\prime(f^{-1}(y))}.
$$
In your case, you have that $ p_X(x) = \chi_{[0, 1]}(x) $ (with $ \chi_{A} $ the indicator function of set $ A $), $ f^{-1}(y) = (y + 4)/2 $ and $ f^\prime(y) = 2 $, hence 
$$
p_{f(X)}(y) = \chi_{[-4, -2]}(y)/2
$$
(since $ \chi_{[0, 1]}((y + 4)/2) = \chi_{[-4, -2]}(y) $).
