Chapter 21
Will You Be A Ghostbuster Or A World Destroyer?
Here are four questions of increasing difficulty about finding sticks in the woods, breaking them, and making shapes.
The Riddler, FiveThirtyEight(original post)
A single idea runs through all four. A triangle exists exactly when no side is at least the sum of the other two, and it is acute exactly when no side squared is at least the sum of the other two squared. In each case the three failure events are disjoint, because whichever side violates the inequality is strictly the largest, so the failure probability is three times one of them.
Problem 1
If you break a stick in two places at random, forming three pieces, what is the probability of being able to form a triangle?
Solution
The pieces sum to , so a triangle forms unless one piece is at least the sum of the other two, that is, unless one piece exceeds . The left piece exceeds only if both break points land in , probability ; by symmetry each piece exceeds with probability , and the three cases are disjoint. So no triangle has probability and
Problem 2
If you select three sticks, each of random length between 0 and 1, what is the probability of being able to form a triangle?
Solution
With independent lengths uniform on , a triangle fails when one length is at least the sum of the other two. For a fixed pair, is the volume of in the unit cube, which is . The three such events are disjoint, so
Problem 3
If you break a stick in two places at random, what is the probability of forming an acute triangle, where every angle is less than 90 degrees?
Solution
The pieces are uniform on the simplex . The triangle fails to be acute when, for the largest piece, its square is at least the sum of the other two squares. Writing , the condition reduces to , and integrating over the simplex, The three such events are disjoint and exhaust every non-acute outcome, so
Problem 4
If you select three sticks, each of random length between 0 and 1, what is the probability of forming an acute triangle?
Solution
Now are independent and uniform on . For a fixed largest side, is the chance the point lies in the quarter disk of radius with above : The three disjoint cases give the non-acute probability , so
The computation
Run all four experiments: build the three lengths the stated way, test the triangle inequality, and for the acute questions test that the largest squared side is below the sum of the other two squares. The four frequencies match the boxed values.
import numpy as np
rng = np.random.default_rng(0); n = 5_000_000
def stats(s): # s: n-by-3 side lengths
s = np.sort(s, axis=1)
tri = s[:, 2] < s[:, 0] + s[:, 1]
acute = tri & (s[:, 2]**2 < s[:, 0]**2 + s[:, 1]**2)
return tri.mean(), acute.mean()
u = np.sort(rng.random((n, 2)), axis=1) # two break points
broken = np.stack([u[:, 0], u[:, 1] - u[:, 0], 1 - u[:, 1]], axis=1)
uniform = rng.random((n, 3))
print("break tri, acute:", stats(broken)) # ~0.25, ~0.0794
print("sticks tri, acute:", stats(uniform)) # ~0.50, ~0.2146