Skip to content
Vamshi Jandhyala

Books · The Riddler

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 55 cm; one slice of cheese is a square of side 77 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 4949, so each patty must receive 24.5 cm224.5\ \text{cm}^2, which does fit on a 5×5=25 cm25\times 5 = 25\ \text{cm}^2 patty, but only just. The catch is the shape: a 77-cm square is too wide to sit on a 55-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 77 cm across in some direction, more than the 55 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 722\tfrac{7\sqrt2}{2} and area 494\tfrac{49}{4}. Joining two of them along their hypotenuses makes a square of side 722=24.54.95\tfrac{7\sqrt2}{2} = \sqrt{24.5} \approx 4.95 cm, area 24.5 cm224.5\ \text{cm}^2, which fits inside a 5×55\times 5 patty; the other two triangles make the second patty’s square. So the answer is 2 cuts.\boxed{2}\ \text{cuts}.

The computation

Encode the check: the two-diagonal construction must split the area evenly and produce a piece that fits on a 55-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 24.5 cm224.5\ \text{cm}^2 rearranged into a square of side 4.95<5\approx 4.95 < 5, so two cuts work; one cannot, as argued. The answer is 22 cuts.

Riddler Classic

Monty first picks the number of goats uniformly from {0,1,2,3}\{0,1,2,3\} (each 14\tfrac14), 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 00 with no goats, 23\tfrac23 with one goat (he is stuck only when you happened to pick the lone goat, probability 13\tfrac13), and 11 with two or three goats. Multiplying the 14\tfrac14 priors by these and renormalising, P(1 goat)=28,P(2 goats)=38,P(3 goats)=38,P(1\text{ goat}) = \tfrac{2}{8}, \qquad P(2\text{ goats}) = \tfrac{3}{8}, \qquad P(3\text{ goats}) = \tfrac{3}{8}, (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 23\tfrac23 of the time, staying 13\tfrac13.

  • Three goats: all doors are goats, you lose either way.

Combining, P(winswitch)=28(1)+38 ⁣(23)+38(0)=12,P(winstay)=28(1)+38 ⁣(13)+38(0)=38.\begin{aligned} P(\text{win} \mid \text{switch}) &= \tfrac{2}{8}(1) + \tfrac{3}{8}\!\left(\tfrac23\right) + \tfrac{3}{8}(0) = \tfrac12,\\ P(\text{win} \mid \text{stay}) &= \tfrac{2}{8}(1) + \tfrac{3}{8}\!\left(\tfrac13\right) + \tfrac{3}{8}(0) = \tfrac38 . \end{aligned} So you should switch, winning 50% of the time\boxed{\text{switch, winning } 50\% \text{ of the time}} versus 37.5%37.5\% if you stay. (With NN doors the same analysis gives switching 12\tfrac12 and staying N2(N+1)\tfrac{N}{2(N+1)}, 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 0.500\approx 0.500 and staying 0.375\approx 0.375, as boxed.