Waiting time for a pattern in coin tossing Let $\{X_t\}$ be an iid sequence of fair coin tosses and $\tau_{HTH} = \inf\{t\geq 3: X_{t-2}X_{t-1}X_t=HTH\}$. I want to determine $E\tau_{HTH}$.
I don't understand a part of the explanation which is:
Gamblers place bets on each individual toss. On each bet, gambler pays an entrance fee of $k$ and is paid $2k$ in return if the outcome is $H$ or $0$ if the outcome is $T$. $k$ can be negative which corresponds to a bet on $T$.
Suppose that at each unit of time until $HTH$ first appears, a new gambler enters and employs the following strategy: on his first bet, he wagers $1$ on $H$. If he loses, he stops. If he wins and $HTH$ has not yet appeared, he wagers his payoff of $2$ on $T$. If he loses, he stops. If he wins and $HTH$ has not yet appeared, he wagers his payoff of $4$ on $H$. This is the last bet placed bu this particular gambler.
The gambler who started at $\tau_{HTH}$ is paid $2$ and the gambler who started at $\tau_{HTH}-2$ is paid $8$ and every gambler has paid an initial entry fee of $1$. At time $\tau_{HTH}$, the net profit to all gamblers $=10-\tau_{HTH}$ and since the game is fair $E\tau_{HTH}=10$

Q1) I can see that the net profit for all gamblers is $10-\tau_{HTH}$ if the outcome string is say $TTTHTH$ and this wouldn't be the net profit if atleast one $H$ appears before $HTH$, am I correct? (say the outcome string is $HHHHTH$).
Q2) The explanation also says $\tau_{HTH}/3$ is bounded by a Geometric(1/8) random variable. How can I see that?

 A: If the outcome is $HHHHTH$, then the first gambler will win their first bet, then bet all of their winnings on the second toss being a $T$, and then lose everything, having a total loss of their initial payment of $1$.
The second gambler will win their first bet, then lose the second bet on exactly the same way as the first gambler, having a total loss of $1$.
In fact, of the six gamblers, each one of them has paid an initial $1$ to enter the game, and only the fourth and sixth have come away with winnings ($10$ in total). So the net win for all the gamblers is indeed $10-6=4$.
In general, it turns out that only the last and the third-from-last gambler can walk away with winnings: The moment any gambler wins their $8$, the game stops because we reached $HTH$, the last gambler walks away with their $2$, and every other gambler has lost, 
As for question $2$, consider the following alternative game (forgetting the gamblers): Toss a coin three times. If you got $HTH$, stop, and if not, try again. Keep going until you have gotten a triple of $HTH$. Say it takes $\sigma_{HTH}$ triples before you stop. Can you see that this is a geometric random variable?
Now say both of these games were being played simultaneously with the same coin tosses. Can you see why $\tau_{HTH}\leq 3\sigma_{HTH}$?
A: We can handle the case of a possibly unfair coin using generating functions.
A pattern for all sequences ending in $HTH$ is
$$
T^\ast\left(H^\ast(HTT)T^\ast\right)^\ast H^\ast HTH\tag1
$$
where $(\dots)^\ast$ represents $0$ or more sequences matching $(\dots)$.
The generating function for $(1)$ is
$$
\overbrace{\ \frac1{1-qx}\ }^{T^\ast}\overbrace{\frac1{1-\underbrace{\frac1{1-px}pq^2x^3\frac1{1-qx}}_{H^\ast(HTT)T^\ast}}}^{\left(H^\ast(HTT)T^\ast\right)^\ast}\overbrace{\ \frac1{1-px}\ }^{H^\ast}\overbrace{\ \ p^2qx^3\ \ \vphantom{\frac11}}^{HTH}\tag2
$$
where $p$ is the probability of an $H$ and $q=1-p$ is the probability of a $T$.
That is,
$$
\begin{align}
g(x)
&=\frac{p^2(1-p)x^3}{1-x+p(1-p)x^2-p(1-p)^2x^3}\tag3\\[9pt]
g(1)
&=1\tag4\\[9pt]
%g'(x)
%&=\frac{p^2(1-p)x^2\left(3-2x+p(1-p)x^2\right)}{\left(1-x+p(1-p)x^2-p(1-p)^2x^3\right)^2}\\
g'(1)
&=\frac{1+p(1-p)}{p^2(1-p)}\tag5\\[3pt]
%g''(x)
%&=\frac{2p^2(1-p)x\left(3-3x+\left(1-p+p^2\right)x^2+6p(1-p)^2x^3-3p(1-p)^2x^4+p^2(1-p)^3x^5\right)}{\left(1-x+p(1-p)x^2-p(1-p)^2x^3\right)^3}\\
g''(1)
&=\frac{2+4p-8p^2+6p^4-2p^5}{p^4(1-p)^2}\tag6
\end{align}
$$
The mean duration is
$$
g'(1)=\frac{1+p(1-p)}{p^2(1-p)}\,\overset{p\to\frac12}\to\,10\tag7
$$
The duration variance is
$$
g''(1)+g'(1)-g'(1)^2=\frac{1+p(1-p)\left(2-4p-2p^2+p^3\right)}{p^4(1-p)^2}\,\overset{p\to\frac12}\to\,58\tag8
$$
