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

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

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.

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}.$$

Well, the average of the distances is the sum of the distances of all segments between consecutive points, all divided by the number of points taken. But as you are considering the distances of consecutive points, these distances add up to the distance between the extremes, so this can simplify the calculation, as you only need to find the expected distance between the first and the last points

Let us not go for a finite straight line but for a circle.

Instead of choosing $$n$$ points at random we now go for choosing $$n+1$$ points at random on the circumference of the circle.

By symmetry the arc-lenths have equal distribution making it immediately clear that the average of the length of the arc between $$2$$ consecutive chosen points is: $$\frac1{n+1}\times\text{ length of circumference}$$

But (e.g) the first point that is chosen can be used afterwards as the spot where we "cut the circle open" in order to "bow" it into a finite straight line.

In that sense choosing $$n$$ random points on a finite straight line comes to the same as choosing $$n+1$$ points on the circumference of a circle. The second situation is more handsome here because it makes possible to use symmetry.