# Expected number of coin tosses to get one head and one tail consecutively

An unbiased coin is tossed repeatedly and outcomes are recorded. What is the expected no of toss to get HT ( one head and one tail consecutively)?

My approach-- e=expected number of tosses e=[if first tail comes] + [if first is head and second is head] + [required probability of first head and second tail] e= 1/2(e+1) + 1/4(e+2) + 1/4

is it correct?

If the first comes down heads, the expected value is $3$ since you get $HT$ the next time you flip tails, which will take an average of two more flips. If it comes up tails, then you start over. So the recursion can be written $$T = 3/2 + (T+1)/2$$ which has the solution $T=4.$

The problem with yours is the middle term $(T+2)/4.$ You don't have to start all the way over in the case of $HH,$ you could get $HHT.$

Let $x$ be the expected number of tosses to get $HT$ if the last flip was $H$ and $y$ be the expected number if the last flip was $T$ or nothing. If the last flip was $H$ you either flip $T$ and are done or flip $H$ and are in the same situation, so $$x=\frac 12\cdot 1+\frac 12 \cdot (1+x)\\x=2$$If you haven't flipped heads, you have $\frac 12$ chance to flip heads and then expect $x$ and $\frac 12$ to flip tails and be in the same state, so $$y=\frac 12(1+x)+\frac 12(1+y)\\y=2+\frac y2\\y=4$$

There is a $(1/2)^n$ chance of getting any arbitrary configuration of $n$ coins. For these $n$ coins, there are $n-1$ ways for it to end in $HT$ without having $HT$ appear earlier. For example, at $n=5$, we could have
$HHHHT \\ THHHT \\ TTHHT \\ TTTHT$
This implies the expected values will be equal to: $$\sum_{n=2}^\infty n(n-1) (1/2)^n = 4$$ Where $n$ is the number of flips to get a consecutive $HT$ (it cannot be below $2$ and has no upper bound) and $(n-1)(1/2)^n$ is the probability that a chain of $n$ coins ends in $HT$ but does contain $HT$ anywhere else.