CDF of absolute value of difference in random variables Let $X$ and $Y$ be independent random variables, uniformly distributed in the interval $[0,1]$. Find the CDF and the PDF of $|X - Y|$?
Attempt
Let $Z = |X - Y|$, so for $z \geq 0$, the CDF $F_{Z}(z) = \mathbf{P}(Z \leq z) = \mathbf{P}(|X - Y| \leq z) = \mathbf{P}(-z \leq X - Y \leq z)$, which is where the algebra becomes confusing. Since they are independent, the joint pdf of $X$ & $Y$ is simply 1, as long as $(X,Y)$ belong to the unit square.
The solution suggests a plot the event of interest as a subset of the unit square and find its area. Any hints?

The area of the square that is between the two lines is the probability of the event $\{|X-Y|\le t\}$ for $0\le t\le 1$ ($t=0.5$ in the graph).

The area of the two triangles is the same and the area of one triangle is $(1-t)^2/2$. Hence, the area of the square that is between the two lines is given by $1-2\cdot (1-t)^2/2=1-(1-t)^2$ and the probability
$$
\Pr\{|X-Y|\le t\}=1-(1-t)^2
$$
for $0\le t\le 1$.
