# Mean line segment length

(Redirected from Robbins constant)

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 ${\displaystyle {\frac {2+{\sqrt {2}}+5\ln(1+{\sqrt {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,[1]

${\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 (x1, y1) and (x2, y2)

${\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

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]

${\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 ${\displaystyle s=(a+b+c)/2}$ is the semiperimeter, and ${\displaystyle s_{i}}$ denotes ${\displaystyle s-i}$.

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

${\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]

${\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]

${\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 ${\displaystyle d={\sqrt {l^{2}+w^{2}}}}$ 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]

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

### Cube and hypercubes

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

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

${\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[7]

${\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]}}.}$

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

${\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}}.}$

### Circle

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

${\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[9]

${\displaystyle {\frac {128}{45\pi }}r\approx 0.905414787\ldots r.}$

For a three-dimensional ball, this is

${\displaystyle {\frac {36}{35}}r\approx 1.028571428\ldots r.}$

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

${\displaystyle {\frac {2n}{2n+1}}\beta _{n}r}$

where βn depends on the parity of 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]

${\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.

${\displaystyle L\leq {\frac {229}{800}}+{\frac {44}{75}}{\sqrt {2-{\sqrt {3}}}}+{\frac {19}{480}}{\sqrt {5}}=0.678442\ldots }$

## References

1. 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. ^
3. ^ a b
4. ^ a b 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.
5. ^
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, JSTOR 2321177.
7. ^ Anderssen, R. S.; Brent, R. P.; Daley, D. J.; Moran, P. A. P. (1976). "Concerning ${\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.
8. ^
9. ^