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.
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 ,[ 1]
E
[
‖
x
−
y
‖
]
=
1
λ
(
S
)
2
∫
S
∫
S
‖
x
−
y
‖
d
λ
(
x
)
d
λ
(
y
)
{\displaystyle \mathbb {E} [\|x-y\|]={\frac {1}{\lambda (S)^{2}}}\int _{S}\int _{S}\|x-y\|\,d\lambda (x)\,d\lambda (y)}
where λ is the n -dimensional Lebesgue measure .
For the two-dimensional case, this is defined using the distance formula for two points (x 1 , y 1 ) and (x 2 , y 2 )
1
λ
(
S
)
2
∬
S
∬
S
(
x
1
−
x
2
)
2
+
(
y
1
−
y
2
)
2
d
x
1
d
y
1
d
x
2
d
y
2
.
{\displaystyle {\frac {1}{\lambda (S)^{2}}}\iint _{S}\iint _{S}{\sqrt {(x_{1}-x_{2})^{2}+(y_{1}-y_{2})^{2}}}\,dx_{1}\,dy_{1}\,dx_{2}\,dy_{2}.}
Approximation methods
The Monte Carlo method may be used to approximate the mean line segment length of a given shape. Two points are randomly chosen inside the shape and their distance is measured. After several repetitions of this process, the average of these values will eventually converge to the mean line segment length. This method can only give an approximation; it cannot be used to determine its exact value.
Line segment
For a line segment of length d , the average distance between two points is 1 / 3 d .[ 1]
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[ 2]
4
s
s
a
s
b
s
c
15
[
1
a
3
ln
(
s
s
a
)
+
1
b
3
ln
(
s
s
b
)
+
1
c
3
ln
(
s
s
c
)
]
+
a
+
b
+
c
15
+
(
b
+
c
)
(
b
−
c
)
2
30
a
2
+
(
a
+
c
)
(
a
−
c
)
2
30
b
2
+
(
a
+
b
)
(
a
−
b
)
2
30
c
2
,
{\displaystyle {\frac {4ss_{a}s_{b}s_{c}}{15}}\left[{\frac {1}{a^{3}}}\ln \left({\frac {s}{s_{a}}}\right)+{\frac {1}{b^{3}}}\ln \left({\frac {s}{s_{b}}}\right)+{\frac {1}{c^{3}}}\ln \left({\frac {s}{s_{c}}}\right)\right]+{\frac {a+b+c}{15}}+{\frac {(b+c)(b-c)^{2}}{30a^{2}}}+{\frac {(a+c)(a-c)^{2}}{30b^{2}}}+{\frac {(a+b)(a-b)^{2}}{30c^{2}}},}
where
s
=
(
a
+
b
+
c
)
/
2
{\displaystyle s=(a+b+c)/2}
is the semiperimeter , and
s
i
{\displaystyle s_{i}}
denotes
s
−
i
{\displaystyle s-i}
.
For an equilateral triangle with side length a , this is equal to
(
4
+
3
ln
3
20
)
a
≈
0.364791843
…
a
.
{\displaystyle \left({\frac {4+3\ln 3}{20}}\right)a\approx 0.364791843\ldots a.}
Square and rectangles
The average distance between two points inside a square with side length s is[ 3]
(
2
+
2
+
5
ln
(
1
+
2
)
15
)
s
≈
0.521405433
…
s
.
{\displaystyle \left({\frac {2+{\sqrt {2}}+5\ln(1+{\sqrt {2}})}{15}}\right)s\approx 0.521405433\ldots s.}
More generally, the mean line segment length of a rectangle with side lengths l and w is[ 1]
1
15
[
l
3
w
2
+
w
3
l
2
+
d
(
3
−
l
2
w
2
−
w
2
l
2
)
+
5
2
(
w
2
l
ln
(
l
+
d
w
)
+
l
2
w
ln
(
w
+
d
l
)
)
]
{\displaystyle {\frac {1}{15}}\left[{\frac {l^{3}}{w^{2}}}+{\frac {w^{3}}{l^{2}}}+d\left(3-{\frac {l^{2}}{w^{2}}}-{\frac {w^{2}}{l^{2}}}\right)+{\frac {5}{2}}\left({\frac {w^{2}}{l}}\ln \left({\frac {l+d}{w}}\right)+{\frac {l^{2}}{w}}\ln \left({\frac {w+d}{l}}\right)\right)\right]}
where
d
=
l
2
+
w
2
{\displaystyle d={\sqrt {l^{2}+w^{2}}}}
is the length of the rectangle's diagonal.
Cube and hypercubes
The average distance between points inside an n -dimensional unit hypercube is denoted as Δ(n ) , and is given as[ 4]
Δ
(
n
)
=
∫
0
1
⋯
∫
0
1
⏟
2
n
(
x
1
−
y
1
)
2
+
(
x
2
−
y
2
)
2
+
⋯
+
(
x
n
−
y
n
)
2
d
x
1
⋯
d
x
n
d
y
1
⋯
d
y
n
{\displaystyle \Delta (n)=\underbrace {\int _{0}^{1}\cdots \int _{0}^{1}} _{2n}{\sqrt {(x_{1}-y_{1})^{2}+(x_{2}-y_{2})^{2}+\cdots +(x_{n}-y_{n})^{2}}}\,dx_{1}\cdots \,dx_{n}\,dy_{1}\cdots \,dy_{n}}
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,[ 5]
Δ
(
3
)
=
4
+
17
2
−
6
3
−
7
π
105
+
ln
(
1
+
2
)
5
+
2
ln
(
2
+
3
)
5
.
{\displaystyle \Delta (3)={\frac {4+17{\sqrt {2}}-6{\sqrt {3}}-7\pi }{105}}+{\frac {\ln(1+{\sqrt {2}})}{5}}+{\frac {2\ln(2+{\sqrt {3}})}{5}}.}
Its numerical value is approximately 0.661707182... (sequence A073012 in the OEIS )
Andersson et. al. (1976) showed that Δ(n ) satisfies the bounds[ 6]
1
3
n
1
/
2
≤
Δ
(
n
)
≤
(
1
6
n
)
1
/
2
1
3
[
1
+
2
(
1
−
3
5
n
)
1
/
2
]
.
{\displaystyle {\tfrac {1}{3}}n^{1/2}\leq \Delta (n)\leq ({\tfrac {1}{6}}n)^{1/2}{\sqrt {{\frac {1}{3}}\left[1+2\left(1-{\frac {3}{5n}}\right)^{1/2}\right]}}.}
Circle
The average distance between points on the circumference of a circle of radius r is[ 7]
4
π
r
≈
1.273239544
…
r
{\displaystyle {\frac {4}{\pi }}r\approx 1.273239544\ldots r}
Disk and balls
The average distance between points inside a disk of radius r is[ 8]
128
45
π
r
≈
0.905414787
…
r
.
{\displaystyle {\frac {128}{45\pi }}r\approx 0.905414787\ldots r.}
For a three-dimensional ball , this is
36
35
r
≈
1.028571428
…
r
.
{\displaystyle {\frac {36}{35}}r\approx 1.028571428\ldots r.}
More generally, the mean line segment length of an n -ball is[ 1]
2
n
2
n
+
1
β
n
r
{\displaystyle {\frac {2n}{2n+1}}\beta _{n}r}
where βn depends on the parity of n ,
β
n
=
{
2
3
n
+
1
(
n
/
2
)
!
2
n
!
(
n
+
1
)
(
2
n
)
!
π
(
for even
n
)
2
n
+
1
n
!
3
(
n
+
1
)
(
(
n
−
1
)
/
2
)
!
2
(
2
n
)
!
(
for odd
n
)
{\displaystyle \beta _{n}={\begin{cases}{\dfrac {2^{3n+1}\,(n/2)!^{2}\,n!}{(n+1)\,(2n)!\,\pi }}&({\text{for even }}n)\\{\dfrac {2^{n+1}\,n!^{3}}{(n+1)\,((n-1)/2)!^{2}\,(2n)!}}&({\text{for odd }}n)\end{cases}}}
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[ 1]
L
≤
2
n
n
+
1
2
n
−
2
Γ
(
n
/
2
)
2
Γ
(
n
−
1
/
2
)
π
{\displaystyle L\leq {\sqrt {\frac {2n}{n+1}}}{\frac {2^{n-2}\Gamma (n/2)^{2}}{\Gamma (n-1/2){\sqrt {\pi }}}}}
where Γ denotes the gamma function . For n = 2, a stronger bound exists.
L
≤
229
800
+
44
75
2
−
3
+
19
480
5
=
0.678442
…
{\displaystyle L\leq {\frac {229}{800}}+{\frac {44}{75}}{\sqrt {2-{\sqrt {3}}}}+{\frac {19}{480}}{\sqrt {5}}=0.678442\ldots }
References
^ a b c d e Burgstaller, Bernhard; Pillichshammer, Friedrich (2009). "The Average Distance Between Two Points" . Bulletin of the Australian Mathematical Society . 80 (3): 353– 359. doi :10.1017/S0004972709000707 .
^ Weisstein, Eric W. "Triangle Line Picking" . MathWorld .
^ Weisstein, Eric W. "Square Line Picking" . MathWorld .
^ Weisstein, Eric W. "Hypercube Line Picking" . MathWorld .
^ Robbins, David P.; Bolis, Theodore S. (1978), "Average distance between two points in a box (solution to elementary problem E2629)", American Mathematical Monthly , 85 (4): 277– 278, doi :10.2307/2321177 , JSTOR 2321177 .
^ Anderssen, R. S.; Brent, R. P.; Daley, D. J.; Moran, P. A. P. (1976). "Concerning
∫
0
1
⋯
∫
0
1
(
x
1
2
+
⋯
+
x
k
2
)
1
/
2
d
x
1
⋯
d
x
k
{\displaystyle \int _{0}^{1}\cdots \int _{0}^{1}(x_{1}^{2}+\cdots +x_{k}^{2})^{1/2}dx_{1}\cdots dx_{k}}
and a Taylor Series Method" (PDF) . SIAM Journal on Applied Mathematics . 30 (1): 22– 30.
^ Weisstein, Eric W. "Circle Line Picking" . MathWorld .
^ Weisstein, Eric W. "Disk Line Picking" . MathWorld .
External links
Weisstein, Eric W. "Mean Line Segment Length" . MathWorld .