Mean line segment length

From HandWiki

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 [math]\displaystyle{ \frac{2 + \sqrt{2} + 5 \ln (1 + \sqrt{2})}{15} }[/math].

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,[1]

[math]\displaystyle{ \mathbb E[\|x-y\|]=\frac1{\lambda(S)^2}\int_S \int_S \|x-y\| \,d\lambda(x) \,d\lambda(y) }[/math]

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)

[math]\displaystyle{ \frac1{\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. }[/math]

Approximation methods

100,000 line segments are randomly generated inside a unit square, giving an approximate mean length of 0.5212.
Monte Carlo method to approximate the mean line segment length of a unit square.

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.[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]

[math]\displaystyle{ \frac{4 s s_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}, }[/math]

where [math]\displaystyle{ s = (a+b+c)/2 }[/math] is the semiperimeter, and [math]\displaystyle{ s_i }[/math] denotes [math]\displaystyle{ s-i }[/math].

For an equilateral triangle with side length a, this is equal to

[math]\displaystyle{ \left(\frac{4 + 3 \ln 3}{20}\right)a \approx 0.364791843\ldots a. }[/math]

Square and rectangles

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

[math]\displaystyle{ \left(\frac{2 + \sqrt{2} + 5 \ln (1 + \sqrt{2})}{15}\right) s \approx 0.521405433\ldots s. }[/math]

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

[math]\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] }[/math]

where [math]\displaystyle{ d = \sqrt{l^2 + w^2} }[/math] 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[3][4]

[math]\displaystyle{ \left(\frac{2 + \sqrt{2} + 5 \ln (1 + \sqrt{2})}{9}\right) s \approx 0.869009\ldots s. }[/math]

Cube and hypercubes

The average distance between points inside an n-dimensional unit hypercube is denoted as Δ(n), and is given as[5]

[math]\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 }[/math]

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,[6]

[math]\displaystyle{ \Delta(3) = \frac{4+17\sqrt2-6\sqrt3-7\pi}{105} + \frac{\ln(1+\sqrt2)}{5} + \frac{2\ln(2+\sqrt3)}{5}. }[/math]

Its numerical value is approximately 0.661707182... (sequence A073012 in the OEIS)

Andersson et. al. (1976) showed that Δ(n) satisfies the bounds[7]

[math]\displaystyle{ \tfrac{1}{3} n^{1/2} \le \Delta(n) \le (\tfrac{1}{6} n)^{1/2} \sqrt{\frac{1}{3}\left[1 + 2\left(1 - \frac{3}{5n}\right)^{1/2}\right]}. }[/math]

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

[math]\displaystyle{ \frac{4 + 17\sqrt{2} - 6\sqrt{3} - 7\pi}{75} + \frac{7\ln{(1+\sqrt{2})}}{25} + \frac{14\ln{(2+\sqrt{3})}}{25}. }[/math]

Circle and sphere

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

[math]\displaystyle{ \frac{4}{\pi} r \approx 1.273239544\ldots r }[/math]

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

[math]\displaystyle{ \frac{4}{3} r }[/math]

Disks

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

[math]\displaystyle{ \frac{128}{45\pi}r \approx 0.905414787\ldots r. }[/math]

The values for a half disk and quarter disk are also known.[11]

For a half disk of radius 1:

[math]\displaystyle{ \frac{64}{135}\frac{12\pi-23}{\pi^2} \approx 0.706053409\ldots }[/math]

For a quarter disk of radius 1:

[math]\displaystyle{ \frac{32}{135\pi^2}(6\ln{(2\sqrt{2}-2)}-94\sqrt{2}+48\pi+3) \approx 0.473877262\ldots }[/math]

Balls

For a three-dimensional ball, this is

[math]\displaystyle{ \frac{36}{35}r \approx 1.028571428\ldots r. }[/math]

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

[math]\displaystyle{ \frac{2n}{2n+1}\beta_n r }[/math]

where βn depends on the parity of n,

[math]\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} }[/math]

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]

[math]\displaystyle{ L \le \sqrt{\frac{2n}{n+1}} \frac{2^{n-2} \Gamma(n/2)^2}{\Gamma(n - 1/2) \sqrt{\pi}} }[/math]

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

[math]\displaystyle{ L \le \frac{229}{800} + \frac{44}{75}\sqrt{2 - \sqrt{3}} + \frac{19}{480}\sqrt{5} = 0.678442\ldots }[/math]

References

  1. 1.0 1.1 1.2 1.3 1.4 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. 
  2. Weisstein, Eric W.. "Triangle Line Picking". http://mathworld.wolfram.com/TriangleLinePicking.html. 
  3. 3.0 3.1 Weisstein, Eric W.. "Square Line Picking". http://mathworld.wolfram.com/SquareLinePicking.html. 
  4. 4.0 4.1 Bailey, David H.; Borwein, Jonathan M.; Kapoor, Vishaal; Weisstein, Eric W. (2006). "Ten Problems in Experimental Mathematics". The American Mathematical Monthly 113 (6): 481–509. doi:10.2307/27641975. ISSN 0002-9890. https://www.jstor.org/stable/27641975. 
  5. Weisstein, Eric W.. "Hypercube Line Picking". http://mathworld.wolfram.com/HypercubeLinePicking.html. 
  6. 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 .
  7. Anderssen, R. S.; Brent, R. P.; Daley, D. J.; Moran, P. A. P. (1976). "Concerning [math]\displaystyle{ \int_0^1 \cdots \int_0^1 (x_1^2 + \cdots + x_k^2)^{1/2} dx_1 \cdots dx_k }[/math] and a Taylor Series Method". SIAM Journal on Applied Mathematics 30 (1): 22–30. doi:10.1137/0130003. https://maths-people.anu.edu.au/~brent/pd/rpb033.pdf. 
  8. Weisstein, Eric W.. "Circle Line Picking". http://mathworld.wolfram.com/CircleLinePicking.html. 
  9. Weisstein, Eric W.. "Sphere Line Picking". http://mathworld.wolfram.com/SphereLinePicking.html. 
  10. Weisstein, Eric W.. "Disk Line Picking". http://mathworld.wolfram.com/DiskLinePicking.html. 
  11. Weisstein, Eric W.. "Circular Sector Line Picking". http://mathworld.wolfram.com/CircularSectorLinePicking.html. 

External links