# Game - First person to throw consecutive heads

Player A and Player B play are playing a game. Player A goes first, and tosses a coin. Player B then tosses his first coin. Player A then tosses his second and so on until the game ends. The first person to toss consecutive heads wins. What is the probability that Player A wins?

For those curious, this question was asked in a finance interview.

• What are your thoughts? – lulu Nov 18 '18 at 14:15
• Originally got the answer 4/7 through P(Win) = P(HH) + P(Not HH)P(Not HH)P(HH) and so on, and using sum of an infinite series. Then realised that the outcomes TT,HT and TH are not equivalent, as TH then needs just one more head to win. – Connolly Devin Nov 18 '18 at 14:17
• This sort of problem is hard to attack with geometric series, for the reason you point out. Best to do it with states. Label a state according to; whose turn it is, how many more Heads $A$ needs and how many more Heads $B$ needs. There aren't very many states. Then look at the transitions between them. – lulu Nov 18 '18 at 14:19
• I was looking at the Markov chain method (have some exposure to Stochastic modelling and the likes), but was hoping there may be a trick to it - especially given it was asked as 1 of 10 questions during a short interview. – Connolly Devin Nov 18 '18 at 14:21
• Having both conducted (and taken) lots of such interviews, it's often the case that the interviewer is really after a robust and reasoned analysis of the problem. Yes, carrying through the steps might take a while but typically the interviewer will stop you at the outline stage. – lulu Nov 18 '18 at 14:36

Denote by $${\tt pxy}$$ the probability that $$A$$ finally wins when the game is in the following state:

• person $$P\in\{A,B\}$$ is the next to throw his coin,
• $$A$$ has $$x\in\{0,1\}$$ useful heads on the stack,
• $$B$$ has $$y\in\{0,1\}$$ useful heads on the stack.

The problem is to determine $${\tt a00}$$. There are $$8$$ nonterminal states, leading to a system of $$8$$ linear equations. I let Mathematica solve it. The answer is $${\tt a00}={14\over25}$$. Here is the output:

The other way to solve the problem albeit it is more calculation intensive.

The pmf of obtaining two consecutive heads in k trials $$P_{N}(k) = \frac{F_{k-1}}{2^k}$$ where $$F_k$$ is the Fibonacci Sequence.

It is the same for both A and B to get two consecutive heads. Since A starts,

Probability that A wins $$\sum_{k=2}^{\infty} \frac{F_{k-1}}{2^k} \left(1-\sum_{i=1}^{k-1}\frac{F_{i-1}}{2^{i}}\right)$$

Attached you will see the image where the calcuatlion is done and is in agreement with @Christian Blatter.