Expected number of occurrences of the pattern $HTH$ in $n$ independent coin tossings
I am self-learning calculus-based basic undergrad probability. In Intro to Probability, Blitzstein and Hwang, the chapter on expectations and variances has an interesting question on the expected number of occurrences of the pattern $HTH$. I love a challenge, and tried to have a crack at this, but I merely have no ideas, on how to approach it.
Could you guys me a clue/suggestion on how to proceed with such a question, without giving away the entire solution?
[BH 4.40] In a sequence of $n$ independent fair coin tosses, what is the expected number of occurrences of the pattern $HTH$ (consecutively)? Note that overlap is allowed e.g. $HTHTH$ contains two overlapping occurrences of the pattern.
Each of the $8$ possibilities of $3$ consecutive independent tosses are equiprobable.
In $n$ tosses, there will be $(n-2)$ such subsequences of $3$ consecutive tosses.
Thus $\Bbb {E}[X] = \frac{n-2}{8}$.