Skip to main content

The Strangely Serious Implications of Math’s ‘Ham Sandwich Theorem’

A simple solution to gerrymandering crumbles when confronted with math’s “ham sandwich theorem”

Illustration of multiple boxes with slots, and a hand about to put a piece of paper in one of the slots

Thomas Fuchs

Consider lunch. Perhaps a nice ham sandwich. A knife should neatly halve the ham and two bread slices. But what if you slip? Oops—the ham now rests folded under a flipped plate; one slice of bread is on the floor, and the other is stuck to the ceiling. Here’s some solace: geometry ensures that a single straight cut, perhaps with a room-size machete, can still perfectly bisect all three pieces of your tumbled lunch, leaving exactly half of the ham and half of each slice of bread on either side of the cut. That’s because math’s “ham sandwich theorem” promises that for any three (potentially asymmetrical) objects in any orientation, there is always some straight cut that can simultaneously bisect them all. This fact has some bizarre implications, as well as some sobering ones, as it relates to gerrymandering in politics.

The theorem can be generalized to other dimensions. A more mathematical phrasing is that n objects in n-dimensional space can be simultaneously bisected by an (n – 1)-dimensional cut. That ham sandwich is a bit of a mouthful, but we’ll make it more digestible. On a two-dimensional piece of paper, you can draw whatever two shapes you want, and there will always be a (one-dimensional) straight line that cuts both perfectly in half. To guarantee an equal cut for three objects, we need to graduate to three dimensions and cut with a two-dimensional plane: think of that room-ravaging machete as a thin piece of paper you slip between the two halves of the room. In three dimensions, the machete has three degrees of freedom: you can move it back and forth across the room, stop and rotate it to different angles, and then rock the machete from side to side (the way you might angle a knife to cut carrots obliquely instead of straight).

If you can imagine a four-dimensional ham sandwich, as mathematicians like to do, then you can picture how you might bisect a fourth ingredient with a three-­dimensional cut.


On supporting science journalism

If you're enjoying this article, consider supporting our award-winning journalism by subscribing. By purchasing a subscription you are helping to ensure the future of impactful stories about the discoveries and ideas shaping our world today.


To get a sense of how to prove the ham sandwich theorem, consider a simplified version: two 2-D shapes, one a circle and the other a blob. Any line that passes through the center of a circle bisects it (asymmetrical shapes don’t necessarily have a true center; we’re using a circle to make things easier for now). How do we know that some line also bisects the blob? Pick a line through the center of the circle that doesn’t intersect the blob at all. As depicted in the first panel of the graphic in the next column, 100 percent of the blob lies below our line. Now slowly rotate the line around the center of the circle like a windmill wheel. Eventually it breaches the blob, cuts through more and more of it, and then passes below it so that 0 percent of the blob lies below the line. From this process we can deduce that there must be a moment at which 50 percent of the blob lies below the line. We’re gradually but continuously moving from 100 to 0 percent, so we must pass every amount in between, meaning at some point we are at exactly 50 percent (calculus fans might recognize this as the intermediate value theorem).

This argument proves that there is some line that simultaneously bisects our shapes (although it doesn’t tell us where that line is). It relies on the convenient fact that every line through the center of a circle bisects it, so we can freely rotate our line and focus on the blob without worrying about neglecting the circle. Two asymmetrical shapes require a subtler version of our windmill technique, and the extension to three dimensions involves more sophisticated arguments.

Interestingly, the theorem holds true for our sandwich even if the ham and bread are broken into multiple pieces. Use a cookie cutter to punch out ham snowmen, then cube your bread and bake it into croutons; a perfectly equal cut will always exist (individual snowmen and croutons won’t necessarily be halved, but the total amount of ham and bread will be).

Amanda Montañez

Taking this idea to its extreme, we can make a similar claim about points. Draw scattered red and green dots on a piece of paper, and there will always be a straight line with exactly half the red dots and half the green dots on either side of it. This version requires a small technicality: points that lie exactly on the dividing line can be counted on either side or not counted at all (for example, if you have an odd number of reds, then you could never split them evenly without this caveat).

Contemplate the bizarre implications here. You can draw a line across the U.S. so that exactly half of the nation’s skunks and half of its Twix bars lie above the line. Although skunks and Twix bars are not actually single points, they might as well be when compared with the vast canvas of the American landmass. Kicking things up a dimension, you can draw a circle on Earth (slicing through a globe leaves a circular cross section) that contains half of the world’s rocks, half of its paper and half of its scissors, or any other zany categories you wish.

The ham sandwich theorem carries far less whimsical consequences for the perennial problem of gerrymandering. In the U.S., state governments divide their states into electoral districts, and each district elects a member to the U.S. House of Representatives. Gerrymandering is the practice of carving out these district boundaries deliberately for political gain.

As a simplified example, imagine a state with a population of 80 people; 75 percent of them (60 people) favor the Purple Party, and 25 percent (20 people) prefer the Yellow Party. The state will be divided into four districts of 20 people each. It seems fair that three of those districts (75 percent) should be Purple and the fourth should be Yellow so that the state’s representation in Congress accords with the preferences of the population. A crafty cartographer, however, could squiggle district boundaries in such a way that each district contains 15 Purple-leaning voters and five people who vote Yellow. In this way, every district would be majority Purple, and 100 percent of the state’s representation would come from the Purple Party rather than 75 percent. In fact, with enough voters, any percentage edge that one party has over another (say, 50.01 percent Purple versus 49.99 percent Yellow) can be exploited to help that party win every district; just make it so that 50.01 percent of every district supports it.

Amanda Montañez

Of course, those districts look highly artificial. A seemingly obvious way to curtail gerrymandering would be to place restrictions on the shapes of the districts and disallow the tentacled monstrosities that we often see on American electoral maps. Indeed, many states impose such rules. Although it might seem like mandating “normal” district shapes would go a long way toward ameliorating the problem, clever researchers have applied a certain geometric theorem to show how that’s a bunch of baloney.

Let’s revisit our example: a total of 80 voters consisting of 60 Purple Party supporters and 20 Yellow Party supporters. The ham sandwich theorem tells us that no matter how they’re distributed, we can draw a straight line with exactly half of the Purple voters and half of the Yellow voters on either side (30 Purple and 10 Yellow on both sides). Now treat the two areas you’ve created as new ham sandwiches, splitting each in half with its own straight line so that every resulting region contains 15 Purples and five Yellows. Purple now has the same gerrymandered advantage as before (it wins every district), but the resulting regions are all simple shapes with straight-line boundaries!

Amanda Montañez

Repeated ham-sandwich subdivision will always produce relatively simple districts (in math-speak, they’re convex polygons except where they potentially share a boundary with an existing state border). This means that basic regulations on the shapes of congressional districts probably can’t preclude the worst instances of gerrymandering. Although math and politics may seem like distant fields, an idle geometric diversion has taught us that the most natural-sounding solution to gerrymandering doesn’t cut the mustard.