The distance between two numbers will be set as $\ | i - j | $ . I pick two numbers without replacement from $\ 0,1,2, \dots ,n $ let $\ X $ be the distance between the numbers. What is the expectancy of $\ X $ ?
there are $\ {n+1 \choose 2} $ options. so $\ {n+1 \choose 2} = \frac{n(n+1)}{2} $ and the probability will be $$\ P\{X = i\} = \frac{2(n+1-i)}{n(n+1)}$$
Then the expectancy $$\ E[X] = \sum_{i=1}^n x_i \cdot p(x_i) = \sum_{i=1}^n x_i \frac{2(n+1-i)}{n(n+1)} $$
I don't really know how to proceed from here?