$n$ points at random on line segment, average distance between two consecutive points

contest-mathmultiple integralmultivariable-calculusprobability

I had previously asked the following question from my probability textbook:

If two points be taken at random on a finite straight line their average distance apart will be one third of the line.

See here: Integrating $\int_0^1 \int_0^1 |x-y|\,\text{d}x\,\text{d}y$ by hand

Basically, it boils down to calculating ${\int_0^1 \int_0^1 |x-y|\,\text{d}x\,\text{d}y} = {1\over3}$.

It turns out this question had been asked before a long time ago, see here: Average Distance Between Random Points on a Line Segment

Now, my probability textbook also asks the following generalization:

If $n$ points be taken at random on a finite line the average distance between any two consecutive points will be one $(n+1)$th of the line.

My question is, how do I go about showing this? How should go about generalizing my previous integral of ${\int_0^1 \int_0^1 |x-y|\,\text{d}x\,\text{d}y}$? Any help would be well-appreciated.

Best Answer

Note that (as can be seen by your example with two points), computing this average distance is the same as computing the distance to your set of points to one of the extreme points $0$ or $1$.

Let us for instance compute the average distance to $1$ of the set of points. That is $$ 1 - \mathbb{E}[ \max_{i} X_i], $$ since the closest point to $1$ is the maximum. Now for all $x \in [0,1]$, having the max smaller than $x$ means having all points smaller than $x$, hence $$ \mathbb{P}(\max_i X_i \le x) = \mathbb{P}(X_1 \le x)^n = x^n, $$ so that the density of $\max_i X_i$ is the derivative, i.e. $f(x) = n x^{n-1}$. We can now compute $$ \mathbb{E}[\max_i X_i] = \int_0^1 n x^n dx = \frac{n}{n+1}, $$ and conclude with $$ 1 - \mathbb{E}[\max_i X_i] = \frac{1}{n+1}. $$