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 2+2+5ln(1+2)15.
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,
𝔼[‖x−y‖]=1λ(S)2∫S∫S‖x−y‖dλ(x)dλ(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)
1λ(S)2∬S∬S(x1−x2)2+(y1−y2)2dx1dy1dx2dy2.
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 d, the average distance between two points is 1/3d.
Triangle For a triangle with side lengths a, b, and c, the average distance between two points in its interior is given by the formula
4ssasbsc15[1a3ln(ssa)+1b3ln(ssb)+1c3ln(ssc)]+a+b+c15+(b+c)(b−c)230a2+(a+c)(a−c)230b2+(a+b)(a−b)230c2, where s=(a+b+c)/2 is the semiperimeter, and si denotes s−i. For an equilateral triangle with side length a, this is equal to
(4+3ln320)a≈0.364791843…a.
Square and rectangles The average distance between two points inside a square with side length s is
(2+2+5ln(1+2)15)s≈0.521405433…s. More generally, the mean line segment length of a rectangle with side lengths l and w is
115[l3w2+w3l2+d(3−l2w2−w2l2)+52(w2lln(l+dw)+l2wln(w+dl))] where d=l2+w2 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
(2+2+5ln(1+2)9)s≈0.869009…s.
Cube and hypercubes The average distance between points inside an n-dimensional unit hypercube is denoted as Δ(n), and is given as
Δ(n)=∫01⋯∫01⏟2n(x1−y1)2+(x2−y2)2+⋯+(xn−yn)2dx1⋯dxndy1⋯dyn The first two values, Δ(1) and Δ(2), 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,
Δ(3)=4+172−63−7π105+ln(1+2)5+2ln(2+3)5. Its numerical value is approximately 0.661707182... (sequence A073012 in the OEIS) Andersson et al. (1976) showed that Δ(n) satisfies the bounds
13n1/2≤Δ(n)≤(16n)1/213[1+2(1−35n)1/2]. Choosing points from two different faces of the unit cube also gives a result with a closed form, given by,
4+172−63−7π75+7ln(1+2)25+14ln(2+3)25.
Circle and sphere The average chord length between points on the circumference of a circle of radius r is
4πr≈1.273239544…r And picking points on the surface of a sphere with radius r is
43r
Disks The average distance between points inside a disk of radius r is
12845πr≈0.905414787…r. The values for a half disk and quarter disk are also known. For a half disk of radius 1:
6413512π−23π2≈0.706053409… For a quarter disk of radius 1:
32135π2(6ln(22−2)−942+48π+3)≈0.473877262…
Balls For a three-dimensional ball, this is
3635r≈1.028571428…r. More generally, the mean line segment length of an n-ball is
2n2n+1βnr where βn depends on the parity of n,
βn={23n+1(n/2)!2n!(n+1)(2n)!π(for even n)2n+1n!3(n+1)((n−1)/2)!2(2n)!(for odd n)
Polyhedra Beck (2023) found that mean distance between two random points inside any given polyhedron can be expressed in elementary functions. The same is true for all moments of the distance. He also found closed-form expressions for the mean line segment lengths of all regular polyhedra. The average distance between two points in a regular tetrahedron with unit volume is
33(27−37π315+415arctan2+113ln32102)≈0.72946242… The average distance between two points in a regular octahedron with unit volume is
343(4105+132105−4π45+109ln36302+16arccot2315+158arccoth23152)≈0.65853073… The average distance between two points in a regular icosahedron with unit volume is approximately 0.64131248551. The average distance between two points in a regular dodecahedron with unit volume is approximately 0.65853073.
General bounds Burgstaller and Pillichshammer (2009) showed that for a compact subset of the n-dimensional Euclidean space with diameter 1, its mean line segment length L satisfies
L≤2nn+12n−2Γ(n/2)2Γ(n−1/2)π where Γ denotes the gamma function. For n = 2, a stronger bound exists.
L≤229800+44752−3+194805=0.678442…
References
External links Weisstein, Eric W. "Mean Line Segment Length". MathWorld.
