Given a rectangle of sides A and B, two points are picked at random, independently and uniformly with respect to area.
geometry/points.in.rectangle New
New entry, edited from material collected for the archive and not yet in a released version.
Problem
Given a rectangle of sides A and B, two points are picked at random, independently and uniformly with respect to area. What is the expected distance between these two points? -- Krishna <ins_aajk@jhunix.UUCP>
Show solution
In article <19484@cca.CCA.COM> g-rh@CCA.CCA.COM.UUCP (Richard Harter)
writes:
) E(d) = 4*I_0_to_1 I_0_to_1 sqrt(A^2*x^2 +B^2*y^2)*(1-x)*(1-y)*dxdy
)
) This is the sort of thing that macsyma was invented for -- why doesn't
) somebody with access to it run it through and post the answer.
Getting Macsyma to solve this turned out to be a major effort, and
reducing the result to something that fits on a screen was another
major effort (undoubtedly also because of insufficient familiarity on
my part with the possibilities of Macsyma). Anyway, here is the
result.
Let D(A,B) be the average distance as a function of A and B. Then
D(A,B) = A*f(B/A), where f(t) = h(t) + t*h(1/t), where
2 2
5 t asinh(t) + sqrt(t + 1) (3 t - 2) + 2
h(t) = ------------------------------------------ .
2
30 t
Note that asinh(t) = log(t + sqrt(t^2+1)). The presentation of f in
terms of h makes it obvious that f(1/t) = f(t)/t; do not assign
geometrical significance to the auxiliary function h, as I just chose
the simplest function among several that would do here.
For t --> 0, h(t) = 7/30 + o(t), and for t --> inf, h(t) = t/10 + o(1),
so that we have
f(t) = 1/3 + o(t) for t --> 0,
f(t) = t/3 + o(1) for t --> inf.
For the unit square we find
D(1,1) = f(1) = (2+sqrt(2)+log(41+29*sqrt(2)))/15 =~ 0.52140543316472.
A reasonable approximating formula (error less than 5.2 %) is
D(A,B) ~~ 0.351 * sqrt(A^2+B^2);
Perhaps there is a still simpler presentation of the result, for
example by putting t = tan(phi); I did not look into this. I vaguely
remember something about asinh(tan(phi)) and the Gudermannian
function, but I do not have my Abramowitz & Stegun at hand, and gd is
a pretty esoteric function anyway.
-- Lambert Meertens <lambert@cwi.nl>