I went with the Markov chain approach, setting up states based on how much of the pattern you've already matched.
Start by framing the problem as a Markov chain with states representing the longest suffix of the toss sequence that matches a prefix of the target pattern. Then set up expected hitting time equations for each state and solve them, using symmetry or pattern-specific properties to simplify. Finally, verify the result with a known formula or simulation for a specific pattern like HHH or HTH.
Pro tip: Mention that the expected waiting time depends on the pattern's autocorrelation structure, and that patterns with overlapping prefixes (like HTH) have longer waiting times than those without (like HHH). This shows you understand the nuance beyond just applying a formula.
Identify the states as the length of the longest suffix of the current sequence that is also a prefix of the target pattern. For a length-3 pattern, there are typically 4 states: 0, 1, 2, and 3 (absorbing).
Let E_i be the expected number of additional tosses to reach state 3 from state i. Write equations: E_3 = 0, and for i < 3, E_i = 1 + (1/2)E_{next if H} + (1/2)E_{next if T}, where next states depend on the pattern.
Solve the system of linear equations for E_0, the expected waiting time from scratch. Use substitution or matrix methods, and simplify using the specific pattern's transition structure.
Check that the answer is reasonable (e.g., for HHH it's 14, for HTH it's 10). Optionally, mention that the general formula involves the autocorrelation polynomial or use a simulation to verify.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
Use Markov chain states to represent the progress toward the target pattern, set up equations for expected additional tosses from each state, and solve them. For HHH, states are 0, H, HH; for HTH, states are 0, H, HT. Alternatively, use martingale or pattern overlap arguments for a quicker solution.
Pro tip: Mention that the expected waiting time for a pattern can be computed as the sum of 2^k over all k where the pattern has a border of length k (i.e., a proper prefix that is also a suffix). For HHH, borders at k=1,2,3 give 2+4+8=14; for HTH, only k=3 gives 8. This shows deep understanding and avoids lengthy derivations.
Identify the relevant states representing how much of the target pattern has been matched so far. For HHH: states 0, H, HH. For HTH: states 0, H, HT.
Let E_s be the expected number of additional tosses to reach the target from state s. Write equations based on the next toss: e.g., from state 0, E_0 = 1 + 0.5 E_0 + 0.5 E_H (for HHH).
Solve the linear equations to find E_0 for each pattern. For HHH, equations yield E_0 = 14. For HTH, equations yield E_0 = 10.
Check results using the formula: expected waiting time = sum_{k in borders} 2^k, where borders are lengths of proper prefixes that are also suffixes. For HHH: borders at 1,2,3 -> 2+4+8=14. For HTH: border at 3 -> 8, but note that the formula gives 8? Actually, the correct formula for expected waiting time is sum_{k in borders} 2^k, but for HTH, the borders are only k=3 (since HTH has no proper prefix that is also a suffix except the full string? Wait, HTH: proper prefixes: H, HT; suffixes: H, TH. H is a prefix and suffix? Yes, H is a prefix and also a suffix (the last character is H). So border length 1? Actually, a border is a string that is both a proper prefix and a proper suffix. For HTH, proper prefix 'H' and proper suffix 'H' match, so border length 1. Also, proper prefix 'HT' and proper suffix 'TH' do not match. So borders: length 1 and length 3? But length 3 is the full string, not proper. So only border length 1. Then sum 2^1 = 2, which is not 10. So the formula is not simply sum 2^k for borders. The correct formula for expected waiting time for a pattern is sum_{k in borders} 2^k, where borders include the full pattern? Actually, the known result: expected waiting time for pattern w is sum_{k in B} 2^k, where B is the set of lengths of borders of w, including the full length. For HHH, borders: lengths 1,2,3 -> 2+4+8=14. For HTH, borders: length 3 only? But HTH has a border of length 1? Let's check: proper prefix of length 1 is 'H', proper suffix of length 1 is 'H' -> yes, border length 1. Also, full length 3 is a border? The full string is not a proper border, but in the formula, we include the full length. So borders: 1 and 3 -> 2+8=10. Yes! So the formula includes the full length as a border. So for HTH, borders at 1 and 3 -> 2+8=10. For HHH, borders at 1,2,3 -> 2+4+8=14. So the formula works. So in step 4, verify using the formula: expected waiting time = sum_{k in borders} 2^k, where borders include the full length. For HHH: 2+4+8=14. For HTH: 2+8=10.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.