Skip to content
Vamshi Jandhyala

Books · The Riddler

Chapter 112

Can You Save Riddler Headquarters From Laser Larry?

Riddler Headquarters, seen from above, is a regular pentagon. The archvillain Laser Larry will fire a vertical planar ray along some line that cuts the building into two halves of equal area, but you do not know which such line. Which interior spots are at highest risk of being sliced, and which are safest? Extra credit: how large is the high-risk region?

The Riddler, FiveThirtyEight (anonymous)(original post)

Solution

Move the sensitive equipment away from the centre and out toward the walls:

The one idea is that an area-bisecting line is not free to wander. Fix a direction; as a line of that direction slides across the pentagon, the area on one side grows steadily from 00 to the whole, so exactly one position halves it. Sweeping the direction through a half-turn traces a one-parameter family of bisectors, and a one-parameter family of lines hugs an envelope, the curve every member is tangent to. Points near that envelope are crossed by many bisectors and so are most likely to be zapped; points far from it by just one.

For a centrally symmetric building, a square say, every area-bisector passes through the centre, the envelope collapses to that single point, and the centre is uniquely deadly. The pentagon has no centre of symmetry: its bisectors do not share a common point. Instead they sweep out a small five-pointed curvy star, cusped like a starfish, sitting at the middle of the building. Inside that star a point meets three area-bisectors; outside it, only one. So the star is the high-risk zone, and the safest points are those the bisectors reach last, the midpoints of the five walls.

Extra credit. The exact area of the star is a genuinely involved computation, and the column left it to a separate write-up. It is, however, easy to pin down numerically by building the envelope directly, and the danger star turns out to occupy only about 0.19%\boxed{0.19\%} of the building’s floor: a tiny target, but a sharply defined one.

The computation

Treat each direction θ\theta as a line whose offset is tuned by bisection until it halves the pentagon. The envelope of that family is (pcosθpsinθ, psinθ+pcosθ)\bigl(p\cos\theta-p'\sin\theta,\ p\sin\theta+p'\cos\theta\bigr), and its enclosed area (one half-turn is a full traversal) follows from Green’s theorem.

import numpy as np
V = np.c_[np.cos(a := np.pi/2 + 2*np.pi*np.arange(5)/5), np.sin(a)]  # pentagon

def area(P):
    x, y = P[:, 0], P[:, 1]
    return 0.5 * abs(np.dot(x, np.roll(y, -1)) - np.dot(y, np.roll(x, -1)))

def clip(P, n, p):                              # keep the part with x.n <= p
    out = []
    for i in range(len(P)):
        a, b = P[i], P[(i + 1) % len(P)]
        da, db = np.dot(a, n) - p, np.dot(b, n) - p
        if da <= 0: out.append(a)
        if (da < 0) != (db < 0): out.append(a + da / (da - db) * (b - a))
    return np.array(out)

A = area(V)
def offset(t):                                  # line normal t that halves the area
    n = np.array([np.cos(t), np.sin(t)]); lo, hi = (V @ n).min(), (V @ n).max()
    for _ in range(60):
        m = (lo + hi) / 2
        below = clip(V, n, m)
        lo, hi = (m, hi) if (area(below) if len(below) >= 3 else 0) < A/2 else (lo, m)
    return (lo + hi) / 2

T = np.linspace(0, np.pi, 4000, endpoint=False)
p = np.array([offset(t) for t in T]); dp = np.gradient(p, T)
X, Y = p*np.cos(T) - dp*np.sin(T), p*np.sin(T) + dp*np.cos(T)   # the envelope
star = abs(0.5 * np.sum(X*np.roll(Y, -1) - Y*np.roll(X, -1)))
print(round(100 * star / A, 3))                 # 0.187