Skip to content
Vamshi Jandhyala

Books · The Riddler

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 11, so a triangle forms unless one piece is at least the sum of the other two, that is, unless one piece exceeds 12\tfrac12. The left piece exceeds 12\tfrac12 only if both break points land in (12,1)(\tfrac12,1), probability 14\tfrac14; by symmetry each piece exceeds 12\tfrac12 with probability 14\tfrac14, and the three cases are disjoint. So no triangle has probability 34\tfrac34 and Pr(triangle)=134=14.\Pr(\text{triangle}) = 1 - \tfrac34 = \boxed{\tfrac14}.

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 a,b,ca,b,c uniform on [0,1][0,1], a triangle fails when one length is at least the sum of the other two. For a fixed pair, Pr(ab+c)\Pr(a \ge b+c) is the volume of {ab+c}\{a \ge b+c\} in the unit cube, which is 16\tfrac16. The three such events are disjoint, so Pr(triangle)=1316=12.\Pr(\text{triangle}) = 1 - 3\cdot\tfrac16 = \boxed{\tfrac12}.

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 (a,b,c)(a,b,c) are uniform on the simplex a+b+c=1a+b+c=1. The triangle fails to be acute when, for the largest piece, its square is at least the sum of the other two squares. Writing c=1abc = 1-a-b, the condition c2a2+b2c^2 \ge a^2+b^2 reduces to 12a2b+2ab01 - 2a - 2b + 2ab \ge 0, and integrating over the simplex, Pr(c2a2+b2)=01/2 ⁣(211a)da=1ln2.\Pr(c^2 \ge a^2+b^2) = \int_0^{1/2}\!\Big(2 - \frac{1}{1-a}\Big)\,da = 1 - \ln 2. The three such events are disjoint and exhaust every non-acute outcome, so Pr(acute)=13(1ln2)=3ln220.0794.\Pr(\text{acute}) = 1 - 3(1-\ln 2) = \boxed{3\ln 2 - 2} \approx 0.0794.

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 a,b,ca,b,c are independent and uniform on [0,1][0,1]. For a fixed largest side, Pr(a2b2+c2)\Pr(a^2 \ge b^2+c^2) is the chance the point (b,c)(b,c) lies in the quarter disk of radius 11 with aa above b2+c2\sqrt{b^2+c^2}: Pr(a2b2+c2)=0π/2 ⁣ ⁣01(1ρ)ρdρdθ=π216=π12.\Pr(a^2 \ge b^2+c^2) = \int_0^{\pi/2}\!\!\int_0^1 (1-\rho)\,\rho\,d\rho\,d\theta = \frac{\pi}{2}\cdot\frac16 = \frac{\pi}{12}. The three disjoint cases give the non-acute probability π4\tfrac{\pi}{4}, so Pr(acute)=1π4=1π40.2146.\Pr(\text{acute}) = 1 - \frac{\pi}{4} = \boxed{1 - \tfrac{\pi}{4}} \approx 0.2146.

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