Learn / Library / Expected value
Long coin pattern
A fair coin is flipped repeatedly. What is the expected number of flips until the pattern (heads, heads, tails, heads, heads) first appears?
Checking an answer needs JavaScript. The hint and the solution open without it.
Hint
Check which prefixes of the pattern are also suffixes of it.
Solution
- The expected waiting time for a pattern is the sum of over every length for which the first flips equal the last flips.
- Here length matches ( and ) and length matches ( and ), and length matches trivially.
- Lengths ( against ) and ( against ) do not match.
- So the expectation is .
Answer: