Here's a cute puzzle.
Player A tosses a coin indefinitely and stops when he encounters a consecutive sequence of HT. Player B plays a similar game, except he stops when he encounters HH consecutively. Is the expected number of tosses equal for both players? If not, who has more, and can you give an intuitive explanation why?
Easy Math Editor
This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.
When posting on Brilliant:
*italics*
or_italics_
**bold**
or__bold__
paragraph 1
paragraph 2
[example link](https://brilliant.org)
> This is a quote
\(
...\)
or\[
...\]
to ensure proper formatting.2 \times 3
2^{34}
a_{i-1}
\frac{2}{3}
\sqrt{2}
\sum_{i=1}^3
\sin \theta
\boxed{123}
Comments
I think that player A is expected to be finished earlier. If he encounters an H, then he would have to keep tossing H's in order to continue. The chance of throwing n consecutive H's decreases rapidly as n increases.
If player B encounters an H, then he will have to toss a T to continue, but after tossing a T, he will continue tossing, because no matter what he tosses next, he doesn't encounter HH.
So, player A is doomed so to say whenever he tosses an H, because he'll have to keep tossing H's in order to continue. That's why he is expected to stop earlier than player B. I hope that makes sense.
Log in to reply
Yup that's correct! It would also be interesting to explicitly calculate the expected number of throws for both A and B.
Log in to reply
Player A is expected to throw his first H after 2 tosses, because
1⋅21+2⋅41+3⋅81+4⋅161+5⋅321+⋯=2.
Similarly, after having tossed his first H, player A is expected to throw his first T (and thus stopping) after another 2 tosses. So (hopefully) I can conclude that player H is expected to toss 4 times.
Player B is expected to roll his first H in two tosses. Then, there is a chance of 50% that he stops after the third toss, i.e. after tossing H again. However, if he tosses a T, then again, he is expected to toss his second H in two tosses, after which there is a 50% chance that he stops after the toss after that. It goes on and on. So, the amount of tosses player B is expected to do is
3⋅21+6⋅41+9⋅81+12⋅161+15⋅321+⋯=3⋅2=6.
And 6>4.
I hope that what I did is allowed, I'm not completely convinced of that just yet. Could anyone confirm that what I did is correct (or show me what I've done wrong)?
Log in to reply
Here's how I'd do it. To compute the expected number of tosses for HH, we define two values:
Then a=2b+1+21 since if the previous toss was 'H', there's a 50% chance the next is 'T' (in which case the expected number of tosses is b+1), and a 50% chance the next is 'H' (in which case the number of tosses is 1 since it ends).
Likewise, b=2a+1+2b+1 since if the previous toss was 'T', there's a 50% chance the next is 'H' (in which case expected number of tosses is a+1), and a 50% chance the next is 'T' (and the expected number of tosses is b+1).
Solving then gives us a=4, b=6. The expected number of tosses is then b=6, since we can assume the 0-th toss was 'T' with no loss of generality.
The equations for HT are similar:
a=2a+1+21,b=2a+1+2b+1
which gives us a=2, b=4.
[ P.S. To be pedantic, my working isn't 100% rigourous either, since it already assumes a, b are finite. ]
Log in to reply
a,b are finite though.
That's really great. Two completely different ways of solving the problem :) I wouldn't know how to prove thatLog in to reply
NA be the number of tosses until A stops. The probability P[NA>n] is the probability that A has not thrown HT in the first n tosses. This can only happen if A has thrown j tails followed by n−j heads, for some 0≤j≤n. Thus there are n+1 possible sequences, all equally likely, and so P[NA>n]=(n+1)2−n Thus P[NA≥n]=P[NA>n−1]=n21−n Normal probability and series summation tricks give us E[NA]=n=1∑∞P[NA≥n]=n=1∑∞n21−n=4 The result for B is a little more challenging. Let NB be the number of tosses until B stops. The probability that NB>n is the probability that B does not throw HH in the first n tosses. This is the probability that the first n tosses are made up of "HT"s and "T"s stuck together, plus the probability that the first n−1 tosses are made up of "HT"s and "T"s stuck together, followed by a single "H".
If you want a finiteness proof, use first principles. LetIt is well-known that the number of ways of tiling a n×1 chess-board using just 2×1 dominoes and 1×1 squares is the Fibonacci number Fn+1. (Just to be definite, F0=0, F1=1, etc.) Thus the probability that NB>n is the sum of the probabilities Fn+12−n and Fn2−n, and hence P[NB>n]=2nFn+2 and hence P[NB≥n]=P[NB>n−1]=2n−1Fn+1n≥1. Thus E[NB]=n=1∑∞P[NB≥n]=n=1∑∞2n−1Fn+1=4G(0.5)−2 where G(x)=n=0∑∞Fnxn is the generating function of the Fibonacci numbers. It is well-known that G(x)=1−x−x2x so that G(0.5)=2. Thus E[NB]=6.
Log in to reply
Fn+2, you can use the ratio test to conclude that the sum is finite, which is all we needed.
Of course, once you showed that the number of ways isNice way of calculating the sum through generating functions.
In a similar vein, check out High school math #8.
The absorbing Markov chain also gets the same answer.
This is the markov chain for ending the game with HH, for player B. I is the initial state, and the probabilities of moving to different states are shown:
⎝⎜⎜⎜⎜⎜⎜⎜⎜⎜⎜⎛IHTHTTHTTHHI0000000H21000000T21000000HT021002100TH0021210210TT0021210210HH021002101⎠⎟⎟⎟⎟⎟⎟⎟⎟⎟⎟⎞
Matrix Q is:
⎝⎜⎜⎜⎜⎜⎜⎛0000002100000210000002100210002121021002121021⎠⎟⎟⎟⎟⎟⎟⎞
Fundamental matrix (I−Q)−1 is:
⎝⎜⎜⎜⎜⎜⎜⎛1000002110000210100011121123122222312213⎠⎟⎟⎟⎟⎟⎟⎞
The required expectation is the sum of the first row, which is 6.
Similarly doing for the 'HT' case yields an expected value of 4.