What is the average distance between two points inside the unit square? The picture shows
20 pairs of random points, shown as the endpoints of straight line segments.
Think of
and
as lengths of average intervals in the unit interval and think of two opposite vertices of a rectangle with sides
and
.
Then
and
and hence the average distance should be about
![]()
or a bit less than
.
Here are the results of an experiment with
trials repeated
times:
![]()
Let
be difference in there first coordinates and
the difference in their second coordinates. The larger first coordinate can be chosen anywhere in an interval of length
, and the larger second coordinate can be chosen anywhere in an interval of length
.
The probability of picking a rectangle of this size and shape should be proportional to the area
of the red rectangle.
The distance between the two endpoints is
. The average distance is

We could make this a bit more ugly by taking two points
and
in the unit square and evaluating

See http://mathworld.wolfram.com/SquareTrianglePicking.html for more details.

