Unbiased tosses from a biased coin

This is a very handy algorithm that I came across today, which is, according to this paper, due to John von Neumann.

Tossing a coinSuppose you have a coin which you suspect to be biased. You're not sure whether it's biased to heads or to tails, you just know it's biased. Actually, according to the wikipedia article on coin flipping, coins tend to be slightly biased naturally and it's possible to train yourself to flip a coin slightly more predictably than pure chance. So there you are with a biased coin. Nevertheless, can you use it to produce unbiased tosses?

Von Neumann came up with a remarkable idea: use tosses in pairs. If the first toss of a pair comes up heads and the second tails, call the result of the pair heads. If the first comes up tails and the second heads, call it tails. If both tosses produce the same result (heads/heads or tails/tails), ignore that pair, and start over.

In mathematical terms, we assume that all the individual flips are independent. So if the probability of getting heads is p and the probability of getting tails is q, where p + q = 1, then the probability of heads followed by tails is exactly the same as the reverse result, namely pq. Since we ignore all other pairs of tosses, it means that the overall "coin pair toss" is unbiased. Note that the algorithm doesn't require you to know what the probabilities are (though obviously if it's a two-headed coin, you'll never get any unbiased tosses!).

Album cover for I Choose NoiseNow playing:
Hybrid - Keep It In The Family
(from I Choose Noise)



Posts on similar topics...

1 Response

  • Fri 29 Jan 2010
  • 6:02 PM
  •  avatar #1

Eber Irigoyen said...

I have the strange ability to be able to toss (or have someone else do it) a coin and predict with 90% accuracy (closer to 100% if I train for a while) the result, I do that by looking at the coin while in the air

Leave a Response

Some MarkDown is allowed, but HTML is not. (Click to learn more.)

  • Emphasize with italics: surround word with underscores _emphasis_
  • Emphasize strongly: surround word with double-asterisks **strong**
  • Inline code: surround text with backticks `IEnumerable`
  • Unordered list: start each line with an asterisk, space * an item
  • Ordered list: start each line with a digit, period, space 1. an item
  • Insert code block: start each line with four spaces
  • Insert blockquote: start each line with right-angle-bracket, space > Now is the time...

Search

About Me

I'm Julian M Bucknall, the M because it's my middle initial and because I and the other Julian Bucknall (the movie guy) would like to differentiate ourselves.

I'm a programmer by trade, an actor by ambition, and an algorithms guy by osmosis. I write articles for PCPlus in my spare time, not that there's much of that.

Julian M Bucknall Apart from that, an ex-pat Brit, atheist, microbrew enthusiast, Pet Shop Boys fanboy, slide rule and HP calculator collector, amateur photographer, Altoids muncher.

DevExpress

I'm Chief Technology Officer at Developer Express, a software company that writes some great controls and tools for .NET and Delphi. I'm responsible for the technology oversight and vision of the company.

Validation

Validate markup as HTML5 (beta)     Validate CSS

Bottom swirl

Archives

February 2012 (6)
SMTWTFS
« Jan  
1234
567891011
12131415161718
19202122232425
26272829

Like this Archive Calendar widget? Download it here.

Social networking

Google ads

The OUT Campaign

The OUT Campaign

My Tweets

  • LOL! RT @secretGeek: Watching the NoCss movement gain momentum
  • Blog post: More on caring less about clichés, or not http://t.co/P1Unt4y9
  • @peterritchie Oh my god, the HAIR! It's all over his head! Ewwww. /cc @MillerMark
Bottom swirl