3

I have done some work but I don't think it is correct. (I don't know how to type formatted math, so I will just type it)

Let X be the number of flips to get HHT

E(X) = 1/2(1 + E(X|H)) + 1/2(1 + E(X|T)) = 1 + 1/2*E(X|H) + 1/2*E(X)

E(X|H) = 1/2(1 + E(X|HH)) + 1/2(1 + E(X|HT)) = 1 + 1/2*E(X|HH) + 1/2*E(X)

E(X|HH) = 2 (since X|HH ~ Geo(1/2) )

Substitute back:

E(X|H) = 2 + 1/2*E(X) Then, E(X) = 8

It is my first time to ask a question, please kindly let me know how to ask properly if I didn't. Also, it's not any kind of homework. Thank you very much

2 Answers2

5

The problem can be modelled through a Markov chain / deterministic finite automaton on four states, $\{T,H,HH,HHT\}$:

enter image description here

whose transition matrix (assuming the coin is fair) is given by

$$ P=\begin{pmatrix}\frac{1}{2}&\frac{1}{2}&0&0\\\frac{1}{2}&0&\frac{1}{2}&0\\ 0 & 0 & \frac{1}{2} & \frac{1}{2}\\ 0 & 0 & 0 & 1\end{pmatrix} $$ The probability of being in the accepting state $HHT$ after $n$ tosses is given by $$p_n=\left(\tfrac{1}{2},\tfrac{1}{2},0,0\right) P^n \left(0,0,0,1\right)^T = v P^n w^T.$$

The only way to reach $HHT$ is through $HH$. If we assume that $E_{HH}$ is the average number of throws needed to reach $HH$, with probability $\frac{1}{2}$ we go from $HH$ to $HHT$ in a single step, with probability $\frac{1}{4}$ in two steps, with probability $\frac{1}{8}$ in three steps and so on. It follows that $$ E_{HHT} = E_{HH}+\sum_{n\geq 1}\frac{n}{2^n} = E_{HH}+2.$$ The only way to reach $HH$ is through $H$. The number of strings over the alphabet $\Sigma=\{H,T\}$ with length $n\geq 1$, ending in a $H$ and without consecutive $H$s is given by the Fibonacci number $F_n$. The number of such strings which also starts with an $H$ is given by $F_{n-2}$. It follows that

$$ E_{HH} = E_H + \sum_{n\geq 1}\frac{nF_{n-2}}{2^n} = E_H + 4.$$ Clearly $E_H=2$, hence $E_{HHT} = 2+4+2 = \color{red}{8}$. I leave to you to understand how this number relates to the spectrum of $P$, namely through $$ E_{HHT} = \sum_{\substack{\lambda\in\text{Spec}(P)\\\lambda\neq 1}}\frac{1}{1-\lambda}.$$

Jack D'Aurizio
  • 353,855
  • The number of expected throws to get two consecutive heads is $6$, not $3$. This can be calculated using elementary methods without using any Markov chain theory. – Jason Jan 14 '18 at 16:25
  • @Jason: you are right, I spotted the mistake and fixed it (there wasn't a crucial $n$ in the last series). – Jack D'Aurizio Jan 14 '18 at 16:34
  • 1
    Thank you so much. I think i have to study the markov thing first. So the expected value is really eight! – joesph chan Jan 14 '18 at 17:08
2

Denote by $E_0$ , $E_H$, $E_{HH}$ the expected number of additional flips when the useful last flips are as noted ( ${}_0$ meaning: none). Then $$E_0=1+{1\over2}(E_0+E_H),\quad E_H=1+{1\over2}(E_0+E_{HH}),\quad E_{HH}=1+{1\over2}E_{HH}\ .$$ Solving this gives $E_0=8$.

(Maybe this is what you had in mind yourself, but I could not decipher it.)