DEV Community

Gauri Chaudhari
Gauri Chaudhari

Posted on

Everything You Think You Know About Coin Flips is Wrong (and I have the data to prove it)

Quick question: If you flip a fair coin 1,000 times, how many heads will you get?

If you said "500," you're thinking like everyone else. You're also wrong.

I was reading Michael W. Trosset's book on statistical inference when I came across something wild: spinning a penny only gives you heads 30% of the time. Wait, what? Not 50%?

Like any data scientist with too much free time, I fired up R and started running experiments. What I discovered wasn't just interesting—it completely shattered my understanding of probability.
I simulated flipping a mathematically perfect coin 1,000 times. No physical imperfections, no air resistance, just pure probability with p = 0.5.

Here's what I got:

Tossing a coin 1000 times

473 heads. 527 tails.

"But that's just one run!" I hear you saying. Fair point. So I ran it 10,000 times. Only 2.58% of those experiments gave me exactly 500 heads. Let that sink in. Even with a perfectly fair coin, you get exactly 50/50 only about 1 in 40 times.
Remember that 30% thing I mentioned? Here's what happens when you compare tossing vs. spinning:

Tossing vs Spinning

When you spin a coin, physics takes over. The rotation around a vertical axis makes the coin incredibly sensitive to weight distribution. Most coins aren't perfectly balanced (the head side is often slightly heavier), so they develop strong preferences. This is why you should never let someone "spin" to decide who goes first.

Here's what they don't teach you in school: A "fair" coin doesn't mean you'll see 50/50 splits in real observations. Fair means that over infinite repetitions, you'd converge to 0.5. But we don't live in infinity. We live in 10 flips, 100 flips, 1,000 flips. And in those finite samples? Randomness dominates.

You'll see patterns that look meaningful but are actually just statistical noise. You'll see 58 heads in 100 flips and think something's wrong. You'll see someone win 7 coin flips in a row and suspect they're cheating. But the math says: this is exactly what randomness looks like.

In my full deep dive, I explored why the binomial distribution explains everything, the Law of Large Numbers in action with beautiful visualizations, how to use binomial tests to detect actual bias, and the confidence intervals that prove the coin is fair despite looking unfair. The complete analysis includes all the R code, hypothesis testing, z-scores, and some honestly gorgeous ggplot2 visualizations that show theory vs. reality overlapping almost perfectly.

Read the complete analysis with all the code, math, and charts on Medium by clicking here - Medium Article Link

And for the love of statistics, never accept a spun coin as a fair decision.

Top comments (0)