Three points on the circumference of a circle are chosen at random. What is the probability the points are all on the same semicircle?
Four points on the surface of a sphere are chosen at random. What is the probability the points are all on the same hemisphere?
After the first three points are chosen, it's the fourth point that determines whether they all fall in the same hemisphere, as any three points already do.
Consider three great circles, each determined by a pair of the first three points. They form two triangles: the one whose vertices are the three points, and also the antipodal triangle, whose vertices are at the antipodes of the original points. Only if the fourth point lies within this antipodal triangle is it impossible to choose a hemisphere containing all four points, as one of the great circles will otherwise serve as the boundary of such a hemisphere.
The antipodal triangle has the same area as the original triangle, so the probability of not being on the same hemisphere is the area of this triangle divided by the area of the whole sphere (4pi). The probability of being able to fit within one hemisphere is just 1 minus this.
The program chooses three points at random and then computes the probability that the fourth point will be able to be placed in the same hemisphere as these. Then the average of these probabilities is kept over all the trials.
The three points are chosen by the randomization method described in my first post.
DECLARE FUNCTION asin# (x#)
DECLARE FUNCTION acos# (x#)
DEFDBL AZ
DIM SHARED pi
RANDOMIZE TIMER
pi = ATN(1) * 4
DO
FOR i = 1 TO 3
longi(i) = RND(1) * 2 * pi
lat(i) = asin(RND(1) * 2  1)
NEXT
FOR i = 1 TO 3
s1 = i  1: IF s1 < 1 THEN s1 = s1 + 3
s2 = i + 1: IF s2 > 3 THEN s2 = s2  3
dist(i) = acos(SIN(lat(s1)) * SIN(lat(s2)) + COS(lat(s1)) * COS(lat(s2)) * COS(longi(s1)  longi(s2)))
NEXT
FOR i = 1 TO 3
s1 = i  1: IF s1 < 1 THEN s1 = s1 + 3
s2 = i + 1: IF s2 > 3 THEN s2 = s2  3
angle(i) = acos((COS(dist(i))  COS(dist(s1)) * COS(dist(s2))) / (SIN(dist(s1)) * SIN(dist(s2))))
NEXT
area = angle(1) + angle(2) + angle(3)  pi
prob = 1  area / (4 * pi)
tprob = tprob + prob: n = n + 1
PRINT tprob, n, tprob / n
LOOP
FUNCTION acos (x)
acos = pi / 2  asin(x)
END FUNCTION
FUNCTION asin (x)
IF ABS(x) = 1 THEN asin = pi * SGN(x) / 2: EXIT FUNCTION
asin = ATN(x / SQR(1  x * x))
END FUNCTION
The average comes to about 0.875.

Posted by Charlie
on 20091028 13:10:27 