CDF of the distance of two random points on (0,1) Let $Y_1 \sim U(0,1)$ and $Y_2 \sim U(0,1)$.
Let $X = |Y_1 - Y_2|$.
Now the solution for the CDF in my book looks like this:
$P(X < t) = P(|Y_1 - Y_2| < t) = P(Y_2 - t < Y_1 < Y_2 + t) = 1-(1-t)^2$
They give this result without explanation. How do they come up with the $1-(1-t)^2$ part? Can you help me find the explanation?
 A: Draw a picture.  In the $y_1 y_2$ plane, the region where $|y_1 - y_2| < t$ (where $0 < t < 1$) looks like this:

What is its area?
A: I want to change notation. Call the  random variable called $Y_1$ in the problem by the name $X$. Call the random variable called $Y_2$ in the problem by the name $Y$. And finally, call the random variable called $X$ in
 the problem by the name $T$. Trust me, these name changes are a good idea! 
We need to assume that $X$ and $Y$ are independent. 
Fix $t$ between $0$ and $1$. In the usual coordinate plane, draw the square with corners $(0,0)$, $(1,0)$, $(1,1)$, and $(0,1)$. Now draw the two lines $y=x+t$ and $y=x-t$. By independence, the joint distribution of $(X,Y)$ is uniform in our square.
Draw the lines $y=x-t$ and $y=x+t$. You know well what these look like. Remember that $0\le t \le 1$ when drawing the lines. For a nice picture, you could for example pick $t$ around $\frac{1}{3}$. (Without drawing a picture, you are unlikely to understand what is really going on.)
Note that $T\le t$ if and only if $|X-Y|\le t$ if and only if the pair $(X,Y)$ lands between our two lines. The probability that this happens is the area of the region between the two lines, divided by the area of the whole square, which is $1$. So we need to find the area of the region between the two lines.
Now we find that area.  The part of the square which is outside our region consists of two isosceles right-angled triangles. Each of these triangles has legs $1-t$, so together they make up a $(1-t)\times (1-t)$ square, with area $(1-t)^2$. 
Thus the area of the region between the two lines is $1-(1-t)^2$. 
A: Note that $P[-t<Y_1-Y_2<t]=P[(Y_1,Y_2)\in A]$ where $A=\{(y_1,y_2)|-t<y_1-y_2<t\}$.
Again note that $P[(Y_1,Y_2)\in A]=\text{Area of A}=1-(1-t)^2$. You need to draw a graph and need to find the area of A.
