[Math] Absolute difference of two Uniform random variables.

probabilityprobability distributionstransformation

Let $X$ and $Y$ be two independent random variables following a uniform distribution $[0,5]$
Determine $P(|X-Y| \leq 1).$

What i tried:

$f_{x}(x) = \begin{cases}
\frac{1}{5}, & \text{0}\leq x \leq\text{5} \\
0, & \text{otherwise}
\end{cases}$

$f_{y}(y) = \begin{cases}
\frac{1}{5}, & \text{0}\leq y \leq\text{5} \\
0, & \text{otherwise}
\end{cases}$

Sine $X$ and $Y$ are independent , we can get the joint distribution $f_{xy}(x,y)=f_{x}(x)f_{y}(y)$

Hence :

$f_{xy}(x.y) = \begin{cases}
\frac{1}{25}, & \text{0}\leq x \leq\text{5} & \text{0}\leq y \leq\text{5} \\
0, & \text{otherwise}
\end{cases}$

$P(|X−Y|≤1)=P(-1<X−Y≤1)=P(X-Y \leq1)-P(X-Y\leq-1)$.

$P(X-Y\leq1)=P(X\leq1+Y)=1-P(X\geq1+Y=1-\int_{1}^{4}\int_{0}^{x-1}\frac{1}{25}dydx =\frac{17}{25}$

Similarly :

$P(X-Y\leq-1)=P(X\leq Y-1)=\int_{1}^{4}\int_{x+1}^{5}\frac{1}{25}dydx=\frac{9}{50}.$

Then $P(|X−Y|≤1)=\frac{17}{25}-\frac{9}{50}=\frac{1}{2}$

However the right answer seems to be $\frac{1}{5}$

What am i doing wrong?

Best Answer

There are two errors in your calculations. One is that you incorrectly evaluated the first integral, which comes out as $1-\frac9{50}$, since by symmetry it must be the complement of the other integral. The other one is that the integrals over $x$ should be over $[1,5]$, not $[1,4]$. If you fix these mistakes, you arrive at $\frac9{25}$, the solution that was already discussed in the comments.