You are running for class president against a pimpled-nosed, blond
barbarian. You have given your best speech and your obnoxious opponent
has given his best speech. The teacher is about to call on the class to
vote! The time of reckoning is upon you.

As she is just announcing a hand raising in support of your opponent, you count in your head: three of your friends clearly in favor of you, three of your opponents friends, and three undecided classmates in the middle, each with a 50% chance roughly of voting for you.

If the vote is held now it will all be up to those three undecided/independent voters who gets elected. But wait! You have an idea, you shout out! "Wait wait! I have a

The teacher, unaware of your wiley ways, shrugs.

You act quickly to divide the room into three groups of three.

1. All three of your opponents friends you place in one group.

2. Two of your friends you place in another group with one undecided.

3. The remaining friend you place with the two remaining undecided.

You signal happily to the teacher, now you are ready for the votes to be cast. Remember, previously, you calculated the chance of winning as 50-50. Now, you calculate the chance of winning as 75%

Really?

Well, let's count the new probable outcomes for each voting group/district.

1. The group with all of your opponent's friends will vote for him.

2. The group with two of your friends will 50% vote 3/3 for you and 50% vote 2/3 for you which means they will go for you.

3. The final group with one of your friends and two undecided is where the action is. You know your friend will vote for you. So there are two remaining random votes. There is a 25% chance they will both vote for you so you get 3/3 making you win. There is also a 50% change only one of them will vote for you 2/3 making you win. Thus there is only one outcome remaining in which you lose. That is if both undecided voters vote against you. This only happens 25% of the time (50% x 50%).

From this voting system you may have noticed something. By grouping classmates in this way, it is possible to win the class election without getting the majority of the votes. To see this, let's imagine the independent in group 2 votes against you and one of the independents in group 3. The total votes against you is 5 while the votes for you are 4. But because you carefully constructed the groups. You win two groups out of three and still win the election.

At this point, the teacher would not be happy but it is what she agreed to so...tough luck!

So how did this happen?

There is a few ways to look at this. One is that before Gerrymandering (regrouping into districts) you had three people who could vote against you. Now, you have stuck one of those voters with two sympathetic voters causing that vote to no longer count. All that remains is two voters who both need to vote against you in order to counteract the effect having your friend in Group 3.

This ideal of rigging a class election may seem absurd but it is exactly the kind of thing establishment figure do when they rewrite voting district lines to include or exclude groups depending upon how they affect the likely voting outcome.

Redistricting though often involves the votes of thousands of people. The concept though is the same.

I have written a small simulation showing how effective Gerrymandering can be on slightly larger scales. Within the simulation I set up 10 voting districts. In each of these districts there are 40 voters. Each district goes to whoever wins the most votes within that district. A total win is calculated by whoever wins the most districts.

The net affect is a certain loss in Districts 1 and 2 but a better than prior outcome in the remaining districts (you actually almost always win in this scenario if the popular vote is split 50-50). In order to calculate expected outcomes, I repeat the simulation 200 different times under each voter preference scenario (lean) and gerrymandering scenario and average the number of wins across simulations.

Something interesting happens at the fifth district gerrymandered. We have now gerrymandered half of the districts. At this last step we now are penalized for gerrymandering by 5 points. I do not have an easy explanation at this time.

In reality the practice of gerrymandering is much more complicated and subtle than this. There are typically restrictions on how you can group individuals, usually based on geography. Likewise you don't know how individuals are going to vote but you may have a pretty good idea how certain demographics are likely to vote. This complicates the methods. But I am sure there are "social engineering" or "vote engineering" firms out there that are able to exploit some of the strategies outlined here and other strategies in order to maximize the effect of gerrymandering.

That said, the classroom example and the simulations above capture the essence of gerrymandering. Gerrymandering is the practice of grouping voters together in such a way as to prevent those who are voting against you from having a vote. As such, gerrymandering is an enemy to democracy.

It is typically used by establishment candidates to insulate themselves from challengers. This allows establishment figures to feel that their seat is safe even when they accept private or political payoffs for voting consistently in ways which are against the good of their constituency.

(Code on Github)

As she is just announcing a hand raising in support of your opponent, you count in your head: three of your friends clearly in favor of you, three of your opponents friends, and three undecided classmates in the middle, each with a 50% chance roughly of voting for you.

If the vote is held now it will all be up to those three undecided/independent voters who gets elected. But wait! You have an idea, you shout out! "Wait wait! I have a

*fun*idea. How about we vote in three groups of three? The winner of the most groups wins the election", you suggest.The teacher, unaware of your wiley ways, shrugs.

You act quickly to divide the room into three groups of three.

1. All three of your opponents friends you place in one group.

2. Two of your friends you place in another group with one undecided.

3. The remaining friend you place with the two remaining undecided.

You signal happily to the teacher, now you are ready for the votes to be cast. Remember, previously, you calculated the chance of winning as 50-50. Now, you calculate the chance of winning as 75%

Really?

Well, let's count the new probable outcomes for each voting group/district.

1. The group with all of your opponent's friends will vote for him.

2. The group with two of your friends will 50% vote 3/3 for you and 50% vote 2/3 for you which means they will go for you.

3. The final group with one of your friends and two undecided is where the action is. You know your friend will vote for you. So there are two remaining random votes. There is a 25% chance they will both vote for you so you get 3/3 making you win. There is also a 50% change only one of them will vote for you 2/3 making you win. Thus there is only one outcome remaining in which you lose. That is if both undecided voters vote against you. This only happens 25% of the time (50% x 50%).

From this voting system you may have noticed something. By grouping classmates in this way, it is possible to win the class election without getting the majority of the votes. To see this, let's imagine the independent in group 2 votes against you and one of the independents in group 3. The total votes against you is 5 while the votes for you are 4. But because you carefully constructed the groups. You win two groups out of three and still win the election.

At this point, the teacher would not be happy but it is what she agreed to so...tough luck!

So how did this happen?

There is a few ways to look at this. One is that before Gerrymandering (regrouping into districts) you had three people who could vote against you. Now, you have stuck one of those voters with two sympathetic voters causing that vote to no longer count. All that remains is two voters who both need to vote against you in order to counteract the effect having your friend in Group 3.

This ideal of rigging a class election may seem absurd but it is exactly the kind of thing establishment figure do when they rewrite voting district lines to include or exclude groups depending upon how they affect the likely voting outcome.

Redistricting though often involves the votes of thousands of people. The concept though is the same.

I have written a small simulation showing how effective Gerrymandering can be on slightly larger scales. Within the simulation I set up 10 voting districts. In each of these districts there are 40 voters. Each district goes to whoever wins the most votes within that district. A total win is calculated by whoever wins the most districts.

The net affect is a certain loss in Districts 1 and 2 but a better than prior outcome in the remaining districts (you actually almost always win in this scenario if the popular vote is split 50-50). In order to calculate expected outcomes, I repeat the simulation 200 different times under each voter preference scenario (lean) and gerrymandering scenario and average the number of wins across simulations.

Something interesting happens at the fifth district gerrymandered. We have now gerrymandered half of the districts. At this last step we now are penalized for gerrymandering by 5 points. I do not have an easy explanation at this time.

**Conclusion**In reality the practice of gerrymandering is much more complicated and subtle than this. There are typically restrictions on how you can group individuals, usually based on geography. Likewise you don't know how individuals are going to vote but you may have a pretty good idea how certain demographics are likely to vote. This complicates the methods. But I am sure there are "social engineering" or "vote engineering" firms out there that are able to exploit some of the strategies outlined here and other strategies in order to maximize the effect of gerrymandering.

That said, the classroom example and the simulations above capture the essence of gerrymandering. Gerrymandering is the practice of grouping voters together in such a way as to prevent those who are voting against you from having a vote. As such, gerrymandering is an enemy to democracy.

It is typically used by establishment candidates to insulate themselves from challengers. This allows establishment figures to feel that their seat is safe even when they accept private or political payoffs for voting consistently in ways which are against the good of their constituency.

(Code on Github)