Random Variable absolute value distribution (PDF and CDF)

X has a Uniform distribution $U(0,1)$. I have to find the distribution of the variable $U =|X-1/3|$.

This is what i can get so far :

$F(U) \;{= P\{U < u\} \\ = P\{| X-1/3 | < u\} \\ \ddots}$

I know that i shall get something like $P\{-(U-1/3) < X < U -1/3\}$. Could anyone explain how to get the PDF and the CDF for this problem and explain how can i easily change this absolute values for other problems ( other examples $Z=1-|X|,~~G=|X|-1$ etc..).


$U$ takes values in $[0,2/3]$, so we will be done if we compute the CDF $F_U(u)$ for $u \in (0,2/3)$.

Your first steps are good: \begin{align} F_U(u) &= P(U \le u) \\ &= P(|X-1/3| \le u) \\ &= P(1/3 - u \le X \le 1/3+u). \end{align}

Then, recall the definition of the uniform distribution: $P(a \le X \le b) = b-a$ whenever $0 \le a < b \le 1$.

Can you finish? You will need to handle the cases $0 \le u \le 1/3$ and $1/3 \le u \le 2/3$ separately.


when $0\leq u\leq 1/3 $ $$F_U(u)=\int_{1/3~-u}^{1/3~+u}dx=2u,$$ when $1/3 \leq u\leq 2/3$ $$F_U(u)=\int_0^{1/3~+u}dx=1/3~+u$$ Now just calculate the pdf. differentiate the cdf