A fair coin is flipped repeatedly. What is the expected number of flips until the pattern HTH appears for the first time?
Enter a number
Show solution
Use a Markov chain with states: S (start), H (last flip was H, no progress beyond that), HT (last two flips were HT). State HTH is absorbing. Transitions: from S, heads → H, tails → S; from H, tails → HT, heads → H; from HT, heads → HTH (done), tails → S. Let ES,EH,EHT be expected flips from each state. ES=1+21EH+21ES, EH=1+21EHT+21EH, EHT=1+21(0)+21ES. Solving: EHT=6, EH=8, ES=10.