Chapter 262
Can You Beat The GOAT Monty Hall Problem?
The Riddler for April 24, 2020. The Express splits a square of cheese fairly between two smaller square burgers in as few straight cuts as possible. The Classic is a Monty Hall variant where the number of goats is itself random.
Riddler Express
Two burger patties are squares of side cm; one slice of cheese is a square of side cm. Cut the cheese with straight cuts so the two patties get equal cheese with none overhanging onto the grill (single layer). What is the smallest number of cuts?
The Riddler, FiveThirtyEight, April 24, 2020(original post)
Solution
The cheese has area , so each patty must receive , which does fit on a patty, but only just. The catch is the shape: a -cm square is too wide to sit on a -cm patty, so the cheese must be cut and rearranged.
One cut cannot do it. A single straight cut leaves two pieces, and at least one of them still stretches the full cm across in some direction, more than the cm the patty allows, so it would overhang. Two cuts suffice: slice along both diagonals of the square. This produces four right-isosceles triangles, each with legs equal to the half-diagonal and area . Joining two of them along their hypotenuses makes a square of side cm, area , which fits inside a patty; the other two triangles make the second patty’s square. So the answer is
The computation
Encode the check: the two-diagonal construction must split the area evenly and produce a piece that fits on a -cm patty.
import math
cheese = 7**2
per_patty = cheese / 2 # 24.5 cm^2 each
side = math.sqrt(per_patty) # side of the rearranged square
print(per_patty, side, side <= 5) # 24.5 4.9497... True
Each patty gets rearranged into a square of side , so two cuts work; one cannot, as argued. The answer is cuts.
Riddler Classic
Monty first picks the number of goats uniformly from (each ), assigns them to distinct doors at random, and puts identical prizes behind the rest. You pick a door; if he can open another door showing a goat he does, otherwise he says so. This time he does reveal a goat. Should you switch, and what is your chance of winning?
The Riddler, FiveThirtyEight, April 24, 2020(original post)
Solution
Seeing Monty reveal a goat reweights the four equally likely goat-counts, because some counts make that reveal more likely than others. The chance Monty can show a goat behind another door is with no goats, with one goat (he is stuck only when you happened to pick the lone goat, probability ), and with two or three goats. Multiplying the priors by these and renormalising, (the zero-goat case is ruled out). Now find the win probability in each case:
One goat: Monty’s reveal was the only goat, so every other door, including the one you’d switch to, hides a prize. Switching wins for sure; and since you didn’t pick the goat, staying also wins.
Two goats: this is the classic Monty Hall, switching wins of the time, staying .
Three goats: all doors are goats, you lose either way.
Combining, So you should versus if you stay. (With doors the same analysis gives switching and staying , always below a half.)
The computation
Encode the game exactly: random goat-count, random assignment, your pick, Monty’s reveal when possible; among the games where he reveals a goat, measure how often switching and staying win.
import random
rng = random.Random(1); sw = st = trials = 0
for _ in range(2_000_000):
g = rng.choice([0, 1, 2, 3]) # number of goats
doors = [1]*g + [0]*(3 - g); rng.shuffle(doors) # 1 = goat, 0 = prize
pick = rng.randrange(3)
others = [i for i in range(3) if i != pick and doors[i] == 1]
if not others: continue # Monty can't reveal a goat
opened = rng.choice(others); trials += 1
rem = [i for i in range(3) if i not in (pick, opened)][0]
sw += doors[rem] == 0 # switching wins
st += doors[pick] == 0 # staying wins
print(round(sw/trials, 3), round(st/trials, 3)) # 0.5 0.375
The simulation gives switching and staying , as boxed.