Saturday, July 26, 2014

Coin Flips and Probability I

Coin flips and probability. What could be easier? Each flip, a 50/50 chance with a fair coin. The chances of two heads in a row: ½ for the first flip, and ½ of that for the second flip. Half of a half = ½ * ½ = ¼.

It can get a little bit harder than that, though. Let’s try a bar bet. We’re dealing with a fair coin, and nobody trying to cheat or control the flip. Someone says that if you flip two heads within the first eight flips, you win a dollar. So if you get HTTHH, you win! Is that a good bet? What if it were fifteen flips, or five? What kind of number would make this a fair bet?
You don’t know? OK, that’s fair. But there has to be a number, right? We’re in algebra-land, so we’re going to call that something. Let’s call the average number of flips before you get two heads in a row is x.
So, what can happen when you flip? Maybe the first flip you get is tails. That didn’t help. You still expect to need as many flips as you did before you started.
It didn’t help you get HH, but it did help us figure out something. When you flip tails (a ½ chance), you already had one flip and you’re going to need an average of x more flips. Now we’re getting somewhere.
OK, what else could happen? Clearly, you could flip heads first. Then you could flip heads again, and win! OK, in that case, you used two flips, and the chance of that happening are ¼. Or you could flip tails the second time. Ugh. The chances of that happening are also ¼. You used two flips, and you’re back where you started (you need an average of x more flips).
And…those are the only things that can happen. You get tails (and start over) or you get heads. If you get heads, your next flip is either heads again (and you’re done) or tails (and you start over).
(chanceOfHH)(expectedFlipsForHH) + (chanceOfHT)(expectedFlipsForHT) + (chanceOfT)(expectedFlipsForT) = expectedNumberOfFlips
We pretty much know everything we need to know now:
expectedNumberOfFlips = x – that’s what we called it
chanceOfHH = ¼
expectedFlipsForHH = 2 – we flipped two times and we’re done
chanceOfHT = ¼
expectedFlipsForHT = 2 + x – we wasted two flips and now we’re starting over
chanceOfT = ½
expectedFlipsForT = 1 + x – we wasted one flip and now we’re starting over
So if we fill those values in so it looks like real algebra, we get:
¼(2) + ¼(2 + x) + ½(1 + x) = x
This would look prettier if we multiplied both sides by 4:
2 + (2 + x) + 2(1 + x) = 4x
Simplify:
2 + 2 + x + 2 + 2x = x
6 + 3x = 4x
Subtract 3x from both sides:
6 = x
So the average number of flips you need to get two consecutive heads is 6. Now off to the bar with you: there’s money to be won.

No comments:

Post a Comment