Library · The Fiddler: Solutions · Chapter 3

Can You Gerrymander Like a Dummy?

Revised Report an error

Fiddler Nation’s election is a contest between two parties, the Suns and the Moons. You are drawing the new electoral map on behalf of the Moons, and you know exactly how every citizen will vote. There are seven districts of equal population, and the Moons win any district in which they take at least half the vote. What is the smallest fraction of the whole population that must vote Moon for it to be possible for the Moons to win a majority of the seven districts?

The Fiddler, Zach Wissner-Gross, October 16, 2026(original post)

The official solution appeared in the post of October 23, 2026 and gives 2/72/7 for the main puzzle by the same count, and 1/41/4 in the limit of many districts. The Extra Credit half of that post is paywalled, so 353/4096353/4096 is my own and has not been checked against it.

Solution

A majority of seven districts is four. The cheapest way to win a district is to take exactly half of its vote, and any Moon voter placed in a district the Moons lose is wasted. So the map that needs the fewest Moon voters packs them into four districts at exactly half each and puts none at all in the other three.

Each district holds 1/71/7 of the population, so the Moons need half of 1/71/7 in each of four districts: 4×12×17  =  27.4 \times \frac12 \times \frac17 \;=\; \frac27 . No smaller share can work, because any winning map has at least four districts each holding at least 12⋅17\frac12\cdot\frac17 of the population in Moon voters.  the Moons need 27≈28.6% of the vote. \boxed{\ \text{the Moons need } \tfrac27 \approx 28.6\% \text{ of the vote}. \ }

With 2N+12N + 1 districts the same packing needs half the vote in N+1N + 1 of them, a share of (N+1)/(4N+2)(N + 1)/(4N + 2). That falls towards 14\frac14 as the number of districts grows: a majority of a majority is in the end half of a half.

The computation

The check places Moon voters every possible way. With four voters in each district, it tries all 575^7 ways of choosing how many vote Moon in each, keeps the ways that win four or more districts, and reports the smallest total.

from fractions import Fraction
from itertools import product

# Seven districts of N voters; the Moons take a district
# with at least half its vote. Try every placement.
N = 4
fewest = min(sum(m) for m in product(range(N + 1), repeat=7)
             if sum(2*x >= N for x in m) >= 4)
print("smallest Moon share:", Fraction(fewest, 7*N))

It prints

smallest Moon share: 2/7

Extra Credit

Next cycle you can draw a map giving any win probabilities P1,…,P7P_1, \dots, P_7 for the seven districts, provided they average 12\frac12, so P1+⋯+P7=72P_1 + \dots + P_7 = \frac72. The party bosses want the map that maximises the chance of winning at least five districts; with that map, the chance of losing the majority (winning three or fewer) is LAL_A. You would rather maximise the chance of winning at least four; with that map, the chance of losing the majority is LBL_B. How much greater than LBL_B is LAL_A?

Solution

Treat the seven districts as independent, each won with its own probability. The question is then an optimisation over seven numbers between 00 and 11 with a fixed sum, and the whole difficulty is that there are infinitely many maps to compare. One observation about pairs of districts cuts them down to a short list.

Two districts at a time. Pick any two districts, ii and jj, and keep their total s=Pi+Pjs = P_i + P_j fixed while the other five stay as they are. Write π=PiPj\pi = P_i P_j for the chance of winning both, and XX for the number won among the other five. The pair wins both with probability π\pi, neither with probability (1−Pi)(1−Pj)=1−s+π(1 - P_i)(1 - P_j) = 1 - s + \pi, and exactly one with the remaining probability s−2πs - 2\pi. So the chance of winning at least kk districts in all is (1−s+π) Pr⁡(X≥k)+  (s−2π) Pr⁡(X≥k−1)  +  π Pr⁡(X≥k−2).\begin{aligned} &(1 - s + \pi)\,\Pr(X \ge k) \\ &\quad+\; (s - 2\pi)\,\Pr(X \ge k - 1) \;+\; \pi\,\Pr(X \ge k - 2). \end{aligned} Gather the terms in π\pi. Since Pr⁡(X≥k−1)−Pr⁡(X≥k)=Pr⁡(X=k−1)\Pr(X \ge k - 1) - \Pr(X \ge k) = \Pr(X = k-1), and similarly one step down, the coefficient of π\pi is Pr⁡(X≥k)−2Pr⁡(X≥k−1)+Pr⁡(X≥k−2)=  Pr⁡(X=k−2)−Pr⁡(X=k−1),\begin{aligned} &\Pr(X \ge k) - 2\Pr(X \ge k-1) + \Pr(X \ge k-2) \\ &\qquad=\; \Pr(X = k - 2) - \Pr(X = k - 1), \end{aligned} and everything else depends only on ss. With the sum of the pair held fixed, the chance of success is a straight-line function of the product π\pi. The product is largest when the two probabilities are equal, and smallest when they are pushed as far apart as they will go, until one of them reaches 00 or 11.

The short list. A best map exists, since the chance of success varies continuously over a closed and bounded set of maps. Among all the best maps, take one with as many probabilities equal to 00 or 11 as possible. Suppose two of its other probabilities, strictly between 00 and 11, were unequal. If the coefficient of π\pi is positive, making them equal would strictly improve the map, which is impossible for a best map. If the coefficient is negative or zero, pushing them apart would lose nothing and send one of them to 00 or 11, which is impossible for the best map with the most such entries. So every probability strictly between 00 and 11 takes one common value xx.

A best map can therefore be found among those with aa districts certain to be won, bb districts with the same chance xx, and the rest certain to be lost, where a+bx=72a + bx = \frac72 and 0<x<10 < x < 1. Because 72\frac72 is not a whole number, bb is at least 11, and x=(72−a)/bx = (\frac72 - a)/b is fixed by aa and bb. Only sixteen maps qualify, listed below.

sure shared chance at least at least lose
aa bb xx four five majority
0 4 7/87/8 0.5862 0 0.4138
0 5 7/107/10 0.5282 0.1681 0.4718
0 6 7/127/12 0.5098 0.2083 0.4902
0 7 1/21/2 0.5000 0.2266 0.5000
1 3 5/65/6 0.5787 0 0.4213
1 4 5/85/8 0.5188 0.1526 0.4812
1 5 1/21/2 0.5000 0.1875 0.5000
1 6 5/125/12 0.4902 0.2030 0.5098
2 2 3/43/4 0.5625 0 0.4375
2 3 1/21/2 0.5000 0.1250 0.5000
2 4 3/83/8 0.4812 0.1516 0.5188
2 5 3/103/10 0.4718 0.1631 0.5282
3 1 1/21/2 0.5000 0 0.5000
3 2 1/41/4 0.4375 0.0625 0.5625
3 3 1/61/6 0.4213 0.0741 0.5787
3 4 1/81/8 0.4138 0.0789 0.5862

The bosses’ map. The best chance of five or more comes from giving every district a chance of exactly 12\frac12. Then each of the 27=1282^7 = 128 patterns of wins and losses is equally likely, and five, six or seven wins happen in (75)+(76)+(77)=21+7+1=29\binom75 + \binom76 + \binom77 = 21 + 7 + 1 = 29 of them, a chance of 29/128≈0.22729/128 \approx 0.227. Every other map on the list does worse. With fair coins in every district, winning three or fewer is exactly as likely as winning four or more, so LA  =  12.L_A \;=\; \tfrac12 .

Your map. The best chance of four or more comes from putting everything into four districts, each won with chance 78\frac78, and conceding the other three. The majority then needs all four, a chance of (7/8)4=2401/4096≈0.586(7/8)^4 = 2401/4096 \approx 0.586, and the majority is lost otherwise: LB  =  1−24014096  =  16954096.L_B \;=\; 1 - \frac{2401}{4096} \;=\; \frac{1695}{4096} .

The gap. LA−LB  =  2048−16954096  =   3534096  ≈  0.0862. L_A - L_B \;=\; \frac{2048 - 1695}{4096} \;=\; \boxed{\ \frac{353}{4096} \;\approx\; 0.0862. \ } Reaching for five districts costs the Moons about 8.68.6 percentage points of safety in the majority. The greedy map has no safe seats at all, so its results scatter widely, and that scatter is exactly what gives it a chance at five; it also gives an even chance of falling short of four. The modest map stakes everything on four strong districts and wins the majority far more reliably, while never winning five.

The computation

The check does not use the pair argument or the short list. It searches every map whose seven probabilities are multiples of 116\frac1{16} and add to 72\frac72, in any order, 6,3756{,}375 maps in all once order is ignored. For each it computes the exact chance of every number of wins by adding districts one at a time, keeps the best map for each goal, confirms that the best map is unique, and reads off the chance of losing the majority. Both optimal maps lie on this grid, so the search should find them, and it does.

def wins_distribution(p):
    """P(exactly j districts won), districts independent."""
    d = [Fraction(1)] + [Fraction(0)]*len(p)
    for q in p:
        d = [d[0]*(1 - q)] + [d[j]*(1 - q) + d[j - 1]*q
                              for j in range(1, len(d))]
    return d

def maps(total, slots, top):
    """Non-increasing tuples of whole numbers <= top, with
    the given sum."""
    if slots == 0:
        if total == 0:
            yield ()
        return
    for first in range(min(top, total), -1, -1):
        if first*slots < total:
            break
        for rest in maps(total - first, slots - 1, first):
            yield (first,) + rest

# Every map with probabilities in sixteenths, summing to 7/2.
G = 16
lose = {}
for k in (5, 4):
    score = {}
    for m in maps(7*G//2, 7, G):
        d = wins_distribution([Fraction(x, G) for x in m])
        score[m] = sum(d[k:])
    top = max(score.values())
    winners = [m for m in score if score[m] == top]
    assert len(winners) == 1           # the best map is unique
    best = [Fraction(x, G) for x in winners[0]]
    d = wins_distribution(best)
    lose[k] = sum(d[:4])
    print(f"best for >= {k}:", " ".join(map(str, best)))
    print(f"  P(>= {k}) = {sum(d[k:])}, P(lose) = {lose[k]}")
print("maps searched:", len(score))
gap = lose[5] - lose[4]
print("LA - LB =", gap, "=", float(gap))

It prints

best for >= 5: 1/2 1/2 1/2 1/2 1/2 1/2 1/2
  P(>= 5) = 29/128, P(lose) = 1/2
best for >= 4: 7/8 7/8 7/8 7/8 0 0 0
  P(>= 4) = 2401/4096, P(lose) = 1695/4096
maps searched: 6375
LA - LB = 353/4096 = 0.086181640625
Report an error on this page

Reports are stored by Netlify. See the privacy note.