Chapter 105
Can You Solve The Puzzle Of The Overflowing Martini Glass?
Your martini glass is a cone. You have drunk enough that, with the glass held upright, the drink reaches a fraction of the way up the side. Now tip the glass down on one side, just to the point of overflowing. How far up the opposite side does the drink now reach?
The Riddler, FiveThirtyEight (anonymous)(original post)
Solution
Tipping the glass rearranges the drink but does not add or remove a drop, so the one fixed quantity is the liquid’s volume. Pin that volume down twice, once upright and once tipped, and the answer falls out as a startlingly clean The drink ends up a fraction of the way up the far side.
Here is why. Scale the glass to height and radius (the answer is a ratio of lengths, so the particular size cannot matter). Upright, the drink is a small cone similar to the glass, reaching height , so its volume is , the fraction of the full glass.
Tipped to the brim, the drink’s flat surface slices the cone in an ellipse, and the liquid is a cone again, only now leaning: its tip is the bottom of the glass and its base is that ellipse. The volume of any cone, upright or leaning, is (base area) (height), and the elliptical base has area for semi-axes and . Write for the fraction the drink reaches up the far side, the quantity we want. Two facts fix the shape.
The major axis and the height. Slice the whole picture down the plane of symmetry. The cone becomes a triangle with its apex at the glass’s point, and the drink’s surface becomes the chord running from the brim on the near side to the height on the far side. With the glass scaled to , the near rim sits at and the far point at in this slice, so the triangle (apex at the origin) has area . That same triangle has the major axis for its base and the cone’s height for its altitude, so .
The minor axis. The ellipse’s short axis is the horizontal chord of the cone through the ellipse’s centre. The centre sits at radius along the glass and a distance off the cone’s axis, so the half-chord is .
Now assemble the tipped volume and set it equal to the upright one, Group the volume as and the two facts slot straight in. The square is the whole surprise: a glass two-thirds full up the side () tips to just up the other side.
The computation
No clever geometry in the check, just the conserved volume. Fill the cone with random points, tilt a plane through the near rim until the drink below it is the right fraction of the glass, and read off where that plane meets the far edge.
import numpy as np
rng = np.random.default_rng(0)
N = 4_000_000 # cone: apex down, height 1, radius 1
X, Z = rng.uniform(-1, 1, N), rng.uniform(0, 1, N)
inside = X * X + rng.uniform(-1, 1, N) ** 2 <= Z * Z
X, Z, n = X[inside], Z[inside], inside.sum()
def far_reach(p): # plane z = a*X + (1-a) thru near rim
lo, hi = 0.0, 1.0
for _ in range(50):
a = (lo + hi) / 2
frac = (Z <= a * X + (1 - a)).sum() / n # drink / glass volume
lo, hi = (a, hi) if frac > p**3 else (lo, a) # hit fraction p^3
a = (lo + hi) / 2
return (1 - a) / (1 + a) # where the plane meets the far edge
for p in (0.4, 0.6, 0.8):
print(f"p={p}: far reach {far_reach(p):.4f}, p^2={p*p:.4f}")
# p=0.4: far reach 0.1602, p^2=0.1600
# p=0.6: far reach 0.3596, p^2=0.3600
# p=0.8: far reach 0.6400, p^2=0.6400