Imagine fighting a war on 10 battlefields. You and your opponent each have 200 soldiers, and your aim is to win as many battles as possible. How would you deploy your troops? If you spread them out evenly, sending 20 to each battlefield, your opponent could concentrate their own troops and easily win a majority of the fights. You could try to overwhelm several locations yourself, but there’s no guarantee you’ll win, and you’ll leave the remaining battlefields poorly defended. Devising a winning strategy isn’t easy, but as long as neither side knows the other’s plan in advance, it’s a fair fight.

Now imagine your opponent has the power to deploy your troops as well as their own. Even if you get more troops, you can’t win.

In the war of politics, this power to deploy forces comes from gerrymandering, the age-old practice of manipulating voting districts for partisan gain. By determining who votes where, politicians can tilt the odds in their favor and defeat their opponents before the battle even begins.

In 1986, the Supreme Court ruled extreme partisan gerrymanders unconstitutional. But without a reliable test for identifying unfair district maps, the court has yet to throw any out. Now, as the nation’s highest court hears arguments for and against a legal challenge to Wisconsin’s state assembly district map, mathematicians are on the front lines in the fight for electoral fairness.

Simple math can help scheming politicians draw up districts that give their party outsize influence, but mathematics can also help identify and remedy these situations. This past summer the Metric Geometry and Gerrymandering Group, led by the mathematician Moon Duchin, convened at Tufts University, in part to discuss new mathematical tools for analyzing and addressing gerrymandering. The “efficiency gap” is a simple idea at the heart of some of the tools being considered by the Supreme Court. Let’s explore this concept and some of its ramifications.

Start by imagining a state with 200 voters, of whom 100 are loyal to party A and 100 to party B. Let’s suppose the state needs to elect four representatives and so must create four districts of equal electoral size.

Imagine that you have the power to assign voters to any district you wish. If you favor party A, you might distribute the 100 A voters and 100 B voters into the four districts like this: