How many coin tosses to get X Heads in a row? — Quantitative Problems on Markov Chains

<p>Let&nbsp;<em>E[n]</em>&nbsp;= Number of tosses needed to get n Heads in a row.<br /> Let&rsquo;s say we have&nbsp;<em>n-1</em>&nbsp;consecutive heads so far, and are at State&nbsp;<em>n-1</em>. If we do 1 more toss,</p> <ul> <li>We reach State&nbsp;<em>n</em>&nbsp;with probability&nbsp;<em>p</em>. This is the terminal state, no more tosses needed. Contribution in number of tosses =&nbsp;<em>E[n-1] + 1</em>.<br /> <em>(Why? 1 for this toss, E[n-1] for tosses so far)</em></li> <li>Or we reach State&nbsp;<em>0</em>&nbsp;with probability&nbsp;<em>1-p</em>. We need&nbsp;<em>n</em>&nbsp;more consecutive heads. Contribution in number of tosses =&nbsp;<em>1 + E[n-1] + E[n]</em>.<br /> <em>(Why ? 1 for this toss, E[n-1] for tosses so far, and E[n] for more tosses needed)</em></li> </ul> <p>This means,&nbsp;<em>E[n] = (p) ( E[n-1] + 1 )+ (1-p)( 1 + E[n-1] + E[n] )</em></p> <p><a href="https://medium.com/@harshraj11584/quantitative-problems-on-markov-chains-8d6636ffcd90"><strong>Website</strong></a></p>
Tags: Markov Chains