[Math] Probability of difference of random variables

probabilityuniform distribution

How can I compute this probability? I do not know what to do since it involves two random variables.

Let $X$ and $Y$ be uniform random variables on $(0,1)$. How can I compute this?

$$
P(|X-Y| < 0.25).
$$

I tried to do it using an integral
$$
\int_0^1 P(|X-y| < 0.25) \,dy
$$

but I do not know what to do next.

edit: I forgot to mention the independence of the random variables. Thanks for warning.

Best Answer

Hint: In order to compute an answer, you will have to make an assumption. One natural one is that $X$ and $Y$ are independent. Perhaps that was included in the question, and you forgot to mention it. Or perhaps it was (by mistake) left out.

Assuming independence, the pair $(X,Y)$ has uniform distribution on the square. So the joint density function is $1$ in the square, and $0$ outside.

The answer is then $$\iint_A 1\,dy\;dx,$$ where $A$ is the part of the square where $|x-y|<0.25$, or if you wish, $\le 0.25$, it makes no difference to the answer.

We can now do the integration, maybe by expressing our double integral as an iterated integral. But there is a much simpler way to solve the problem. We are integrating $1$ over $A$, so the result is the area of $A$.

Draw the region $A$ carefully. After you do that, you will not find it difficult to find its area. No integration, just basic geometry.

Remark: To see that we need some sort of assumption about $X$ and $Y$, let $X$ be uniformly distributed on $(0,1)$, and let $Y=X$. Then $X$ and $Y$ satisfy the conditions of the problem as stated, but are very much not independent. It is clear that $P(|X-Y|<0.25)=1$.

Related Question