In This Article The Question The Intuition Trap Building the State Machine for HH Solving the System: E[HH] = 6 Building the State Machine for HTH Solving the System: E[HTH] = 10 Why Overlapping Patterns Change Everything Python Simulation: 100,000 Trials Business Application: Credit Migration & Web Ranking The Question You flip a fair coin — one with probability 1/2 of landing heads and 1/2 of landing tails — repeatedly, recording every result. What is the expected number of flips required until the sequence HH appears for the first time as consecutive results? What is the expected number of flips required until HTH appears for the first time? Both questions have the same surface structure: you want a specific consecutive pattern, and you want to know, on average, how many flips it takes to observe it. The coin is fair, the flips are independent, and the patterns are short. These seem like they should yield similar answers. They do not. HH takes exactly 6 flips on average. HTH takes exactly 10.…