Consecutive Coin Flips – Numberphile

Consecutive Coin Flips – Numberphile


We’re going to talk about coin flipping. Lets say you got two people. You got Person A Person B, right, they’re flipping coins. Let’s say one of them is flipping coins and waiting for Heads-Heads to turn up right, so they’re going to make a sequence of coin flips, and they’re waiting for Head-Heads. Person B, he’s doing it and he’s waiting for Head-Tails. So one of them is waiting for Head-Heads, and one of them is waiting for Head-Tails. Now, what’s the probability that you’re gonna get Heads-Heads? Now even Brady would probably know this. What’s the probability you get Heads-Heads? Brady: Is it one in four? Yeah yeah exactly. So it’s one in four, and Heads-Tails it’s the same, right? It’s one in four. Even though they have equal probability I claim your average waiting time for Heads-Heads is going to be longer than for Head-Tails. Let’s do it, let’s do the experiment. Let’s not just write out mathematical formula. Let’s do it let’s go. I’m gonna flip this coin. Now this is, we’re gonna do an average. I wanna do a long sequence and we’re gonna see what the average is. So if I flip this coin, let’s say 50 times, is a nice long number. Then we’ll be able to take an average of how long we have to wait for Heads-Heads or Heads-Tails. Right, so we do this if it… actually this is gonna take me ages, isn’t it? So instead of flipping this one coin 50 times what i can do is I can flip 50 coins all at once alright which I’ve just done there, OK? The First coin is a Tails alright. Second coin is, without looking, it’s a Heads. Alright, next coin is Tails, I’m gonna a sequence like that. Not even Looking. We’ve run out of space we better do another. Let’s make them random. Right, so I poured them out, I tried not to look at them, so it should be a sequence of random coin flips. I better write out so we can see what they are a bit better. Tail…Head…Tail…Head…Tail…and a Head and a Tail and a Tail…Tail…Head…Tail Alright, we’re gonna look at this sequence and we’re gonna play the game where tossing a sequence of coins. And we’re waiting to see how many, how long we have to wait for Head-Tail. If i start here I’m looking for a Head-Tail, Oh, there it is. Right. Alright that’s my first Head-Tail there. That was a waiting time of three and then i got Head-Tail, then I start agina OK. I do a new game I’m gonna look for Head-Tail, and I had to wait one two three four, and there it is. Now i’m gonna do it again, oh look this one is straight away look Head-Tail. Now I’m gonna start again. I’m looking for Head-Tail. Ooh this is a long wait here. And then there it is Head-Tail. And Head-Tail there…there…there it is. Oh and there’s one right at the end as well. Right, what was the average waiting time. Let’s have a look at the waiting time. So that’s about an average wait of 4.5 . Lets look at the Heads-Heads though. You would have to wait, ooh how long? Ooh this is a long waiting time here. It happens all the way over here. There Heads-Heads, which was a long wait. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15. So you’ve player a game and it ends when you get Head-Heads. Great, done. So now start a new game, a completely different game form this point on. So we’ll just start again, oh, but this time notice there the Heads-Heads comes up really quickly. Look at that, it’s just straight away. And now we start a new game OK. So we had a success, we’ll start a new game and we have to wait 1, 2, 3 let’s look for our average waiting time for Heads-Heads, OK. Which is 7, right. And yes, oh look, yes.You have a longer average waiting time for Heads-Heads than you do for Heads-Tails even though they have an equal probability, they’re both one quarter. Why is this? You can kind of see what that reason is from this, this sequence. Because if you noticed when we were doing it, when you play Heads-Tails you get Heads-Tails, then you start a new game and you wait for Heads-Tails, and you start a new game. Heads-Heads was slightly different, when we did it with Heads-Heads look what happened here. when you have something like this: Heads-Heads-Heads-Heads we have this overlap. And this overlap isn’t counted, we were playing it until we got Heads-Heads and then the game stopped. And then we play a new game from that point. So here we’ve got a Heads-Heads, that didn’t get counted as a Heads-Heads. So if you look at how many Heads-Heads we’ve got it should about an equal number to Heads-Tails but the overlaps don’t get counted. Let’s just check. How many Heads-Tails did we have? Actually we know we got 11, i know for a fact we got 11. How many Heads-Heads did we have, including the overlaps? One here, we have two, we have three. So if you actually count up the Heads-Heads we had 9 of them, but only 6 were included in our waiting time average. So this sequence, we were looking at what would happen for consecutive values so Head-Heads, Heads-Tails. The same sort of thing would happen with Tails-Heads and Tails-Tails. We’re look at consecutive values, in fact the reason I mentioned this is because if you remember there was that prime news where they were looking at primes, and the ending of primes for consecutive primes. This is what they were looking for, they thought if primes were random like coin flips I’m going to find this effect. What turned out to be the case is that they didn’t find this effect because the primes weren’t being random like coins. If you did this forever, if you had a sequence that went on to infinity the average waiting time then is I’ll show what that is. It’s called expectation or expected waiting time. The expected waiting time for Head-Tails is equaled to 4 Which kind of make sense when it’s a quarter probability. That does make sence. And then the expected waiting time for Heads-Heads is longer, and it’s 6. So we were close but just a little off. And if you wanted the expected waiting time for Tails-Tails, well that’s 6 as well. That’s just the same idea. Brady: Audible’s ever growing collection of books and other spoken material has now reached in the order of 250,000 titles. So no matter what what you’re interested in Audible’s bound to have multiple options for you. Now I spend a lot of time driving, as you can see here, often in the UK’s delightful traffic and there are few better ways to pass the time than listening to audiobooks. You can have something entertaining, something educational, or maybe a bit of both The choice is yours. I particularly enjoy books about mountaineering. These titles here about Mount Everest are very good. I’ll put their details in the description, along with this one about K2 which is one of my favourites as well. And that’s just a fraction the the mountaineering books on Audible. I told you they’ve got something for everyone. If you’d like to give them a try go to audible.com/numberphile and you can sign on for their free 30 day trial. That trial includes your first book and, as I said, there are plenty to choose from. that address again audible.com/numberphile so they’ll know you came from our channel, which is handy for us. and then the free trial for 30 days. Our thanks to Audible for supporting this episode of Numberphile. Maths works, maths just works, it’s wonderful that way how maths just works out Brady: Every time. Every time just how you want it to work out. Especially with the power of editing. Brady: What happened? What happened, we did out first take and we got the opposite result from what we wanted. Brady: It’s done you 48 over 11, which is the opposite of what I said. And we have to film the whole thing again, right?

99 thoughts on “Consecutive Coin Flips – Numberphile”

  1. It was easy to see because whenever you miss your tails after flipping heads in a heads-tails game, you just flipped heads again and you dont have to start over, so whenever you flip a tails you are done, but when you miss your second heads in a heads-heads game, you flipped tails so you have to flip heads again before you could flip your second heads.

  2. This reminds me of something I was talking about last night with a friend. We spoke of how birth control works %99.9 of the time. Which means 1 out of 1000 times it won't work. So I'm wondering what the average wait time for that 1 time out of 1000 occurrence is.

  3. i'm just at the start and i did some calculations … exp wait for HT = 4, exp wait for HH = 6. Am I right?

  4. At least you came clean about it, but doing experiments until the 'correct' result is reached seems a bit dodgy — sounds like pharmeceutical trials or something …

  5. Interesting that if you divide the 42 turns by the 9 actual occurrences of HH you get 4.667, so very close to the HT's 4.5

  6. Would Numberphile like to do something about maths in film or music. I was thinking of the song Affirmative action which has abyssmal maths in it. There must be other examples.

  7. It's a little bit wrong way to do this, becouse you are counting not just {1,2},{3,4},{5,6}…{49,50}, but also like {2,3},{4,5} ant cetera…

  8. The problem I have is even before he started looking, they had counted 20 heads and 30 tails. I dont think it guarantees more HT (because of the whole "pattern found, new game" rule), but I suspect it skews the probability. Needs a population that matches 50% of each more closely.

  9. I think another reason that this effect may take place is because as soon as you get a head you've basically got it. Should you get heads and then not 'win' per say, you've got another head, until you win and get a tail, so in a way you're only waiting for that 50% flip after you get heads.

    H – need tails
    HH – a tails next still works
    HHH – so on
    HHHT – got it

    Whereas with double heads the chance resets in a way when you get tails.

    H – need heads
    HT – resets, now need another two heads
    HTH – need heads
    HTHH – got it

    Correct me if i'm wrong.

  10. while I watch him drive at the end of the video I keep thinking "CHANGE LANES! YOU'RE ABOUT TO CRASH HEAD ON"

  11. Wait wait wait wait wait…. So for example… If I were to play a game, say for money, points, score, or whatever, and I had to guess the next outcome of something that is basically 50:50, and let's say I put my money on heads. It there a greater chance of heads showing up if I wait until tails were to be played 10 times in a row rather than, say 2?
    Which should I bet on for heads? (picture below)
    TT_?
    or:
    TTTTTTTTTT_?
    or maybe even:
    TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT_?

  12. hey, James. Great vidz. You changed the way I look at infinitesimals and limits over the course of a month in a very positive way. Thanks. please check out my math discovery on Facebook using the hash tag
    perfectcompression
    (not a video)
    Cheers.

  13. There is NOTHING random about flipping coins. It is a controlled action. Your level of control dictates the results. Given this, his experiment is not valid and should not be considered a reliable source of information Sorry but he's still entertaining.

  14. Ok.. the important concept here is "idealized".. We can replace coin fliping by a idealized 50/50 event.. for this situation we obtain that expect times (sorry for my english)..

  15. +singingbanana: That's how maths works, right? If you don't get the result you want, you start over…? 😉

  16. Nice technique to avoid flipping. Well done! I think an even better and easier way would have been to take big handfuls out at once and "interleave" them in your hands into a stack — from which you could then spread them out. There would be no possibility that way of "unintended" arranging because you wouldn't even be able to see the order.

  17. head – tail is the same as tail – head. Therefore, there are two outcomes that meet the requirement. 2 possiblilities for each flip so the probability for 1 tail and 1 head is 2 / 4 = 50%

  18. If the temperature today is zero degrees Celsius and tomorrow will be twice as cold as today. What will be the temperature tomorrow?

  19. it is a somewhat ill-defined problem. The search should restart after the first coin-flip, not the last – then all the overlaps get counted and it works for sequences of any length.

  20. Isn't heads tails more likely than heads heads in part because you started out with more tails than heads in this particular set? You had 30 tails and 20 heads. That is 1.5 tails for every head.

  21. Could you guys explain why if I had a bag of counters(9 red 1blue) and I pulled one out and put it back then obviously I'm more likely to get red, however if I were to do this lets say 1,000,000 times and I happen to get red every time then technically that is more likely (because there's a 9/10 chance each turn) to happen but at the same time not likely to happen because eventually you'd expect to pull out a blue one (I'm confused because the probability every turn never changes but over the course of 1,000,000 turns does it get more and more likely that I would pull out a blue counter?)

  22. I just saw your video "Fibonacci Mystery" talking about the reminders and such.
    I would love to see the Math guy talk about Fibonacci if we were using "Base 12 " (dozenal) instead of our normal decimal one.
    Dou dou dou dou

  23. I know a similar problem to this:
    If one person bets for HH to come first and the other person for TH, then TH will win in 75% of the games.
    But with HH vs HT, both are 50% to appear first!

  24. So I was playing with primes earlier, specifically prime factors of 2 consecutive numbers. I was looking for two consecutive numbers who had all the previous prime numbers in their factors. ergo 2×3, 5×6, 14,15 etc
    naturally the numbers got exponentially larger. while I was calculating for 2x3x5x7x11x13 I came across 714×715 which has only the singular factors up to 13 AND 17. did I miss a set? is there a formula to calculate two consecutive numbers and their primes without doing it trial by error?

  25. What utter rot. Heads will follow tails as often as tails will follow heads.If there is an equal chance of the same or different outcome, the subsequent outcome is 1/2. You can't say that the chance of winning is 1/3 and the chance of losing is 2/3 so the chance of neither is 2/3 – 1/3 = 1/3.

  26. I watch numberphile to go to sleep. I don't know If that's a compliment because I watch them all the time, or more of an insult because they put me to sleep.

  27. Is it always 1.5 x 2^(number of coins) for consecutive coins? So E(HHH) would be 12, E(HHHH) would be 24, etc.?

  28. I feel like there's a simpler way to understand this. If you are going for HT, then as soon as you flip a heads, you've basically won. You have a 50% chance of winning, but if you lose, you still have another heads. You're back to a 50% chance of winning. With HT, once you get a heads, EVERY flip is a possible winning flip. With HH, this isn't the case. If you flip a heads, then you have a 50% chance of winning. If you lose, there's a ZERO percent chance of winning the next flip. With HH, only SOME of the flips are winning flips. And if you look at the Expected waits, you can see that "some" is about 2/3.

  29. Why would you mention the prime sequence? The coin toss effect happens because the described outcomes are not independent of prior tosses. Primes are independent of prior primes, are they not? Without knowing the distribution of primes how would this approach help?

  30. How did you calculate the expectations at the end? I'm guessing the wait times are modeled after an exponential distribution, but I"m curious how you got lambda = 6 for HH.

  31. Are players playing entirely independent games? Because if you say that either condition wins, stops the game for both players, then a new game starts for both players, you get a different result with this example.
    So we're betting, I take HH and you take HT, and if EITHER comes up, the game is over and resets with the next sequence being a new game for both players and sequences. In that condition, you get the following:
    HT – win in 7, HT – 2, HH – 6, HH – 2, HH – 3, HH – 2, HT – 6, HH – 3, HT – 4, HT -2 , HH – 5, HT – 2, and HT – 6.
    HT wins 7 times, HH wins 6.
    The average waiting time for HT is 7+2+6+4+2+2+6 = 29. And 29/7 = 4.14
    The average waiting time for HH is 6+2+3+2+3+5 = 21. And 21/6 = 3.5
    Just like you couldn't count the overlapping HH's in the way you played it, here you can't count the HTs where the H is the second in an HH series (which knocks out 4 of the HTs). In this example, as a unified game, HH comes up slightly less often, but faster when it does.

  32. So every time you flip a heads you have a 50% chance to get the head-tails combo on the next flip but it's less than 50% chance to get heads-heads on on the next flip from any particular heads since the previous coin might have just been a heads and you reset the the game.

    But… if I and a pal sit down and the game is to see whose pattern appears first, either heads-heads or heads-tails, it's an equal shot for each of us as to which one comes out first.

  33. S1 : last one is tail or first time toss
    S2: last one is head

    first start with S1 S1 has 1/2 chance to go S2 and 1/2 chance to go S1
    Expected toss form S1 is
    S1 = 0.5 S1 + 0.5 S2 + 1 <- 1 toss to change state
    for HT S2 = 0.5 S2 + 1
    S2 = 2
    S1 = 4
    for HH S2 = 0.5 S1 + 1
    S2 = 4
    S1 = 6

  34. If anyone wants a clue as to how to solve E( waiting time for HH) using the definition. Here it is: Fibonacci sequence!

  35. I mean, in a way, the primes do act in this way. Coins don't "like" to repeat themselves in a sense that you don't count all of the HH or TT's and primes don't like to repeat themselves on average.

  36. The fact the coins didn't fall for your little game the first time is an example of probablility. Just because something is more likely doesn't mean it will happen. But you guys are waaay too smart and already know that.

  37. Since he is talking about the probability being one quarter I cant help but think that this entire video would have been a lot funnier had he used quarters for this.

  38. I think you are missing something here. If you flip the coin 10 times, you can get a max of 5 HT. You can, however, get a max of 9 HH when counting the overlaps. Without overlaps, the chance of getting HH and HT are the same.

  39. Ignored here is the possibility of a coin landing to rest on the edge, which is a real possibility on a truly flat floor.

  40. So it's a Laplace experiment.

    There are 4 ways to flip 2 coins.

    Leaving you with a 8 digit sequence of like

    TTTHHTHH…. And there are a set number of permutations for this 8 digit sequence with 4of each.

    And to get to the 6 wait time you need to take the probability of HH (0.25) and multiply it by the joint probability of THHH and HHHH and also subtract HH again.

  41. He mentioned prime numbers and 4 and 6 but didn't mention that prime numbers conform to 4x + or – 1 and 6x + or – 1.

  42. I have made programm which does the same. It calculates medium values. I can declare that this video – true.
    After 1000 elements programm shows only 4 and 6. If you input big numbers (9999), you can see that Probability seeks for 4 and 6:

    Enter Size of Array: 99999

    Enter Size of Array: 99999

    HT: 24947 //HT counter

    HH: 16624 //HH counter

    HT_RESULT: 4.00838 //Medium values

    HH_RESULT: 6.00522

    (Sorry if my English is bad – I am from Russia)

  43. Dude I just made Siri flip a coin and got heads 11 times in a row and it made me think of this video and mat Parker's video on the same topic. I screenshotted all of it

  44. Thanks to all who explained the 4 and 6, got it. But, this same series of flips yield a much different result if you had chosen TT instead of HH, so….? Just would've needed more flips to get to the proper average?

  45. If E(HT) = 4 "because the probability is 1/4" then why is E(HH)=6? Is the probability of HH not 1/4 also?

  46. I would love to know the answer to this question.
    Are the odds of getting the combination you have there the same as the odds as getting all heads or all tails?

Leave a Reply

Your email address will not be published. Required fields are marked *