# Spacings between continuous uniform random variables

Let $$U_1, \cdots, U_n$$ be $$n$$ i.i.d continuous uniform random variables on $$(0,1)$$ and their order statistics be $$U_{(1)}, \cdots, U_{(n)}$$.

Define $$D_i=U_{(i)}−U_{(i−1)}$$ for $$i=1, \cdots, n$$ with $$U_0=0$$.

I am trying to figure out the distribution $$\lim_{n\to\infty} \#\{i = 1, \cdots, n \mid nD_i \geq z\}/n$$. This must be very well known, but I cannot find a reference.

As I understand correctly: $$\#\{i=1,...,n | nD_i\geq z\}$$ means the number of cases which satisfy condition $$nD_i\geq z$$. If so:

The limiting distribution of $$n\cdot min(U_1,...,U_n)$$ has an expotential distribution with parameter $$\lambda = 1$$. See proof here.

Conditionally, given $$U_1$$, we can calculate distribution of second variable correcting for $$U_1$$, so the distance [0-1] was the same: $$((n-1)\cdot min(U_2,...,U_n)-U_1)\cdot(1-U_1) | U_1$$ The result would be the same. We have $$n-1$$ random variables uniformly distributed at range [0-1], but in infinity $$n$$ and $$n-1$$ are the same. And this holds for every $$U_1$$, so we can infer, that unconditionally, no matter the randomisation, distance between first and second variable has also expotential distribution with parameter $$\lambda = 1$$. Now this way we can calculate recursively, that every spacing between two consecutive variables has same distribution as the minimal random variable.

If we define variables $$Z_1,...,Z_n$$ which are equal to $$1$$ if the difference would be greater or equal than $$z$$ and $$0$$ otherwise.

From expotential distribution we know that:

$$P(nD_i\geq z) = e^{-z} = E(Z_i)$$

and i guess this is it, because when limiting with $$n \rightarrow \infty$$, what actually is defined is expected value.

If looking for the distribution of such cases when $$n$$ is not going to infinity, we would need to use Central Limit Theorem. Calculate variance and expectation of $$Z_i$$ which is simple, and use CLT with $$n$$, $$Var({Z_i})$$ and $$E(Z_i)$$.

Some R codes showing the same with RNG:

#Distribution of D_i
n = 10000000
vec = diff(sort(c(runif(n),0)))*n
mean(vec)
var(vec)
hist(vec, freq=F)

#Distribution of Z_i for finite n
library(tseries)
rep = 10000
n = 100
z = 0.5
dist = c()

for(i in 1:rep){
vec = diff(sort(c(runif(n),0)))*n
dist = c(dist,sum(vec>z))
}
dist=dist/n
mean(dist)
var(dist)^0.5
hist(dist, breaks=30)
jarque.bera.test(dist)