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.

  • $\begingroup$ The answer is indeed $3/4$. Your second method seems to involve finding the probability density function of $X-Y$. The assertion is implicitly made that $X-Y$ has uniform distribution on $[-1,1]$. It doesn't. $\endgroup$ – André Nicolas Nov 3 '15 at 20:42

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}


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

in that same interval.

  • $\begingroup$ Awesome Brian - looks like I had the right idea but my execution was terribly off. I have one question though, I'm unable to see how you go from here: $P(X−z<Y<X+z)$ to the following line. Could you expand on that a little bit? $\endgroup$ – Louis93 Nov 3 '15 at 21:05
  • $\begingroup$ Yes, I'll do so in a comment here: $Y$ generally has a range of $2z$ (from $X-z$ to $X+z$), so that accounts for the first integral. However, when $X$ is close to $0$, then the range is clipped at the bottom end (because $Y \geq 0$)—that accounts for the subtracted second integral—and when $X$ is close to $1$, the range is clipped at the top end (because $Y \leq 1$)—that accounts for the subtracted third integral. Does that help? $\endgroup$ – Brian Tung Nov 4 '15 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.