# Old GRE probability question

Let $x$ and $y$ be uniformly distributed, independent random variables on $[0,1]$. What is the probability that the distance between $x$ and $y$ is less than $1/2$?

My continuous probability knowledge is very slim. I know that $P(x\leq \frac{1}{2})=\frac{1}{2}$, but I don't know how to work in the $y$. I would like to see an answer involving integrals, even if its not necessary, so I can try I pick up some of this continuous probability stuff.

• Draw a picture of the locus where $|x-y|<1/2$. You don't need integrals if you remember basic geometry. Commented Jul 15, 2017 at 16:07
• (You've edited to ask for answers involving integrals. To calculate $\mathbb{P}[(x,y)\in A]$ you compute $\int_A f(x,y)$, where $f$ is the joint pdf of $X$ and $Y$. So you still need to consider the region $A$, the set of points satisfying $|x-y|<1/2$, to set up the limits of integration.) Commented Jul 15, 2017 at 16:18
• Is the joint pdf of $x$ and $y$ just the pdf of the uniform distribution? Commented Jul 15, 2017 at 16:20
• By independence, the joint pdf $f_{X, Y}(x,y)$ factors into the product of the univariate pdfs, $f_X(x)$ and $f_Y(y)$. What are the univariate pdfs here? Commented Jul 15, 2017 at 16:23
• It is just 1 right? Commented Jul 15, 2017 at 16:37

It helps if you plot the support, X on the x-axis, Y on the y-axis. The support is $[0,1]\times[0,1]$.
$P(|X-Y|<1/2)$ is the area between the line $y=x-1/2$ and $y=x+1/2$ in the unit square. For independent uniform, you could use geometry. For other distributions, you'll have to integrate.