The Wayback Machine - https://web.archive.org/web/20140324112925/http://mathworld.wolfram.com/LineLinePicking.html
Geometry > Points >

Line Line Picking

DOWNLOAD Mathematica Notebook LineLinePicking

Given a unit line segment [0,1], pick two points at random on it. Call the first point x_1 and the second point x_2. Find the distribution of distances d between points. The probability density function for the points being a (positive) distance d apart (i.e., without regard to ordering) is given by

P(d)=(int_0^1int_0^1delta(d-|x_2-x_1|)dx_1dx_2)/(int_0^1int_0^1dx_1dx_2)
(1)
=2(1-d),
(2)

where delta(x) is the delta function. The distribution function is then given by

 D(d)=d(2-d).
(3)

Both are plotted above.

The raw moments are then

mu_m^'=int_0^1d^mP(d)dd
(4)
=2int_0^1d^m(1-d)dd
(5)
=2/((m+1)(m+2))
(6)
={1/((n+1)(2n+1)) for m=2n; 1/((n+1)(2n+3)) for m=2n+1
(7)

(Uspensky 1937, p. 257), giving raw moments

mu_1^'=1/3
(8)
mu_2^'=1/6
(9)
mu_3^'=1/(10)
(10)
mu_4^'=1/(15)
(11)

(Sloane's A000217), which are simply one over the triangular numbers.

The raw moments can also be computed directly without explicit knowledge of the distribution

mu_1^'=(int_0^1int_0^1|x_2-x_1|dx_1dx_2)/(int_0^1int_0^1dx_1dx_2)
(12)
=int_0^1int_0^1|x_2-x_1|dx_1dx_2
(13)
=int_0^1int_0^1; x_2-x_1>0(x_2-x_1)dx_1dx_2+int_0^1int_0^1; x_2-x_1<0(x_1-x_2)dx_1dx_2
(14)
=int_0^1int_(x_1)^1(x_2-x_1)dx_1dx_2+int_0^1int_0^(x_1)(x_2-x_1)dx_1dx_2
(15)
=int_0^1[1/2x_2^2-x_1x_2]_(x_1)^1dx_1+int_0^1[x_1x_2-1/2x_2^2]_0^(x_1)dx_1
(16)
=int_0^1[(1/2-x_1)-(1/2x_1^2-x_1^2)]dx_1+int_0^1[(x_1^2-1/2x_1^2)-(0-0)]dx_1
(17)
=int_0^1(1/2-x_1+x_1^2)dx_1
(18)
=[1/2x_1-1/2x_1^2+1/3x_1^3]_0^1
(19)
=1/3
(20)
mu_2^'=int_0^1int_0^1(|x_2-x_1|)^2dx_2dx_1
(21)
=int_0^1int_0^1(x_2-x_1)^2dx_1dx_2
(22)
=int_0^1int_0^1(x_2^2-2x_1x_2+x_1^2)dx_1dx_2
(23)
=int_0^1[1/3x_2^3-x_1x_2^2+x_1^2x_2]_0^1dx_1
(24)
=int_0^1(1/3-x_1+x_1^2)dx_1
(25)
=[1/3x_1^3-1/2x_1^2+1/3x_1]_0^1
(26)
=1/6.
(27)

The nth central moment is given by

 mu_n=(3^(-(n+2))[2(-1)^n(3n+5)+2^(n+3)])/((n+1)(n+2)).
(28)

The values for n=2, 3, ... are then given by 1/18, 1/135, 1/135, 4/1701, 31/20412, ... (Sloane's A103307 and A103308).

The mean, variance, skewness, and kurtosis excess are therefore

mu=1/3
(29)
sigma^2=1/(18)
(30)
gamma_1=2/5sqrt(2)
(31)
gamma_2=-3/5.
(32)

The probability distribution of the distance between two points randomly picked on a line segment is germane to the problem of determining the access time of computer hard drives. In fact, the average access time for a hard drive is precisely the time required to seek across 1/3 of the tracks (Benedict 1995).

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computable Document Format »

The format that makes Demonstrations (and any information) easy to share and interact with.

STEM initiative »

Programs & resources for educators, schools & students.

Computerbasedmath.org »

Join the initiative for modernizing math education.