Books · The Fiddler: Solutions
Chapter 63
A Pi Day Puzzle
The island of -land is a half-disk: a semicircular arc (Semicircular Beach) closing off a straight diameter (Diametric Beach). You pick a spot for your picnic uniformly at random on the island. What is the probability that your spot is closer to Diametric Beach than to Semicircular Beach?
The Fiddler, Zach Wissner-Gross, March 14, 2025 (a guest puzzle from Jason Zimba)(original post)
Solution
Take radius with the diameter on the -axis and the island in . For an interior point the nearest point of the diameter is its foot , so the distance to Diametric Beach is . The nearest point of the arc lies radially outward, so the distance to Semicircular Beach is with . The picnic is closer to the diameter when the last step by squaring . This is a downward parabola from to peaking at . The favourable area is against the half-disk area , giving
The polar route is less inviting: with density and uniform on , the same event becomes , so . Equating the two answers evaluates that integral as a by-product, a fact the Extra Credit will reuse.
The computation
Scatter random picnic spots over the island and compare the two distances directly: the spot is closer to the diameter when . The hit rate lands on .
import numpy as np
rng = np.random.default_rng(0)
x = rng.uniform(-1, 1, 8_000_000); y = rng.uniform(0, 1, 8_000_000)
m = x*x + y*y <= 1; x, y = x[m], y[m]
r = np.hypot(x, y)
print((y < 1 - r).mean(), 4/(3*np.pi)) # 0.4243 0.42441 = 4/(3 pi)
Extra Credit
With radius mile, what is the expected distance from a random picnic spot to the nearest shore (either beach)?
Solution
The distance to shore is , with the two pieces splitting along the same equidistance locus . Conditioning on and using the density , The two integrals collapse, and the leftover from the main solution finishes it: which equals . (The official extra-credit value is paywalled; this closed form is my own.)
The computation
Encode the distance itself: for each random spot take , the gap to whichever beach is nearer, and average. No appeal to the collapsed integral.
x = rng.uniform(-1, 1, 20_000_000); y = rng.uniform(0, 1, 20_000_000)
m = x*x + y*y <= 1; x, y = x[m], y[m]
nearest = np.minimum(y, 1 - np.hypot(x, y)) # distance to the closer beach
print(nearest.mean(), 1/3 - 4/(9*np.pi)) # 0.1919