Problem:
The points $X$ and $Y$ are independently and uniformly chosen on a segment $[0,a]$. Find the CDF of the distance $D=|X-Y|$.
Solution:
The vector $(X,Y)$ is uniformly distributed in the square $Q=[0,a]$. The event $D<t$ is the same as the event that the point lies in the strip $S$ between the lines $y=x-t$ and $y=x+t$. So that $F_D(t)=\Pr(D\le t)=|S\cap Q|/|Q|=(2at-t^2)/a^2$ if $0\le t<a$ and $1$ if $t\ge a.$
Questions:
- Isn't $Q=[0,a]$ a typo? Since this is not a square, it should be $[0,a]\times[0,a]$ right?
- I need to intuitively see why those two events are the same, that is why $\{D<t\}\Leftrightarrow\{(X=x,Y=y)\in S\}.$
I've drawn a coordinate system with a $Y-$axis and an $X-$axis and marked $a$, $t$ and the chosen coordinates, but how can I myself show that $S$ is that stripe between those two lines?
It is very easy.
first do a drawing representing you situation
The CDF of D is the white area divided by the total area $a^2$...
It is easier to calculate this ara doing the complement
$$F_D(d)=\frac{a^2-(a-d)^2}{a^2}$$
More precisely you CDF is the following
$$ F_D(d) = \begin{cases} 0, & \text{if $d<0$} \\ \frac{a^2-(a-d)^2}{a^2}, & \text{if $0\leq d<a$ } \\ 1, & \text{if $d \geq a$ } \end{cases}$$