Open Side Menu Go to the Top
Register
538 riddler question about coin flipping game 538 riddler question about coin flipping game

08-06-2018 , 06:01 PM
I work with a few math PhDs who insist the answer to this question is 100%. Anyone think differently?

Quote:
I flip a coin. If it’s heads, I’ve won the game. If it’s tails, then I have to flip again, now needing to get two heads in a row to win. If, on my second toss, I get another tails instead of a heads, then I now need three heads in a row to win. If, instead, I get a heads on my second toss (having flipped a tails on the first toss) then I still need to get a second heads to have two heads in a row and win, but if my next toss is a tails (having thus tossed tails-heads-tails), I now need to flip three heads in a row to win, and so on. The more tails you’ve tossed, the more heads in a row you’ll need to win this game.

I may flip a potentially infinite number of times, always needing to flip a series of N heads in a row to win, where N is T + 1 and T is the number of cumulative tails tossed. I win when I flip the required number of heads in a row.

What are my chances of winning this game? (A computer program could calculate the probability to any degree of precision, but is there a more elegant mathematical expression for the probability of winning?)
538 riddler question about coin flipping game Quote
08-06-2018 , 06:54 PM
Spoiler:
The probability to win immediately after the tails seen is k-1 (ie deliver a k streak of heads) and not before is equal to the probability to fail all previous streak attempts and then win the last one where you needed k.

This is equal to probability fail first * probability fail second * probability fail third ...*probability succeed k streak.

Every time you fail, tails are increased by one so the two events are connected that way 100% of the time.

So the chance to fail all the previous streaks and win the k-th is

p(k)=Pfail1*Pfail2*...Pfail(k-1)*P succeed K

=(1-1/2)*(1-2/2*2)*(1-1/2^3)*(1-2^4)*...(1-2^(k-1))*2^k

The probability it takes more than k to win is
the chance to need k+1,k+2,k+3 etc to infinity. So p(k+1)+p(k+2)+...

That is definitely less than 1/2^(k+1)+1/2^(k+2)+....=1/2^(k+1)*1/(1-1/2))=1/2^k.

For you to be possible to lose that game you must have that probability to need more than any number imagined is finite and greater than zero ie some given number q>0. But 1/2^k tends to 0 as k tends to infinity. So the probability to need more than any number of streaks over k is going down to 0 as k increases. So it wont happen. You wont lose. It doesnt have a lower bound greater than zero. To be able to fail you need to have some fixed probability q>0 to reach any number of streaks imagined.

So you win 100% of the time eventually.

Last edited by masque de Z; 08-06-2018 at 07:15 PM.
538 riddler question about coin flipping game Quote
08-06-2018 , 08:37 PM
Quote:
Originally Posted by Parlay Slow
I work with a few math PhDs who insist the answer to this question is 100%. Anyone think differently?

Since there's no way for you to lose, the probability of winning is 1-P(losing) = 1-0 = 1.

Of course there's also the probability of not winning. The probability of winning before you reach the n'th tail is

(1/2) + (1/2)^2 + (1/2)^3 + … + (1/2)^n

That sequence gets a close to 1 as you want for n large enough. So the probability of not winning before the nth tail gets as close to 0 as you want for large n. Therefore, any hypothetical non-zero probability for not winning is proven too large (so false) by choosing n large enough. Therefore, the probability of not winning is 0.


PairTheBoard
538 riddler question about coin flipping game Quote
08-06-2018 , 09:35 PM
Spoiler:
Did not look. How about: lim toss -> 100%?

Seriously, the row of heads increases relatively slower than the fixed 50 percent of tossing tails. If the row of heads would increase by 2,4,8,16, etc for every tails I'd say we could have a different situation.

This was the intuitive part, now I'll look at the "real" answers!
538 riddler question about coin flipping game Quote
08-06-2018 , 11:59 PM
Quote:
Originally Posted by Parlay Slow
I work with a few math PhDs who insist the answer to this question is 100%. Anyone think differently?
You can prove that the probability of winning is 100% if you never quit by thinking about a series of independent games that all start whenever you flip a tail.

After the T-th tail, you win by flipping T+1 heads in a row. But if you flip a tail at any point you stop and play the next game. The probability of winning the T-th game is 1/2^{T+1}

The probability of winning while never stopping is 1/2 + 1/4 + 1/8 + ... = 1.

However...

Spoiler:
I think your longest streak of heads grows logarithmically with the total number coinflips. But your streak-to-win grows linearly (after N flips, you expect to have had N/2 tails). So it seems that there will come a point where you're pretty much never going to win.

This problem makes me think of the St. Petersburg paradox.

https://en.wikipedia.org/wiki/St._Petersburg_paradox
538 riddler question about coin flipping game Quote
08-07-2018 , 02:19 AM
Not offering an elegant solution but felt obliged to stop the "p=1" nonsense. You don't win 100% of the times.
Spoiler:

This is similar to risk of ruin problem. Intuitively you might think that you eventually win, but that's not the case because as the farther you go, the more difficult is to win (like in the RoR: if you start winning, there is a chance that no bad run can stop you).

Here is easy to realize that p<1. You can define a state by the number of tails T tossed so far. For each state, you either win with probability 1/2^(T+1) or you reach state T+1 with probability 1-1/2^(T+1). So, winning after state 0 is 1/2 and winning after state 1 is 1/8. As you can see, the first two terms of the series let you realize that the series itself doesn't converge to 1. The next term is 3/64 and so on. I'm both way too lazy and unskilled to give a closed form solution. However, a simple script is sufficient to give an approximate solution (~ 0.7112119049).

Code:
n<-1000
probs<-numeric(n)
probs[1]<-1/2
currentsum<-1/2
for (i in 2:n) {
	probs[i]<-(1-currentsum)*(1/2)^i
	currentsum<-currentsum+probs[i]
}
currentsum
#[1] 0.7112119
538 riddler question about coin flipping game Quote
08-07-2018 , 03:50 AM
I calculated above the probabilities to win on a k streak as (k>=2)

(1-1/2)*(1-2/2^2)*(1-1/2^3)*(1-2^4)*...(1-2^(k-1))*2^k


I was in a hurry to leave home earlier and didnt do a thorough job to properly sum the series.

N[Sum[Product[(1 - 1/2^k), {k, 1, m}]*1/2^(m + 1), {m, 1, Infinity}],
20] + 1/2

The answer isnt apparently in closed form easily reproduced in terms of known constants but it is to 20 digits

0.71121190491339757872

My post above is correct in the finishing k streak probability terms but then my argument is wrong in how this secures win 100%. Summing the terms is what delivers the answer.

To formally establish the win probability is less than 1 (or that the above sum converges to less than 1) all you need is to say that the first time its 1/2 then its 1/2*(1/2)*(1/2) and then every new term is less than 1/2*1/2^k for k>=3

This makes it less than 1/2+1/2*1/2^2+1/2*((1-1/2^2)*1/2^3+1/2*(1-1/2^2)*(1-1/2^3)*1/2^4+...<1/2+1/8+1/2^3*(1/2+1/2^2+1/2^3+...)=1/2+1/8+1/2^4*1/(1-1/2))=3/4

Last edited by masque de Z; 08-07-2018 at 04:06 AM.
538 riddler question about coin flipping game Quote
08-07-2018 , 06:02 AM
By the way my earlier argument would have worked if i had talked about the probability to find yourself not having won yet even after any big k streak demanded as some nonzero q. The mistake was to instead finish it with a win. The correct argument requires not a win yet. Clearly losing requires to establish that there is a finite nonzero probability q to reach any streak. That was what i was thinking about and got mixed up the wrong way while i was in a hurry to end the post.

There is also a clue that for a series that doesnt look an easy one, to sum up to one some very weird identities need to be included that is not going to happen usually.

Here is what i should have done along this line;

The probability one never wins is

limit n->Inf (1-1/2)*(1-1/2^2)*(1-1/2^3)*.....(1-1/2^n)=0.28878809508660242128 (to 20 dig)

That infinite product becomes an infinite sum if you take the log and all you need to show is that it converges (to prove the product is not tending to 0).

That is show that the series sum of log(1-1/2^n) converges which is easy to show because log(1-1/2^n)~-1/2^n for big enough n and this sum is geometric so it converges.


Ps: Please do not call the error in thinking as nonsense, especially if it has the correct elements in it. It is precisely studying the way the brain makes an error given the setting it produces it, how we can ultimately create an unbeatable empire of super strong intellect that self corrects itself, eternally persistent in healthy skepticism and reverse engineering consistency.
538 riddler question about coin flipping game Quote
08-07-2018 , 06:54 AM
Quote:
Originally Posted by masque de Z
Ps: Please do not call the error in thinking as nonsense, especially if it has the correct elements in it. It is precisely studying the way the brain makes an error given the setting it produces it, how we can ultimately create an unbeatable empire of super strong intellect that self corrects itself, eternally persistent in healthy skepticism and reverse engineering consistency.
You are totally right and I apologize for it. I actually didn't read your post, but just the conclusion. You basically solved the problem. Had I read with attention your post, I would have just outlined the correct outcome given your argument (which is basically the same as mine).

I just used "nonsense" because I was pretty surprised to see such an agreement for the wrong thesis. Sorry again to everybody for the use of that word.
538 riddler question about coin flipping game Quote
08-07-2018 , 08:57 AM
Not winning is not an event, and therefore neither is winning. Strictly speaking, it is nonsense to speak of either having a probability. It only makes sense to speak of the probability of winning or not winning after a certain number of flips.
538 riddler question about coin flipping game Quote
08-07-2018 , 09:07 AM
You're all idiots. The answer is

1 - φ(0.5) = .7112119049133976...

where φ is the Euler function. Since that's a special case of the q-Pochhamer, you can evaluate it at wolframalpha as 1-QPochhammer[.5].

Last edited by Mathematical Dick; 08-07-2018 at 09:22 AM.
538 riddler question about coin flipping game Quote
08-07-2018 , 09:38 AM
Quote:
Originally Posted by lastcardcharlie
Not winning is not an event, and therefore neither is winning. Strictly speaking, it is nonsense to speak of either having a probability. It only makes sense to speak of the probability of winning or not winning after a certain number of flips.
Why not? Formally, there isn't any difficulty to define "event" an outcome based on an infinite sequence of coin tosses or consecutive bets (as for the risk of ruin theory). Probabilities of, for instance, "never going back to 0" are pretty common in random walk. There are tons of other examples of course.

In this case you could define the set of all the possible infinite sequences of coin tosses. With the reasoning shown ITT, you can prove that the ~71% (yes, you can define ratios between infinite quantities) of them can be classified as "winning" sequences.

Or, if you prefer, you can calculate the probability of winning before n flips and take the limit for n->infinity.
538 riddler question about coin flipping game Quote
08-07-2018 , 10:09 AM
Quote:
Originally Posted by nickthegeek
Why not?
Because how can the event of not winning occur?

Quote:
In this case you could define the set of all the possible infinite sequences of coin tosses.
You could, but a potentially infinite sequence of flips (as specified in the OP) does not result in an actually infinite sequence of flips (which I presume are the elements of your set).

Quote:
Or, if you prefer, you can calculate the probability of winning before n flips and take the limit for n->infinity.
Sure. I'm arguing that, strictly speaking, this limit isn't the probability of anything.
538 riddler question about coin flipping game Quote
08-07-2018 , 10:17 AM
Congratulations to the winner of...
*checks notes*
...flipping coins for eternity*!

*terms and conditions may apply. 🤣
538 riddler question about coin flipping game Quote
08-07-2018 , 10:38 AM
Quote:
Originally Posted by lastcardcharlie
Because how can the event of not winning occur?
It occurs if your infinite sequence doesn't contain anywhere the required number of consecutive heads. Do not let the physical time have anything to do with it. You are thinking about you flipping coin. Of course you'll never reach the "not winning" state. Nonetheless, nowhere in probability theory you need events that last for a finite amount of time. Physical time doesn't enter in probability. Forget about it. Consider the set I defined in the previous post instead and imagine that you have access to all the sequences.


Quote:
You could, but a potentially infinite sequence of flips (as specified in the OP) does not result in an actually infinite sequence of flips (which I presume are the elements of your set).
We imagine that, no matter what, we generate an infinite sequence and only then we check if the sequence is winning or not. All the sequences starting with H are winning (which are of course half of all of them), as well the sequences with two consecutive heads after the first tail and before the second tail and so on. We can evaluate the ratio of winning sequences.

Again, don't limit the probability concept unnecessarily. The fact that you physically will never get an infinite sequence does not imply you can't define a probability regarding infinite sequences. Unless you have a different concept of probability.



Quote:
Sure. I'm arguing that, strictly speaking, this limit isn't the probability of anything.
I don't get what you mean by "strictly". There is no doubt that from a strict, theoretical point of view you can define such probability. Had you said "practically speaking" you might have had a point (the game of course cannot be actually played).

Last edited by nickthegeek; 08-07-2018 at 10:44 AM.
538 riddler question about coin flipping game Quote
08-07-2018 , 10:59 AM
Just to be clearer, the original problem could have been stated equivalently as follow.

Imagine to have all the infinite sequences of {H,T} (a sequence might be something like HTTHTTHTHTHTTTHTHTTHTTH... and so on). Which is the ratio of the sequences that exhibit at least once a number of consecutive Hs which is greater than the number of Ts preceding the consecutive Hs?
538 riddler question about coin flipping game Quote
08-07-2018 , 12:09 PM
Quote:
Originally Posted by nickthegeek
Imagine to have all the infinite sequences of {H,T} (a sequence might be something like HTTHTTHTHTHTTTHTHTTHTTH... and so on). Which is the ratio of the sequences that exhibit at least once a number of consecutive Hs which is greater than the number of Ts preceding the consecutive Hs?
Okay, you want to interpret the set of sequences as the unit interval, and are claiming that the subset of winning sequences has a Lebesgue measure of ~0.71?
538 riddler question about coin flipping game Quote
08-07-2018 , 12:40 PM
I retract my previous post. While the probability of flipping 2 heads in a row is (1/2)^2, the probability of winning the game by flipping 2 heads in a row is the conditional probability of doing it GIVEN you flipped tails on the first flip. So it's (1/2)*(1/2)^2 = 1/8. Thanks to those above who pointed this out. I blame my first answer on the power of suggestion.



PairTheBoard
538 riddler question about coin flipping game Quote
08-07-2018 , 01:08 PM
We can write it in terms of elementary functions as

1 - sqrt[2pi/ln(2)]*exp[-pi^2/(6ln(2)) + ln(2)/24]
538 riddler question about coin flipping game Quote
08-07-2018 , 01:49 PM
Quote:
Originally Posted by Mathematical Dick
We can write it in terms of elementary functions as

1 - sqrt[2pi/ln(2)]*exp[-pi^2/(6ln(2)) + ln(2)/24]

Any thoughts on the Sleeping Beauty Paradox?


PairTheBoard
538 riddler question about coin flipping game Quote
08-07-2018 , 06:47 PM
Quote:
Originally Posted by Mathematical Dick
You're all idiots. The answer is

1 - φ(0.5) = .7112119049133976...

where φ is the Euler function. Since that's a special case of the q-Pochhamer, you can evaluate it at wolframalpha as 1-QPochhammer[.5].
And you are a d1ld0 not a d1ck for not showing your work in that case if you have the audacity to call someone idiot (among others too) that gets it right but made a mistake and then found exactly what it was and how to correct it. Because at least i showed my work and i cared to revisit it.

If anyone here wants to start war on who is the best yes lets facking bring it with world class problems that last weeks or actually lets cooperate and learn a ton of things as friends.

For example look how gracious nickthegeek was in getting exactly the right way to do things so that we as community improve.

Otherwise one day i will make it my goal to create an AI that will decimate the attitude of all d1ckheads with ego above ethical behavior.

Thanks for the link though. Now show your work too hehe. This is i how all learn something and get better way better than ever imagined before which of course is a great outcome, bigger than any single problem.

Last edited by masque de Z; 08-07-2018 at 06:53 PM.
538 riddler question about coin flipping game Quote
08-07-2018 , 08:55 PM
So you guys are telling the probability one never wins is 29%? So yet again we have a case where actually calculating gives not just the exact number, but the ballpark. Especially "intuition" easily omits some relevant factors.

My mistake was visualizing the heads as a physical row, while in reality they are representing the series 1/2, 1/4, 1/8, etc.

And we let "a few math PhDs" lead us astray, belief in authorities.

Last edited by plaaynde; 08-07-2018 at 09:09 PM.
538 riddler question about coin flipping game Quote
08-07-2018 , 09:36 PM
Quote:
Originally Posted by masque de Z
And you are a d1ld0 not a d1ck for not showing your work in that case if you have the audacity to call someone idiot (among others too) that gets it right but made a mistake and then found exactly what it was and how to correct it. Because at least i showed my work and i cared to revisit it.
So let me understand. Rather than directing you to the definition of the Euler function which shows the infinite product of 1-1/2k, you demand that I substitute the values of k in for you and write

1 - 1/2 * 3/4 * 7/8 * 15/16 * ... ?

Or you want an explanation of *that*? You had already posted that, so I can't imagine what more "work" you want shown.

Quote:
For example look how gracious nickthegeek was in getting exactly the right way to do things so that we as community improve.
Frankly, I didn't see the need for nickthegeek to apologize. Your product was correct, and everything you said after that in your first post could be accurately described as "nonsense", most notably the conclusion that the PhD's were correct and you always win.

I wasn't singling you out in particular. I've read other posts by you, and I don't think you're a literal idiot. But I observed poster after poster writing nonsense that can only be explained by someone working backwards from the answer that they assumed must be correct because "a few math PhD's insisted", and now more people confirmed, and one by one you all follow along like lemmings instead of thinking for yourselves.

Last edited by Mathematical Dick; 08-07-2018 at 09:47 PM.
538 riddler question about coin flipping game Quote
08-07-2018 , 11:45 PM
By showing work i meant the other post that gave it as
1 - sqrt[2pi/ln(2)]*exp[-pi^2/(6ln(2)) + ln(2)/24]

Mathematica wasnt giving an exact answer so it is interesting. It was presenting via Q-Pochhammer_symbols.

My point being to add to what is already going on seeing how this infinite product or sum can be calculated and expressed with known constants is probably useful and additive value.

The reason i wouldnt call a mistake nonsense given the context surrounding it is because some mistakes are very interesting mistakes actually in the sense that they illuminate some correct way of doing things that is only partially failing by the author being absent minded at that moment, mixing up the wrong things but with the correct intention or because the brain is tricked by suggestive expectations because we are social animals and its interesting how this can influence correct thinking although it shouldn't.

A mature wise person embraces their mistakes as very important in their growth as thinkers and in fact can learn from them more than by not even making them. You see the true story of any great student or test taker or competitions record breaker is not that they do not make mistakes (although they also tend to at lower rates than most) but that they find them more often than others, a lot more often even. That is what makes the difference, how vigilant and ethically responsible one feels about their work to constantly revisit it. I honestly didnt feel good about my first post but i had to leave home. Something didnt feel right.


Here is how it went;

"For you to be possible to lose that game you must have that probability to need more than any number imagined is finite and greater than zero ie some given number q>0 . But 1/2^k tends to 0 as k tends to infinity. So the probability to need more than any number of streaks over k is going down to 0 as k increases. So it wont happen. You wont lose. It doesnt have a lower bound greater than zero. To be able to fail you need to have some fixed probability q>0 to reach any number of streaks imagined.
"

You see that is essentially correct if reframed better ie you must be able to reach any streak level and still not having won with finite probability. The mistake is i was using having won probabilities not still not having won ones. To me that is interesting because if executed well it gets the answer and shows another way to gauge what not winning is essentially about.

Take it to mean this. Either people that know and respect each other joke around and call each other funny names with a smile when you are there up close in the same room but they mean good and it shows as such with the rest of their efforts to share and build on each other's ideas or they simply remain super civil, confident and positive minded to supply information to correct things and even gain from what others said avoiding friction, because friction is impeding progress and is kind of childish. That is all really. That either one is kidding or if not possible to be obvious because its from some remote anonymous terminal, one is civil and positive because that results in much better progress for all and recognizes that all those that try are not idiots and they care for the truth as much as you do hopefully or even more on occasion.

Welcome to the forum if truly new here and looking forward to more posts from you.

Last edited by masque de Z; 08-07-2018 at 11:54 PM.
538 riddler question about coin flipping game Quote
08-08-2018 , 03:54 AM
Quote:
Originally Posted by masque de Z
By showing work i meant the other post that gave it as
1 - sqrt[2pi/ln(2)]*exp[-pi^2/(6ln(2)) + ln(2)/24]
I've been trying to find an online proof I can link and coming up empty. But if you look at this mathworld reference (equation 8) gives it with a couple of references, Watson (1936) and Gordon and McIntosh (2000). Also see

Modular Functions and Dirichlet Series in Number Theory, 2nd ed., Springer, New York, 1990. Chapter 4.

It's also given without proof in the CRC Concise Encylopedia of Mathematics p. 2422 eq. 18. It's considered a classic result.

Last edited by Mathematical Dick; 08-08-2018 at 04:05 AM.
538 riddler question about coin flipping game Quote

      
m