# Given $n$ uniform random variables, probability no two differ by less than $x$

Given $$n$$ random variables uniformly distributed from $$0$$ to $$1$$, what is the probability that no two differ by less than some $$x$$?

My initial thought was that for $$n$$ random variables there are $$n \choose 2$$ pairings, and the probability that for each given pairing the difference is greater than $$x$$ is given by $$({1-x})^2$$ so then the answer would be $$\Big((1-x)^2\Big)^{n \choose 2}=(1-x)^{n(n-1)}$$. But upon inspection this answer is obviously wrong.

For instance consider the case where $$n=3$$ and $$x>0.5$$. There exist no solution. This should be obvious since if the smallest number and the middle number differ by more than $$x$$ and if the middle number and the largest number differ by more than $$x$$ then that implies the smallest number and the largest number differ by more than $$1$$ which is impossible. But the formula above gives a non zero answer.

What is the correct answer to this question? Any help would be appreciated

• This answer gives a derivation as part of a solution to a related problem. Commented Dec 4, 2023 at 4:51
• Use order statistics: $X_{(1)}, X_{(2)}, \ldots, X_{(n)}$. Then consider the differences of neighboring values: $X_{(2)}-X_{(1)}, X_{(3)}-X_{(2)},\ldots,X_{(n)}-X_{(n-1)}$. The probability of the minimum difference being greater than $x$ is given by $\text{Pr(min difference}>x)=(-n x+x+1)^n$ for $0<x<1/(n-1)$.
– JimB
Commented Dec 4, 2023 at 5:12
• @MathIsFun7225 What an amazing answer, particularly the analogy for interpreting the probability as volumes of hypercubes Commented Dec 4, 2023 at 17:00