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?

For fixed $z\in\mathbb{R}$ we have:$$F_Z(z)=P\left(\left|X-Y\right|\leq z\right)=\int\int1_{\left(-\infty,z\right]}\left(\left|x-y\right|\right)f_{X,Y}(x,y)dxdy$$
where $f_{X,Y}(x,y)$ denotes the density of $\langle X,Y\rangle$.
Substituting this density  we arrive at:
$$F_Z(z)=P\left(\left|X-Y\right|\leq z\right)=\int_{0}^{1}\int_{0}^{1}1_{\left(-\infty,z\right]}\left(\left|x-y\right|\right)dxdy$$
Can you work this out?
If the CDF is found then the PDF can be found by differentiating.
