Skip to content
Vamshi Jandhyala

Books · The Riddler

Chapter 255

Can You Solve This Rather Pedestrian Puzzle?

The Riddler for February 14, 2020. Both halves redesign the sidewalks of Riddler City, a vast grid of unit blocks with City Hall at the centre and employees’ homes scattered uniformly. The Express replaces the grid sidewalks with diagonal ones; the Classic replaces them with a Barcelona-style octagonal pattern. Each asks what fraction of employees then have a shorter walk home.

Riddler Express

Riddler City is a vast grid of unit-side square blocks with City Hall at the centre; employees’ homes are scattered uniformly across it. The traditional sidewalks run along the streets, so reaching the intersection (x,y)(x,y) blocks from City Hall takes x+y|x| + |y| blocks of walking. A proposal replaces them with sidewalks running diagonally, at 4545^\circ to the streets. What fraction of employees would then have a shorter walk home?

The Riddler, FiveThirtyEight, February 14, 2020(original post)

Solution

The diagonal sidewalks run in the two 4545^\circ directions 12(1,1)\tfrac{1}{\sqrt2}(1,1) and 12(1,1)\tfrac{1}{\sqrt2}(1,-1). To walk to (x,y)(x,y) you cover x+y/2|x+y|/\sqrt2 along the first diagonal and xy/2|x-y|/\sqrt2 along the second, a total of x+y+xy2=2max(x,y)2=2max(x,y),\frac{|x+y| + |x-y|}{\sqrt2} = \frac{2\max(|x|,|y|)}{\sqrt2} = \sqrt2\,\max(|x|,|y|), using the identity a+b+ab=2max(a,b)|a+b| + |a-b| = 2\max(|a|,|b|). Compare this with the grid walk x+y|x| + |y|.

Work in the octant where xy0x \ge y \ge 0 (the other seven are mirror images). There the diagonal walk is 2x\sqrt2\,x and the grid walk is x+yx + y, so the diagonal route is shorter exactly when 2x<x+yy>(21)x.\sqrt2\,x < x + y \quad\Longleftrightarrow\quad y > (\sqrt2 - 1)\,x. The boundary line y=(21)xy = (\sqrt2 - 1)x makes angle arctan(21)=22.5\arctan(\sqrt2 - 1) = 22.5^\circ with the street, precisely half of the 4545^\circ octant. So in every octant the diagonal sidewalks win for half the directions, and because the homes are scattered uniformly (so their direction from City Hall is uniform), the city splits evenly: 12.\boxed{\tfrac12}. Homes near the diagonals y=±xy = \pm x prefer the new sidewalks; homes near the streets prefer the old. Exactly half fall on each side.

The computation

Encode the geometry: scatter homes uniformly over a disk, compute both the grid walk x+y|x|+|y| and the diagonal walk (x+y+xy)/2(|x+y|+|x-y|)/\sqrt2, and measure how often the diagonal is shorter.

import numpy as np, math
rng = np.random.default_rng(0); N = 2_000_000
a = rng.uniform(0, 2*math.pi, N); r = np.sqrt(rng.uniform(0, 1, N))
x, y = r*np.cos(a), r*np.sin(a)
grid = np.abs(x) + np.abs(y)
diag = (np.abs(x + y) + np.abs(x - y)) / math.sqrt(2)
print(np.mean(diag < grid))                  # ~0.5

The simulated fraction is 0.5000.500, matching the boxed 12\tfrac12.

Riddler Classic

The petitioners try again, now asking for sidewalks in an octagonal pattern like the chamfered blocks of Barcelona’s Eixample. Under this proposal, what fraction of employees would have a shorter walk home?

The Riddler, FiveThirtyEight, February 14, 2020(original post)

Deferred (figure-dependent geometry)

The answer is the same 12\tfrac12 as the Express, and for the same reason: the octagonal pattern is shorter exactly for homes above the line y=(21)xy = (\sqrt2 - 1)x (and its mirror images), the very boundary that split the Express in half. The official derivation shows that on a block where x>y>0x > y > 0 the diagonal chamfers save a distance 2yd(21)2yd(\sqrt2 - 1) while the straight runs add (xy)d(22)(x - y)d(2 - \sqrt2), where dd is the chamfer length; these balance precisely when y=(21)xy = (\sqrt2 - 1)x, and the chamfer length dd cancels.

We defer the full write-up rather than reconstruct it from text alone. Faithfully encoding the octagonal walk requires the exact geometry of the chamfered-block sidewalk network from the puzzle’s diagram (the lengths and connections of the diagonal corner segments), which the prose does not pin down well enough to model independently without re-deriving the very boundary line we would be checking. The mathematical content is identical to the Express above, which we author in full; the result is 12\tfrac12.

Status

Deferred as figure-dependent. Recorded answer: 12\tfrac12 of employees prefer the octagonal sidewalks, with the same boundary line y=(21)xy = (\sqrt2 - 1)x as the diagonal Express.