Chapter 109
Can You Solve The Puzzle Of The Picky Eater?
You make a sandwich on perfectly square bread, and you loathe the crust so deeply that you will eat only the part of the sandwich that is closer to the centre than to the edge. What fraction of the sandwich do you eat? Extra credit: which regular bread shape lets a crust-hater eat the most?
The Riddler, FiveThirtyEight (inspired by @hatathi)(original post)
Solution
The edible region is bounded by parabolas, and pinning down one of them gives
The one idea is the definition of a parabola: the points equidistant from a fixed point and a fixed line. “Closer to the centre than to a given edge” is precisely the inside of the parabola with the centre as focus and that edge as directrix. The square has four edges, so four parabolas, and the edible piece is the region inside all four at once.
Make the bread the square , , centre at the origin, total area . Split it along its two diagonals into four congruent triangles; by symmetry, work in the right-hand one, where the nearest edge is the line . A point there is edible when it is nearer the origin than that edge, Within the triangle a point also satisfies , and combining forces . Writing , the edible area of this one triangle is Each triangle has area and the whole square has area , so this triangle’s edible area already is the fraction for the whole sandwich: . You throw away nearly four-fifths of your lunch.
Extra credit. For a regular polygon the same four-becomes- argument applies, and as the number of sides grows the bread tends to a circle, for which “closer to the centre than the rim” is simply the disc of half the radius, an edible quarter. More sides means more edible area, approaching . So the crust-hater’s ideal bread is round.
The computation
No need to trust the algebra: scatter points across the square and ask each whether it sits nearer the centre than the nearest edge.
import numpy as np
rng = np.random.default_rng(0)
N = 20_000_000
x, y = rng.uniform(-1, 1, N), rng.uniform(-1, 1, N)
d_center = np.hypot(x, y)
d_edge = 1 - np.maximum(np.abs(x), np.abs(y)) # nearest of the four edges
print(round((d_center < d_edge).mean(), 5),
round((4 * 2**0.5 - 5) / 3, 5))
# 0.21902 0.21895