Law of Large Numbers

Why it’s Hard to Get Rich Playing the Coin-toss Game

The Law of Large Numbers is a fundamental rule of statistics. It’s also a pretty good rule of thumb for how things tend to work in real life. This Wikipedia article explains this law in great mathematical detail, but most of us are already quite familiar with it.

If you flip a normal coin, there is a 50% chance that it will come up heads, and a 50% chance that it will come up tails. If you flip the coin a small number of times, there is a chance you will have a winning streak (five “heads” in a row if you are betting on heads) or a losing streak (five “tails” in a row if you’re betting on heads). At the same time, most people instinctively know that if you flip the coin 500 times, there’s a pretty good chance that it will be heads-up around 250 of those times, give or take a few.

This is why even the most hardened gambler stays away from the coin-toss game.

Here is a chart showing what fraction of “heads” you might get if you flip a coin 500 times. (Refresh the page for 500 new coin flips.)


But what if you change up the game? Now let’s say that instead of tossing one coin 500 times, you toss two coins 250 times each. The first coin is a normal coin, but the second coin is weighted so that it comes up heads 90% of the time. As the coins are tossed the number of total heads and tails for both is added up. Since the average of 50% and 90% is 70%, you will see a graph that looks something like this. To anyone looking at this graph, it will look like you were tossing a single coin that was weighted to be heads-up 70% of the time. (Refresh the page for 500 new coin flips.)


But what if you add up the tosses from the two different coins separately? First the tosses from the normal coin, then the tosses from the weighted coin? Notice how the line becomes sloped instead of staying flat? This is the only way you can see that two different coins were used. (Refresh the page for 500 new coin flips.)




What does this have to do with election results?

Watching election results roll in as precincts are counted is kind of like tossing a coin. The only difference is that it’s usually not a 50/50 game, like a coin toss is – the final fraction of votes for a given candidate reflects the percentage of “yes votes” amongst the ballots cast by a great many people.

As with the coin toss though, as the number of precincts counted increases, the percentage of “yes votes” you see should soon be close to the final percentage.

At first, when the vote count is low, the numbers might be all over the map. If your candidate is Republican and the precincts from Democratic counties are counted first, things might initially look bad for your candidate.

But as the results roll in, the Law of Large Numbers will take start to take effect, and the final results will start to become clear.

You can also see how The Law of Large Numbers works AFTER an election by pulling the precinct-level results out of a hat, one by one, and adding up the results as you go. At first you might have some “streaks of luck” that will make the results bounce around a bit. For instance you may by chance pull some large Democratic-leaning precincts out of the hat first, making it temporarily look like the Democrat has an edge, even if in the end the Republican will gain the majority of the vote. But this will be temporary. As the counted votes increase things will even themselves up, and the numbers you start seeing will be very similar to the final results. The Law of Large Numbers enforces this.

Just like it does with our coin-toss game.



What if I wanted to “hack” an election?

Let’s say you are running for public office. Campaigning hard, losing sleep over poll results, wishing somehow you could get a guaranteed edge on your opponent. And then one day you get a phone call from a guy who says he can sell you a little computer program that would let you get into those electronic voting machines and change things around.

The simple program can do whatever you want it to. It can delete votes. It can add new ones. It can “flip” votes so those that should have gone to your opponent instead go to you. You can use this program to change the results of any or all the precincts.

So how do you use this magical tool?

You will need to be clever because of all the polls leading up to the election, plus the voter registration numbers by party, plus the exit polls. It would look funny if the results are too different from what is expected.

Additionally, precincts keep good track of how many ballots are cast, so it’s best not to add or delete votes. Better to flip them – change votes so ones that were cast for your opponent go to you instead.

It looks like you’re trailing 49% to 51%, so you need to do something.

But what, exactly?

Well. You know votes are counted precinct by precinct. And exit poll takers will be there at many of those precincts, hoping to make a prediction even before the polls close.

And you need to change the results by many thousands of votes in order to close that 2% gap.

Therefore, it’s best not to touch the small precincts. If only 200 people vote in a given precinct, eyebrows might be raised if you flip even 20 of the votes, because that’s 10% of the total. Which is a lot. Plus 20 votes is a drop in the bucket, compared to the number of votes you need to flip to ensure that you win the election.

Additionally, each time the “flipping” occurs you run the risk of being caught somehow. An automatic backup might catch your program in the act, or a power interruption might cause it to stop running before it has had a chance to delete itself.

So it’s much better to leave the small precincts alone, and skim the votes from the larger precincts. In a precinct where 1000 ballots are cast, those 20 votes are only 2% of the total. That’s a small enough amount to easily get lost in the noise, and you minimize the risk of somehow being caught in the act.

So you set your program to only flip votes in precincts where a certain number of votes have been cast.

It’s the only sensible way to go about this.


What does this have to do with The Law of Large Numbers?

Imagine you’re an independent researcher who wants to analyze the results of an election.

What if instead of adding up the election results by pulling the various precinct results out of a hat, you sort the results by the number of ballots cast in each precinct? Then you add up the numbers starting with the smallest precincts. You graph the results as you count them, moving to larger and larger precincts as you go.

At first you will see a lot of “noise”, as you would expect. Additionally, since small precincts tend to be in more rural areas, you may initially see more favorable results for candidates who have more appeal to rural voters.

After not too long though, the results should level out, and the lines should become very close to horizontal.

Your graph might look something like this:


What if the results have been hacked, but only in the larger precincts? If you count the results in order of precinct size, the large precincts, where votes have been “flipped” will be on the right-hand side of the graph, just like the coin flips with a weighted coin are at the right-hand side of the graph above.

The graph of an election that may have been hacked will look something like this:

See how the purple line slopes downward, and the yellow line slopes upwards? That indicates that for larger precincts, the purple candidate got fewer votes, while the yellow candidate got more votes.

This pattern indicates that votes may have been “flipped” from the purple candidate to the yellow candidate.