[Math] Probability of two uniform random variables

probability

x and y are uniformly distributed over the interval [0,1]. Find the probability that |x-y|, the distance between x and y, is less than 0.35.

I tried to graph the function with x being on the x axis, and y being on the y axis. So I would get a square with uniform density and area 1. Then I tried to graph the function |x-y|<.35 and then integrate over that area. I couldn't seem to get the right answer. Any suggestions? thanks

Best Answer

The constrained area is the portion of the unit square between the lines $y=x-0.35$ and $y=x+0.35$ . That's the $\Bbb R^2$ interval: $$\langle x, y\rangle \in [0;1]\times [\max\{0, x-0.35\};\min\{1,x+0.35\}]$$

This can be subdivided into $\langle x,y\rangle\in \left(\substack{\begin{align}\large [0;0.35)&\large\times[0;x+0.35) \\ \large\cup[0.35;0.65)&\large\times[x-0.35;x+0.35) \\\large \cup[0.65;1]&\large\times[x-0.35;1]\end{align}}\right)$

Thus the integral is $$\mathsf P(A) = \int_0^{0.35}\int_0^{x+0.35} \operatorname d y\operatorname d x + \int_{0.35}^{0.65}\int_{x-0.35}^{x+0.35} \operatorname d y\operatorname d x+\int_{0.65}^1\int_{x-0.35}^{1}\operatorname d y\operatorname d x$$


However, its a little easier to evaluate as 1 minus the complement's probability.

$$\mathsf P(A) = 1 - \int_{0}^{0.65}\int_{x+0.35}^{1}\operatorname dy\operatorname dx - \int_{0.35}^1\int_{0}^{x-0.35}\operatorname d y\operatorname d x$$

Which is the unit square minus two triangles of side $0.65$. Why even integrate when you can just use the area of a triangle: $\tfrac 12 BH$?

Related Question