Skip to content
Vamshi Jandhyala

Books · The Fiddler: Solutions

Chapter 63

A Pi Day Puzzle

The island of π\pi-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)

Points below the parabola y=1x22y=\tfrac{1-x^2}{2} are closer to the diameter; the parabola is the equidistance locus between the two beaches.

Solution

Take radius 11 with the diameter on the xx-axis and the island in y0y\ge0. For an interior point (x,y)(x,y) the nearest point of the diameter is its foot (x,0)(x,0), so the distance to Diametric Beach is yy. The nearest point of the arc lies radially outward, so the distance to Semicircular Beach is 1r1-r with r=x2+y2r=\sqrt{x^2+y^2}. The picnic is closer to the diameter when y<1r    x2+y2<1y    y<1x22,y<1-r \iff \sqrt{x^2+y^2}<1-y \iff y<\frac{1-x^2}{2}, the last step by squaring x2+y2<1y\sqrt{x^2+y^2}<1-y. This is a downward parabola from (1,0)(-1,0) to (1,0)(1,0) peaking at y=12y=\tfrac12. The favourable area is 111x22dx=23,\int_{-1}^{1}\frac{1-x^2}{2}\,dx=\frac{2}{3}, against the half-disk area π2\tfrac{\pi}{2}, giving P=2/3π/2=43π42.44%.P=\frac{2/3}{\pi/2}=\frac{4}{3\pi}\approx\boxed{42.44\%}.

The polar route is less inviting: with rr\sim density 2r2r and θ\theta\sim uniform on [0,π][0,\pi], the same event rsinθ<1rr\sin\theta<1-r becomes r<11+sinθr<\tfrac{1}{1+\sin\theta}, so P=1π0π ⁣dθ(1+sinθ)2P=\tfrac1\pi\int_0^\pi\!\tfrac{d\theta}{(1+\sin\theta)^2}. Equating the two answers evaluates that integral as a by-product, 0πdθ(1+sinθ)2=43,\int_0^\pi\frac{d\theta}{(1+\sin\theta)^2}=\frac43, 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 y<1ry<1-r. The hit rate lands on 43π\tfrac{4}{3\pi}.

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 11 mile, what is the expected distance from a random picnic spot to the nearest shore (either beach)?

Solution

The distance to shore is X=min(RsinΘ,1R)X=\min(R\sin\Theta,\,1-R), with the two pieces splitting along the same equidistance locus r=11+sinθr=\tfrac{1}{1+\sin\theta}. Conditioning on Θ=θ\Theta=\theta and using the density fR(r)=2rf_R(r)=2r, E[X]=1π0π ⁣sinθ ⁣ ⁣011+sinθ ⁣ ⁣ ⁣2r2drdθ+1π0π ⁣11+sinθ1 ⁣ ⁣(1r)2rdrdθ.E[X]=\frac1\pi\int_0^\pi\!\sin\theta\!\!\int_0^{\frac{1}{1+\sin\theta}}\!\!\!2r^2\,dr\,d\theta +\frac1\pi\int_0^\pi\!\int_{\frac{1}{1+\sin\theta}}^{1}\!\!(1-r)\,2r\,dr\,d\theta. The two integrals collapse, and the leftover 0πdθ(1+sinθ)2=43\int_0^\pi\frac{d\theta}{(1+\sin\theta)^2}=\frac43 from the main solution finishes it: E[X]=1349π0.1919 miles,E[X]=\frac13-\frac{4}{9\pi}\approx\boxed{0.1919\ \text{miles}}, which equals 3π49π\tfrac{3\pi-4}{9\pi}. (The official extra-credit value is paywalled; this closed form is my own.)

The computation

Encode the distance itself: for each random spot take min(y,1r)\min(y,\,1-r), 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