Chapter 172
A Triangle, A Tetrahedron, And A Circle’s Centre
Riddler Express
Choose three points on a circle uniformly at random and connect them to form a triangle. What is the probability that the centre of the circle lies inside that triangle?
The Riddler, FiveThirtyEight, January 12, 2018(original post)
Solution
The idea. A triangle with all three vertices on a circle contains the centre if and only if no semicircle bounded by a diameter of the circle contains all three vertices on the same side. Equivalently, none of the three arcs cut out by the vertices is longer than a semicircle. We use a symmetry that turns the random angular positions into a simple paired-endpoint count.
The pairing argument. Pick the three vertices in two stages: first pick three diameters of the circle uniformly at random, then for each diameter independently flip a fair coin to choose one of its two endpoints. The three vertices so produced are uniform on the circle, and the joint distribution is the same as picking three independent uniform points.
For any fixed choice of three diameters, the eight coin-flip patterns produce eight candidate triangles. Among those eight, exactly one contains the centre. To see this, label the three diameters by their two endpoints , , . The triangle contains if and only if the three vertices are not all on one side of any line through ; among the eight sign patterns one always achieves this and its antipode (flipping all three signs) gives the same triangle reflected through . The eight patterns split into four geometric triangles (each pattern and its sign-flipped twin produce the same triangle), of which exactly one encloses .
So conditional on the three diameters, the probability is ; since this holds for every choice of diameters, the answer is
(A second route: with three vertices on the circle at angles on the circumference, the triangle contains iff every arc between consecutive vertices is less than half the circle. Sort the three angles; the three arc lengths are with on a unit-circumference circle, uniformly distributed over the simplex. The triangle contains iff , and by inclusion-exclusion that probability is .)
The computation
Encode the actual experiment: sample three uniform angles on the unit circle, build the triangle, and check whether the origin lies inside it.
Sample three angles uniformly on .
Sort them and compute the three arc gaps.
Count the trial as a success if the largest gap is less than .
import numpy as np
rng = np.random.default_rng(0)
N = 200_000
theta = np.sort(rng.random((N, 3)) * 2 * np.pi, axis=1)
gaps = np.diff(theta, axis=1)
wrap = 2 * np.pi - (theta[:, 2] - theta[:, 0])
max_gap = np.maximum.reduce([gaps[:, 0], gaps[:, 1], wrap])
print((max_gap < np.pi).mean()) # ~0.25
The script prints over trials, confirming the boxed answer.
Riddler Classic
Choose four points uniformly at random on the surface of a sphere. What is the probability that the tetrahedron with those four points as vertices contains the centre of the sphere?
The Riddler, FiveThirtyEight, January 12, 2018(original post)
Solution
The same pairing argument as the Express, one dimension up.
Setup. Sample four vertices on the unit sphere by picking four diameters of the sphere uniformly at random and then, independently for each, flipping a fair coin to choose one of the two endpoints. The vertices so produced are uniform on the sphere.
For any fixed choice of four diameters, the coin-flip patterns produce candidate tetrahedra. Among these , exactly one contains the centre . The argument is the same flag-of-half-spaces argument as before: the tetrahedron contains iff there is no half-space through containing all four vertices on its side; for each choice of diameters, exactly one assignment of endpoint signs leaves strictly inside, and the antipodal sign-flip produces the same tetrahedron reflected. The patterns split into tetrahedra (each pattern and its antipode are the same shape), exactly one of which contains .
Hence conditional on the diameter choice, the probability is , and since this holds for every choice of diameters,
(In dimension , the probability that the simplex on uniformly random points on contains the centre is . This is Wendel’s theorem; the and cases are the Express and Classic of this column.)
The computation
Sample four uniform points on the unit sphere, then test whether the origin lies inside the tetrahedron they span. The origin is inside iff there exist barycentric weights summing to with ; equivalently, solving the linear system and checking for all .
Sample standard-normal vectors and normalise to get four points per trial.
For each trial, solve the system above for the barycentric weights.
Count the trial a success if all four weights are non-negative.
import numpy as np
rng = np.random.default_rng(0)
N = 100_000
v = rng.standard_normal((N, 4, 3))
v /= np.linalg.norm(v, axis=2, keepdims=True)
M = np.concatenate([v.transpose(0, 2, 1),
np.ones((N, 1, 4))], axis=1)
rhs = np.broadcast_to(np.array([0, 0, 0, 1.0]),
(N, 4))[..., None]
w = np.linalg.solve(M, rhs)[..., 0]
print((w >= 0).all(axis=1).mean()) # ~0.125
The script prints over trials, confirming the boxed answer.