Two numbers are independently picked from [0,1], what's the probability that the two picks differ by less than 0.5?

625 Views Asked by At

So using a graphical method, mapping the two sample spaces along X and Y axes in a unit square, I graphically calculate the area relevant to this probability to be $\frac{3}{4}$

But, using the Random Variable $X$ where the events are the differences between the two picks (min difference is $0-1=-1$ and similarly max is $1$)

This yields a Probability Density Function where there is a horizontal line of magnitude $\frac{1}{b-a} = \frac{1}{2}$ over $[-1,1]$ but is $0$ elsewhere.

Now taking the integral over $[-0.5,0.5]$ to find $P[-0.5 <= x < 0.5]$ yields $\frac{1}{2}$

Why is this? I believe that there is an incorrect of the $PDF$ somewhere.

1

There are 1 best solutions below

2
On BEST ANSWER

If I understand your post correctly, your PDF is incorrect. The PDF of the (absolute value) difference $Z$ between two variables $X$ and $Y$, both uniformly drawn from the interval $[0, 1]$, is in fact

$$ f_Z(z) = \begin{cases} 2-2z & 0 \leq z \leq 1 \\ 0 & \text{otherwise} \end{cases} $$

This can be obtained as follows: The CDF (cumulative distribution function) of $Z$ for $0 < z < 1$ is

\begin{align} F_Z(z) & = P(Z < z) \\ & = P(X-z < Y < X+z) \\ & = \int_{x=0}^1 2z \, dx - \int_{x=0}^z (z-x) \, dx - \int_{x=1-z}^1 (z-1+x) \, dx \\ & = 2z-\left(z^2-\frac{z^2}{2}\right)-\left(z^2-z+z-\frac{z^2}{2}\right) \\ & = 2z-z^2 \end{align}

so

$$ f_Z(z) = \frac{d}{dz} F_Z(z) = 2-2z $$

in that same interval.