Mean line segment length
In geometry, the mean line segment length is the average length of a line segment connecting two points chosen uniformly at random in a given shape. In other words, it is the expected Euclidean distance between two random points, where each point in the shape is equally likely to be chosen. Even for simple shapes such as a square or a triangle, solving for the exact value of their mean line segment lengths can be difficult because their closed-form expressions can get quite complicated. As an example, consider the following question:

 What is the average distance between two randomly chosen points inside a square with side length 1? While the question may seem simple, it has a fairly complicated answer; the exact value for this is . Formal definition 

The mean line segment length for an n-dimensional shape S may formally be defined as the expected Euclidean distance ||⋅|| between two random points x and y,

 

where λ is the n-dimensional Lebesgue measure. For the two-dimensional case, this is defined using the distance formula for two points (x1, y1) and (x2, y2)

Approximation methods 

Since computing the mean line segment length involves calculating multidimensional integrals, various methods for numerical integration can be used to approximate this value for any shape. One such method is the Monte Carlo method. To approximate the mean line segment length of a given shape, two points are randomly chosen in its interior and the distance is measured. After several repetitions of these steps, the average of these distances will eventually converge to the true value. These methods can only give an approximation; they cannot be used to determine its exact value. Formulas

Line segment 

For a line segment of length , the average distance between two points is . Triangle 

For a triangle with side lengths , , and , the average distance between two points in its interior is given by the formula

 

where  is the semiperimeter, and  denotes . For an equilateral triangle with side length a, this is equal to

Square and rectangles 

The average distance between two points inside a square with side length s is

 

More generally, the mean line segment length of a rectangle with side lengths l and w is

 

where  is the length of the rectangle's diagonal. If the two points are instead chosen to be on different sides of the square, the average distance is given by

Cube and hypercubes 

The average distance between points inside an n-dimensional unit hypercube is denoted as , and is given as

 

The first two values,  and , refer to the unit line segment and unit square respectively. For the three-dimensional case, the mean line segment length of a unit cube is also known as Robbins constant, named after David P. Robbins. This constant has a closed form,

 

Its numerical value is approximately  

Andersson et. al. (1976) showed that  satisfies the bounds

 

Choosing points from two different faces of the unit cube also gives a result with a closed form, given by,

Circle and sphere 

The average chord length between points on the circumference of a circle of radius r is

 

And picking points on the surface of a sphere with radius r is

Disks 

The average distance between points inside a disk of radius r is

 

The values for a half disk and quarter disk are also known. For a half disk of radius 1:
 
For a quarter disk of radius 1:

Balls 

For a three-dimensional ball, this is

 

More generally, the mean line segment length of an n-ball is

 

where  depends on the parity of ,

General bounds 

Burgstaller and Pillichshammer (2008) showed that for a compact subset of the n-dimensional Euclidean space with diameter 1, its mean line segment length L satisfies

 

where  denotes the gamma function. For n = 2, a stronger bound exists. References

External links 

Geometry