Find the distribution of $|X-Y|$ if $X$ and $Y$ are i.i.d. uniform on $[0,1]$

17.9k Views Asked by At

$X$ and $Y$ are independent random variables uniformly distributed over $[0,1]$. I want to find the CDF of $|X-Y|$. I could use convolution but I wan't to calculate this more "directly". Here is my set-up so far:

Let $Z = |X-Y|$. Then, $F_Z(z) = P(Z \leq z) = P(|X-Y| \leq z)$.

We can split up this last inequality into two cases because of the absolute value:

$P(|X-Y| \leq z) = P(X-Y \leq z, X \geq Y) + P(Y-X \leq z, Y > X)$

We now compute the two terms separately with integration. Let's start with the first term:

To integrate this we need to find the correct limits of integration. The constraints we must satisfy are:

  • $0 \leq x,y \leq 1$
  • $x \geq y$
  • $x - z \leq y$

All of this implies $\max\{x-z,0\} \leq y \leq \min\{1,x\}$. But, $x =1$ at most so we can replace $\min\{1,x\}$ with just $x$:

  • $\implies \max\{x-z, 0\} \leq y \leq x$

We use these boundaries to set up the integral of the first term:

$P(X-Y \leq z , X \geq Y) = \int_0^1{\mathrm{d}x \int_{\max\{x-z,0\}}^x{\mathrm{d}y}}$

Should I continue proceeding this way? Is my set up correct? Thank you!