151 | Jordan Ellenberg on the Mathematics of Political Boundaries
What this covers
Jordan Ellenberg and Sean Carroll discuss how mathematics can detect gerrymandering by testing whether a political map's partisan outcome is statistically extreme. The conversation begins with why visual inspection of district shapes no longer works: modern computers can produce heavily gerrymandered maps that look perfectly normal and regular. Ellenberg argues that the right test is probabilistic—generate tens of thousands of maps satisfying all legitimate constraints (compactness, connectivity, county lines) without partisan intent, compute each map's likely seat outcome from real election data, and see whether the actual map falls far into the tail of that distribution. When states like Wisconsin, North Carolina, and Maryland produce results that appear as outliers, the evidence suggests deliberate manipulation rather than chance. This requires a clever solution to a computational problem: the space of all possible maps is astronomically large and cannot be directly enumerated, so random walks and Markov chains sample the neighborhood of a given map by making small local changes—moving a ward on boundaries between districts—chosen at random.
Much of the episode traces the history and mathematics underneath this approach. Ellenberg traces Markov chains to Andrey Markov, who invented them to refute a philosophical claim that statistical stability proved human free will, and demonstrates their power through the surprising fact that Markov analyzed Pushkin's Eugene Onegin as consonant-vowel transitions—an early precursor to modern natural language processing. He also situates the random walk concept as a case of multiple independent discovery around 1900–1905, emerging simultaneously in work on malaria, acoustics, bond markets, Brownian motion, and statistics. The discussion addresses limits and alternatives: no mathematical or legal definition of a "perfectly fair" map exists, so the goal is detecting the worst offenders rather than achieving perfection. Ellenberg also explores an alternative framing inspired by the cake-cutting problem, where parties alternately modify the map, and discusses why simpler measures like the efficiency gap fall short despite capturing something real about wasted votes. Throughout, the frame emphasizes that mathematics is the referee, not the player—humans still draw maps; mathematics judges how typical they are.
Ellenberg argues that gerrymandering cannot be reliably detected by the shape of districts; instead, the rigorous test is whether a map's partisan outcome is a statistical outlier within an ensemble of reasonable maps, which is sampled not exhaustively but via random walks and Markov chains.
- Modern computer-drawn gerrymanders look normal yet produce extreme partisan results, so visual inspection fails
- The set of all possible maps is uncomputably huge, so a random walk samples a map's neighborhood instead
- A map whose partisan advantage rapidly dissipates under local changes is demonstrably an outlier
Gerrymandering should be addressed through integrated mathematical, political, and legal approaches rather than any single lens alone.
- Treating districting as a purely mathematical optimization yields nice straight-edged polygons that are politically and legally absurd because they ignore real communities and their shared local needs; conversely, treating it as purely political or legal without quantitative tools also yields bad results, so the problem must be solved as math, politics, and law together.
“you get nice polygons, with like a straight-line boundary, and then you show this to a politician or a lawyer and they will laugh until they pee their pants, because this has no bearing on anything that's politically feasible”
- The mathematical approach to gerrymandering does not have computers draw the maps; humans still draw them, and math is used only to judge how typical or distorted the drawn map is by comparing its results to typical results—the geometry is the referee, not the player.
“the geometry is the referee here, not the player.”
- There is no mathematical, philosophical, or legal answer to what a perfectly fair map is, but the question of what is unfair is far more tractable; the goal should be detecting the worst, most grievous gerrymanders rather than achieving perfection.
“I think the question of what's fair is very hard, but I think the question of what's unfair is much easier, and that's a crucial distinction.”
- Introducing fundamental voting reforms like ranked choice voting—where voters rank all candidates—will significantly disrupt the existing gerrymandering landscape for both those drawing partisan maps and those detecting them, opening a research frontier requiring math, political science, and law together.
“Introducing fundamental changes in how the vote works, like ranked choice voting, is going to scramble this a lot, both for the people drawing gerrymandered maps and for the people trying to detect gerrymandered maps.”
- These random-walk ensemble techniques are envisioned not just as courtroom testimony tools but as a new kind of technology for social science research, analogous to how physicists use Monte Carlo simulations to study systems they cannot directly experiment on, useful in political science where experiments are hard and often ethically questionable.
“they see these techniques not just as a way to sort of like give meaningful testimony in court... but as a sort of new kind of tech for doing social science research, in the same way that in physics... people use Monte Carlo simulations all the time”
- The gerrymandering case before the Supreme Court was, as far as Ellenberg knows, the first case in the history of the Court to feature a mathematician's amicus brief, alongside briefs from historians, political scientists, lawyers, and community groups.
“I think this is, as far as I know, the first case in the history of the Supreme Court where there was a mathematician's brief.”
Random walks on map space efficiently detect gerrymandered outliers without enumerating all possible districts.
- By starting from a given map and repeatedly making restricted local changes—moving a ward on the boundary between two adjacent districts—chosen at random, a random walk can effectively explore a space far too large to view globally, the same way shuffling explores the 52-factorial space of card orderings.
“this is the magic of the random walk, is that choosing from a very limited menu of possible changes and choosing one at random and just repeating that has a wonderful power to allow you to explore a space that you simply can't see from afar”
- By generating tens of thousands of random maps that satisfy all legitimate constraints (compactness, county lines, connectivity) but without partisan intent, and computing each map's likely seat outcome from actual election data, one gets a roughly Gaussian distribution; heavily gerrymandered states like Wisconsin, North Carolina, and Maryland produce outcomes far in the tail, giving a clean signal that the result did not happen by chance.
“in states like Wisconsin or North Carolina or Maryland, where they have heavily gerrymandered maps, the outcomes from the actual maps are way off in the tail of the distribution. They're very visible outliers”
- Even though we cannot prove the map space is connected and may never reach undiscovered regions, if every local change to a legislature's map rapidly dissipates its partisan advantage, that is strong evidence the map was deliberately cooked—it is an outlier within its own neighborhood, which suffices to flag it even without surveying all possible maps.
“if you start with a map that the legislators drew and you mess with it, and basically every single thing you do to it rapidly dissipates the partisan advantage that it has, that's a pretty strong indication that that particular map was cooked.”
- Unlike PageRank, the gerrymandering random walk cannot run long enough to reach an equilibrium distribution, so it does not rank all maps; instead it samples the neighborhood of the starting map (like COVID particles densest near the source), and its goal is not to say what map is best but to identify when an existing map is a complete outlier.
“the fact that we're not sort of converging to some equilibrium distribution, it means we're not going to do what Google does, we're not going to say, I'm going to rank all maps for you... but that's not the goal. The goal is not to tell you what to do, the goal is to tell you what not to do.”
- Picking a uniformly random map from all possible districtings is infeasible because the number of ways to partition a state's roughly 7000 wards into 99 connected districts is astronomically large—too big to enumerate, store, or sample directly—so a proxy method is required.
“the set of all possible districting of the state is absolutely unfeasibly, uncomputably huge. I couldn't even tell you how many there are.”
Markov chains are memoryless processes that can be extended with enlarged state definitions to capture longer-range dependencies.
- A memoryless Markov chain can incorporate memory by enlarging the definition of a state—for example, running the chain on three-letter strings rather than single letters, where each step lops off the first letter and appends a new one—which underlies how language-prediction systems extend basic Markov models.
“This business of memory... You can kind of build in a certain amount of memory just by enlarging your idea of what the state is.”
- A Markov chain is any process exploring a space where the next state depends only on the current state and not on the history of how you got there—a memoryless quality akin to the amnesiac in Memento—possibly with randomness governed by transition probabilities.
“you're in some state, and then where you go next only depends on where you are right now.”
- Language generation systems like GPT-3 are in some sense trying to find the Markov chain that best matches the language production they can observe, drawing on a gigantic corpus of internet English text, though worked hard to add more long-range memory than a basic Markov chain.
“It's in some sense trying to find the Markov chain that best matches the language production it is able to see, and it's able to see a lot because it has access to this gigantic corpus of English language texts”
- Markov invented the Markov chain to refute Nekrasov, who claimed that the convergence of social statistics to stable averages proved human independence and hence free will; Nekrasov mistook Bernoulli's theorem (independence implies convergence) for its converse, and Markov showed that dependent processes—random walks where each state is tightly tied to the previous one—also converge to stable averages.
“Markov develops the Markov chain as a counter example to Nekrasov's claimed proof that free will is implied, that free will is implied by probability theory.”
- Markov demonstrated his chains by treating Pushkin's Eugene Onegin as a string of consonants and vowels and computing transition probabilities, a modern computational-style reduction to bits that distinguished it from a different Russian author's text—a precursor to today's natural language processing.
“He analyzed Eugene Onegin, the famous poem by Pushkin... he nonetheless showed that you could just treat it as a string of consonants and vowels... he was able to show that it distinguished it from a different book by a different Russian author”
The current legislator-drawn map system is so flawed that nearly any neutral alternative would improve fairness substantially.
- Because the current system, where legislators or party operatives draw their own maps, is almost the worst possible arrangement and makes it so easy to cement partisan advantage, almost any disruptive change is far more likely to improve the situation than to make it worse—even imperfect alternatives like retired-judge commissions.
“the current mechanism makes it so easy to do so much to cement your partisan advantage that almost any disruptive change, I think, would be much more likely to improve the situation than to make it worse.”
- Inspired by the cake-cutting solution (one child cuts, the other chooses), one could turn gerrymandering into a turn-based game where parties alternately modify the map; because gerrymandered maps are special local apexes of partisan advantage, two players each pushing toward and away from the peak will end up far from it, yielding a fairer map—though practical protocols are more complex.
“Imagine there's like two kids wrestling on top of a mountain, and one kid is trying to get you to the top of the mountain, and one kid is trying to get you off the peak. Well, there's a lot more non-peak than peak, so if the two kids kind of take turns pushing each other, they're not going to stay at the peak”
- The opposite of gerrymandering is not conformity to a preset target number of seats (proportional representation), but rather the outcome that would have resulted if the maps had been drawn by a neutral arbiter; this was the position claimants advanced in Rucho v. Common Cause.
“The opposite of gerrymandering is not gerrymandering. The opposite of gerrymandering is what would have happened if those maps had been drawn by a neutral arbiter of some kind.”
- Because representatives are elected from geographic districts by majority vote, a party with a modest statewide edge can win nearly all seats; even without gerrymandering, a two-thirds-Democratic state like Massachusetts elects essentially no Republicans because there are no Republican-majority districts.
“in a state that's two-thirds Democratic, there's not going to be very many Republican neighborhoods, certainly not entire Republican patches of the state big enough to be a Congressional district.”
Visual appearance and traditional heuristics fail to detect modern computer-drawn partisan maps.
- Because districts are now drawn by computer, a mapmaker can produce a heavily partisan map whose districts look perfectly normal and regular; the funny-shaped-district heuristic no longer detects gerrymandering, as Wisconsin's pre-2011 court map and post-2011 gerrymandered map look about the same.
“If you say, "I want a map, that advantages my party by a huge amount, and it looks fine, the districts are shaped, roughly, rectangularly and nice," you can do that.”
- The efficiency gap measure, though simple to compute and capturing something real about wasted votes, is flawed because it implicitly posits a right answer for how many seats a given popular vote should yield—placing it in the same genre as proportional representation—so a perfectly even state would score badly despite no gerrymandering.
“the flaw of that measure is that in the end it does kind of seem to posit that there's some right answer to how many legislative seats there should be, given a certain popular vote.”
- Gerrymandering works by cramming the disfavored party's voters into a few districts they win overwhelmingly, thereby wasting their votes, while spreading your own voters across many districts that you win by modest margins, maximizing seats per voter.
“you try to cram all of their voters into just a few districts... by doing so, you're sort of using up their voters and, if you like, wasting their votes on a few districts that they'll win by a lot, leaving the rest of the state composed of more districts where you win by a more modest amount”
Random walks and related concepts arose independently across multiple countries around 1900 when the world was ready for them.
- Although mathematics is now global, around 1900 work on the random walk was happening independently in England, France, Switzerland, and Russia with researchers unaware of each other, illustrating how the same fundamental idea can arise in disconnected places when the world is ready for it.
“now sort of math is global, but then, stuff is happening in England, stuff is happening in France, stuff is happening in Switzerland with Einstein, and stuff is happening in Russia with Markov, and none of them knew”
- The random walk concept emerged almost simultaneously around 1900-1905 in disconnected contexts—Ronald Ross on malarial mosquito migration, Karl Pearson coining the term in Nature, Lord Rayleigh recognizing it from acoustics, Louis Bachelier on the bond market, Einstein on Brownian motion, and Markov in Russia—with none of these researchers aware of one another.
“It's all happening between 1900 and 1905, and none of them knew about each other, it's incredible.”
- Google PageRank revolutionized search by doing a random walk on the internet—following random links from page to page—and computing the limiting equilibrium distribution of how often each site is hit; this recursive measure (important sites are those linked by other important sites) captures an emergent global notion of importance that cannot be seen locally.
“what Google did was build the Markov chain into the process. Basically, they did a random walk on the internet... You're on a page, you follow a random link from it. That's the walk. You do that for a long time and you start to converge to a probability distribution.”
Complex computational problems remain practically solvable through approximate algorithms despite theoretical hardness.
- The problem of provably drawing a uniformly random map, where every possible map is equally likely, is NP-hard; complexity theory establishes relative hardness among such problems but cannot prove any individual one is genuinely hard, so the whole edifice could in principle collapse if a fast algorithm were found, though no one expects that.
“that problem is known to be NP hard.”
- While proving a problem like the traveling salesman is NP-hard, engineers in practice write algorithms that with very high probability find solutions nearly as good as optimal, so hard problems are routinely solved approximately even though provable optimal solutions are out of reach.
“I'm content to get... To write an algorithm which with probability 99.99% finds a solution that's at least 99.99% as good as the optimal one, so while you're over there proving your theorem, I'm just making the path, I'm doing it.”
- The Bayer-Diaconis seven shuffle theorem proves that seven riffle shuffles—a very small number—are essentially enough to put a deck of cards into extremely close to uniformly random order, demonstrating how few local random operations suffice to randomize a huge state space.
“It says that seven shuffles, which is a very small number, is essentially enough to put a deck in like extremely close to uniformly random order.”