What's the probability of choosing two numbers from $[0,1]$ and having the difference at least one half?

Quick, draw a diagram!

Since the two random variables are independent and uniformly distributed, the answer is clearly $\frac14$.


The geometric approach works well here. If you choose two points uniformly from the interval $[0,1]$, that's the same as choosing a point uniformly from the square with vertices $(0,0), (0,1), (1,0)$ and $(1,1)$. Now, you can graph the lines corresponding to the conditions $y=x+\frac12$ and $y=x-\frac12$. Between those lines are points where the difference between $x$ and $y$ is less than $\frac12$, and outside of them, you find points where the difference is greater. Use geometry to calculate the area inside your square of interest, but not between those two lines. That's your answer, since the total area of the square is $1$.


Note: $$|a-b|>0.5 \Rightarrow a>b+0.5 \ \ \ \text{or} \ \ \ a<b-0.5.$$ Considering $0\le a,b\le 1$ we get: $$\begin{cases} b+0.5<a\le 1 \\ 0\le b<0.5 \end{cases} \ \ \ \text{or} \ \ \ \begin{cases} 0\le a <b-0.5 \\ 0.5<b\le 1\end{cases}.$$ We make up double integrals: $$P=\int_0^{0.5} \int_{b+0.5}^1 \mathrm{d}a \, \mathrm{d}b\color{red}{+}\int_{0.5}^1 \int_0^{b-0.5} \mathrm{d}a \, \mathrm{d}b=$$ $$\int_0^{0.5} (0.5-b)\, \mathrm{d}b \color{red}{+} \int_{0.5}^1 (b-0.5)\, \mathrm{d}b=$$ $$0.25-0.125 \color{red}{+} 0.5-0.125-0.5+0.25=0.25.$$

Tags:

Probability