Most of my projects are on GitHub. I'm currently with the Portland Trail Blazers.


How do you, when given an unbalanced (otherwise known as unfair) coin, produce a fair result?

I was seriously at a loss as to how to even approach this problem without any type of probabilities or statistics, but then stumbled across the answer on this blog.

It turns out to be fairly easy. Just follow these steps:

  1. Flip the coin twice.
  2. If both tosses are the same (heads-heads or tails-tails), repeat step 1.
  3. If the tosses come up heads-tails, count the toss as heads. If the tosses come up tails-heads, count it as tails.

To see why this method makes even a biased coin fair, let’s pretend we have a weighted coin that comes up heads 60% of the time. If you toss it twice and throw out the result when both tosses are the same, you’re left with two possible outcomes. The probabilities of the two remaining outcomes are the same.

P(HT) = P(TH)
P(H) * P(T) = P(T) * P(H)
0.6 * 0.4 = 0.6 * 0.4 = 0.24

Since both outcomes have exactly the same probability, the bias is removed. This method will work no matter how biased the coin you use, as long as there’s some possibility of it coming up either heads or tails (so no two-headed coins allowed).

This is easily one of my favorite brain teasers.