# Expectation related to the span of a uniform sample

Suppose $X_1,X_2,\ldots,$ is a sequence of independent random variables with uniform distribution on unit interval $(0,1)$. Let $N=\min\{n>0\mid X_{(n)}-X_{(1)}>\alpha\}$ where $0<\alpha<1$. How can find $\mathbb{E}(N)$? Note: $X_{(1)},X_{(n)}$ are the smallest and the largest order statistics elements of the sequence $X_1,X_2,\ldots,$ and $\alpha$ is fixed.

-
Presumably $X_{(n)}$ and $X_{(1)}$ stand for the smallest and the largest element of the sequence $X_1,X_2,\ldots,X_n$? – Sasha Mar 9 '12 at 16:15
Is $\alpha$ fixed, or do you just want $X_n-X_1>0$? Because if $\alpha$ is fixed, then the expected value is infinite (since if $X_1>1-\alpha$, $X_n-X_1>\alpha$ means $X_n>1$.) But if $\alpha$ is not fixed, it is unclear what it is doing in problem. – Thomas Andrews Mar 9 '12 at 16:27
The answer is $\mathrm E(N_\alpha)=2/(1-\alpha)$. – Did Mar 9 '12 at 18:24
@DidierPiau I have added my solution with derivation of the result you posted in the comment above. Would appreciate any comments. Thanks. – Sasha Mar 10 '12 at 4:32

The joint probability density function for $(X_{(1)}, X_{(n)})$ is well known: $$f_{X_{(1)}, X_{(n)}}(x,y) = (y-x)^{n-2} n(n-1) \cdot [ 0 < x \leqslant y <1]$$ The probability of the event $N_\alpha = n$ can be computed as probability that $X_{(n)}-X_{(1)} < \alpha$, but addition new uniform variable makes it greater than $\alpha$: $$\mathbb{P}(N_\alpha = n+1) = \mathbb{P}\left( X_{(n)} - X_{(1)}<\alpha, \max(U, X_{(n)}) - \min(U, X_{(1)}) > \alpha \right)$$ Transcribing into the integral: $$\begin{eqnarray} \mathbb{P}(N_\alpha = n+1) &=& n(n-1) \int_0^1 \mathrm{d} u \int_0^1 \mathrm{d} y \int_0^y \mathrm{d} x (y-x)^{n-2} [ y-x < \alpha \land (y-u > \alpha \lor u - x > \alpha) ] \end{eqnarray}$$

I used Mathematica to evaluate the probability:

In[60]:= Integrate[
n (n - 1) (y - x)^(n - 2) Boole[
y - x < al && (u - x > al || y - u > al)], {u, 0, 1}, {y, 0,
1}, {x, 0, y}, Assumptions -> 0 < al < 1 && n >= 2]

Out[60]= (-1 + al)^2 al^(-1 + n) n


That is $$\mathbb{P}(N_\alpha = n) = (n-1) \left(1-\alpha\right)^2 \alpha^{n-2}$$ The expectation is then $$\mathbb{E}(N_\alpha) = \sum_{n=1}^\infty n \cdot (n-1) \left(1-\alpha\right)^2 \alpha^{n-2} = \left(1-\alpha\right)^2 \frac{\mathrm{d}^2}{\mathrm{d} \alpha^2} \frac{1}{1-\alpha} = \frac{2}{1-\alpha}$$

-