Library · The Fiddler: Solutions · Chapter 125

Can You Fairly Cut the Birthday Cake?

Revised Report an error

You and two friends share one rectangular birthday cake, 2020 inches long and 1010 inches wide, with frosting all along its edge. You want to cut it fairly: each of you gets the same area of cake and the same length of frosted edge. You will do it by choosing a single point inside the cake and making three straight cuts from that point out to the edge. Describe a way to do this. (The three pieces need not have the same perimeter, only the same share of the cake’s original edge.)

The Fiddler, Zach Wissner-Gross, March 1, 2024(original post)

The official solution appeared in the post of March 8, 2024 and describes, among others, the cut from (10,20/3)(10, 20/3) given below. The Extra Credit half of that post is paywalled, so the area of the locus is my own. It agrees with the value 50(4π3−9)/8150(4\pi\sqrt3 - 9)/81 that solver Emilie Mitchell derived, as reported in Tom Keith’s published solution notes.

Solution

Put the cake on coordinates with corners (0,0)(0,0), (20,0)(20,0), (20,10)(20,10) and (0,10)(0,10), and call the centre of the cuts P=(x,y)P = (x, y). The edge is 6060 inches long and the cake has area 200200 square inches, so each person needs 2020 inches of edge and 2003\tfrac{200}{3} square inches of cake.

One fact does all the work. A piece is the region between two neighbouring cuts, and it splits into triangles with apex PP, one for each stretch of the edge that the piece owns. A triangle with apex PP whose base is a stretch of length ℓ\ell on a side at distance hh from PP has area 12hℓ\tfrac12 h \ell. So area of a piece  =  12∑h ℓ,\text{area of a piece} \;=\; \tfrac12 \sum h \,\ell , the sum running over the sides the piece touches, with ℓ\ell the length of that side it owns. The distances from PP to the four sides are yy (bottom), 20−x20 - x (right), 10−y10 - y (top) and xx (left).

A clean fair cut now drops out. Put PP on the vertical midline, at (10,y)(10, y), and cut to the two bottom corners and to the middle of the top edge, (10,10)(10, 10). The bottom triangle owns the whole bottom edge, 2020 inches of frosting, and its area is 12⋅y⋅20=10y\tfrac12 \cdot y \cdot 20 = 10y. Each of the other two pieces owns one short side (1010 inches) and half of the top (1010 inches), so 2020 inches each, and by the left-right symmetry they have equal areas. All three areas are equal once the triangle has a third of the cake: 10y=200310y = \tfrac{200}{3}, so y=203y = \tfrac{20}{3}.  Cut from P=(10,203) to (0,0), (20,0) and (10,10). \boxed{\ \text{Cut from } P = \bigl(10, \tfrac{20}{3}\bigr) \text{ to } (0,0),\ (20,0) \text{ and } (10,10). \ } This is the point P1P_1 in the figure below. It is far from the only answer, and that is what the Extra Credit is about.

The computation

The program checks the cut from the definitions. It measures positions round the edge anticlockwise from the origin, so the cut points (0,0)(0,0), (20,0)(20,0) and (10,10)(10,10) sit at 00, 2020 and 4040. For each piece it walks the edge from one cut point to the next, collecting the corners it passes, builds the piece as a polygon with apex PP, and finds its area by the shoelace formula. The frosting is the distance walked.

from fractions import Fraction as Fr

def pos(s):                  # point at distance s round the edge
    s %= 60
    if s <= 20: return (s, 0)
    if s <= 30: return (20, s - 20)
    if s <= 50: return (50 - s, 10)
    return (0, 60 - s)

def pieces(P, cuts):         # cuts: edge positions, increasing
    out = []
    for a, b in zip(cuts, cuts[1:] + [cuts[0] + 60]):
        turns = [c for c in (20, 30, 50, 60, 80, 90) if a < c < b]
        poly = [P, pos(a)] + [pos(c) for c in turns] + [pos(b)]
        area = abs(sum(u[0]*v[1] - u[1]*v[0] for u, v in
                       zip(poly, poly[1:] + poly[:1]))) / 2
        out.append((area, b - a))
    return out

for area, frosting in pieces((Fr(10), Fr(20, 3)), [0, 20, 40]):
    print(area, frosting)

It prints

200/3 20
200/3 20
200/3 20

Each piece has a third of the area and a third of the frosting.

Extra Credit

The points PP from which a fair cut can be made form a closed curve. What is the area inside it?

Solution

First, the frosting. Each piece owns the stretch of edge between its two cut points, so the three cut points must be exactly 2020 inches apart round the edge. Describe them by the position tt of one of them, measured round the edge from (0,0)(0,0); the others are at t+20t + 20 and t+40t + 40. Moving tt on by 2020 just relabels the same three points, so every fair cut has exactly one description with 0≤t<200 \le t < 20.

Next, the area, for 0≤t≤100 \le t \le 10. The cut points are A=(t,0),B=(20,t),C=(10−t,10),A = (t, 0), \qquad B = (20, t), \qquad C = (10 - t, 10), on the bottom, right and top sides. The piece from AA to BB owns 20−t20 - t of the bottom and tt of the right side; the piece from BB to CC owns 10−t10 - t of the right side and 10+t10 + t of the top. By the area fact, fairness asks for 12[(20−t) y+t (20−x)]=2003,12[(10−t)(20−x)+(10+t)(10−y)]=2003,\begin{align*} \tfrac12\bigl[(20 - t)\,y + t\,(20 - x)\bigr] &= \tfrac{200}{3}, \\ \tfrac12\bigl[(10 - t)(20 - x) + (10 + t)(10 - y)\bigr] &= \tfrac{200}{3}, \end{align*} and then the third piece has the remaining third automatically. These are two straight-line equations in xx and yy, and their determinant works out to 12((t−5)2+75)\tfrac12\bigl((t-5)^2 + 75\bigr), which is never zero. So each tt gives exactly one point PP. Solving, and measuring from the centre of the cake by writing X=x−10X = x - 10, Y=y−5Y = y - 5 and u=t−5u = t - 5, gives X=5−500u2+75,Y=−100 u3 (u2+75),−5≤u≤5.X = 5 - \frac{500}{u^2 + 75}, \qquad Y = -\frac{100\,u}{3\,(u^2 + 75)}, \qquad -5 \le u \le 5 .

Fractions of this shape are the tangent half-angle formulas in disguise. Substitute u=75tan⁡θu = \sqrt{75}\tan\theta, so that 1u2+75=cos⁡2θ75\frac{1}{u^2 + 75} = \frac{\cos^2\theta}{75}: X=53−103cos⁡2θ,Y=−1039sin⁡2θ,−30∘≤θ≤30∘.X = \tfrac53 - \tfrac{10}{3}\cos 2\theta, \qquad Y = -\tfrac{10\sqrt3}{9}\sin 2\theta, \qquad -30^\circ \le \theta \le 30^\circ . That is an arc of an ellipse centred at (X,Y)=(53,0)(X, Y) = (\tfrac53, 0), with horizontal semi-axis a=103a = \tfrac{10}{3} and vertical semi-axis b=1039b = \tfrac{10\sqrt3}{9}. At the ends, cos⁡2θ=12\cos 2\theta = \tfrac12 and the arc reaches X=0X = 0; in between it bulges left to X=−53X = -\tfrac53. So this half of the locus is the part of the ellipse that lies to the left of the line X=0X = 0.

For 10≤t≤2010 \le t \le 20 no new work is needed. Reflecting the cake in its vertical midline turns a fair cut into a fair cut, and it turns the cut points (t,0)(t,0), (20,t)(20,t), (10−t,10)(10-t,10) into (20−t,0)(20-t, 0), (0,t)(0, t), (10+t,10)(10+t, 10), which is the description with parameter 20−t20 - t, between 1010 and 2020. So the other half of the locus is the mirror image: the part of the ellipse centred at (−53,0)(-\tfrac53, 0) lying to the right of X=0X = 0. The two arcs meet at (0,±53)(0, \pm\tfrac53), and together they bound the overlap of the two ellipses, a lens shape (shaded in the figure).

The fair points form the boundary of the shaded lens. From P_1 = (10, \tfrac{20}{3}) the cuts go to two corners and the middle of the top; from P_2 = (\tfrac{35}{3}, 5) they go to (0,5) , (15,0) and (15,10) .
The fair points form the boundary of the shaded lens. From P1=(10,203)P_1 = (10, \tfrac{20}{3}) the cuts go to two corners and the middle of the top; from P2=(353,5)P_2 = (\tfrac{35}{3}, 5) they go to (0,5)(0,5), (15,0)(15,0) and (15,10)(15,10).

The lens is two equal caps, each cut off an ellipse by a line at distance a2\tfrac{a}{2} from its centre. Squash the ellipse vertically by the factor a/ba/b and it becomes a circle of radius aa, cut by a line at distance a2\tfrac{a}{2}, which cuts off a segment with angle 120∘120^\circ at the centre and area a22(2π3−32)\tfrac{a^2}{2}\bigl(\tfrac{2\pi}{3} - \tfrac{\sqrt3}{2}\bigr). Stretching back multiplies areas by b/ab/a. So lens  =  2⋅ab2(2π3−32),ab=100327,\text{lens} \;=\; 2 \cdot \frac{ab}{2}\Bigl(\frac{2\pi}{3} - \frac{\sqrt3}{2}\Bigr), \qquad ab = \frac{100\sqrt3}{27},  area  =  2003 π81−509  ≈  7.880 square inches. \boxed{\ \text{area} \;=\; \frac{200\sqrt3\,\pi}{81} - \frac{50}{9} \;\approx\; 7.880 \text{ square inches}. \ }

The computation

The program finds the fair points without the algebra above. For each of 20,00020{,}000 evenly spaced values of tt it places the cuts at tt, t+20t + 20 and t+40t + 40 and asks for the point PP at which the first two pieces, measured with pieces from The computation above, each have area 2003\tfrac{200}{3}. A piece’s area changes linearly as PP moves, so three trial points determine it exactly, and the program solves for PP. It then checks, at a sample of the cuts, that all three pieces are fair, that every point lies inside the cake, and finds the area of the closed path through the 20,00020{,}000 points with the shoelace formula.

def fair_point(t):
    cuts = [t, t + 20, t + 40]
    A = lambda P: [a for a, _ in pieces(P, cuts)[:2]]
    a0, ax, ay = A((0, 0)), A((1, 0)), A((0, 1))
    m = [[ax[i] - a0[i], ay[i] - a0[i]] for i in (0, 1)]
    r = [200/3 - a0[0], 200/3 - a0[1]]
    det = m[0][0]*m[1][1] - m[0][1]*m[1][0]
    return ((r[0]*m[1][1] - m[0][1]*r[1]) / det,
            (m[0][0]*r[1] - r[0]*m[1][0]) / det)

n = 20_000
path = [fair_point(20 * k / n) for k in range(n)]
fair = []
for k in range(0, n, 500):
    t = 20 * k / n
    for a, f in pieces(path[k], [t, t + 20, t + 40]):
        fair += [abs(a - 200/3) < 1e-9, f == 20]
inside = all(0 < x < 20 and 0 < y < 10 for x, y in path)
area = abs(sum(u[0]*v[1] - u[1]*v[0] for u, v in
               zip(path, path[1:] + path[:1]))) / 2
print("sampled cuts all fair:", all(fair))
print("every point inside the cake:", inside)
print(f"area inside the locus: {area:.4f}")

It prints

sampled cuts all fair: True
every point inside the cake: True
area inside the locus: 7.8800

which matches 2003 π81−509=7.87999…\frac{200\sqrt3\,\pi}{81} - \frac{50}{9} = 7.87999\ldots.

Report an error on this page

Reports are stored by Netlify. See the privacy note.