Series summation of polynomial on x multiplied by x power summation

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) ?

I tried to solve above question using the following probability tree diagram. Probability in each branch is = $0.5$. I double circled the satisfying toss events. While observing the diagram I noticed that, from 2nd toss onward our required event starts showing up. Additionally,

1. in the $\text{2nd}$ toss (or the 3rd level) we have one satisfying case.
2. in the $\text{3rd}$ toss (or the 4th level) we have two satisfying case.
3. in the $\text{4th}$ toss (or the 5th level) we have three satisfying case.
4. in the $\text{5th}$ toss (or the 6th level) we have four satisfying case.
5. etc.

i.e. in the $\text{kth}$ toss we would have $(k-1)$ satisfying case. So,

$\\ E = \sum_{k=2}^{\infty } k.P(k)\ \\ E = \sum_{k=2}^{\infty } k.\left \{ (k-1)*(0.5)^k \right \}\\ \\ E = \sum_{k=2}^{\infty } \left \{ (k^2-k)*(0.5)^k \right \}\\$

I understand the series summation would converge because we have the $0.5^{k}$ term which eventually becomes zero.

But could not solve this polynomial and power series summation.

Please suggest how to solve this and or any other method.

We can describe all valid tosses as follows:

The valid tosses are

• zero or more tosses of T followed by
• zero or more tossed of H followed by
• HT

This corresponds to the tree diagram where we can see following valid paths starting from the root

Note the entries in a diagonal have the same length, starting with the first node $HT$ of length $2$. The entries in the diagonal with length $5$ are marked in blue.

From this scheme we can derive the expectation value. We obtain following the same arrangement

We can add up these values along the diagonals. Note, the diagonal marked in blue has $4$ entries

$$\{HHHHT,THHHT,TTHHT,TTTHT\}$$ of length $5$.

We obtain \begin{align*} E[X]&=\sum_{n=1}^\infty n(n+1)\left(\frac{1}{2}\right)^{n+1}\\ &=\left.\sum_{n=1}^\infty n(n+1)x^{n+1}\right|_{x=\frac{1}{2}}\\ &=x^2\left.\sum_{n=1}^\infty n(n+1)x^{n-1}\right|_{x=\frac{1}{2}}\\ &=x^2\left.\sum_{n=2}^\infty (n-1)nx^{n-2}\right|_{x=\frac{1}{2}}\\ &=\left.\left(x^2D_x^2\sum_{n=0}^\infty x^n\right)\right|_{x=\frac{1}{2}}\\ &=\left.\left(x^2D_x^2\frac{1}{1-x}\right)\right|_{x=\frac{1}{2}}\\ &=\left.\frac{2x^2}{(1-x)^3}\right|_{x=\frac{1}{2}}\\ &=4 \end{align*}

Here we use the differential operator $D_x:=\frac{d}{dx}$ and apply it to the geometric series.

• The wiki link directly points me the exact required formula. Thanks. – Debashish Sep 26 '16 at 5:39
• @Debashish: You're welcome! Good to see the answer is helpful! – Markus Scheuer Sep 26 '16 at 6:32

You can treat this as a Markov Chain with the following states:

End, Head, Tail (not end) (or equivalently worded, HT has occured, heads is most recent result, and no heads have occured respectively)

This has the transition matrix $\begin{bmatrix}1&0.5&0\\0&0.5&0.5\\0&0&0.5\end{bmatrix}$, which is in the standard form for an absorbing chain: $\left[\begin{array}{c|c}I&S\\\hline0&R\end{array}\right]$

We look to the fundamental matrix: $(I-R)^{-1}$ which in this case is $\begin{bmatrix}0.5&-0.5\\0&0.5\end{bmatrix}^{-1} = \frac{1}{1/4}\begin{bmatrix}0.5&0.5\\0&0.5\end{bmatrix}=\begin{bmatrix}2&2\\0&2\end{bmatrix}$

The fundamental matrix holds the information about how many steps are expected until we reach an absorbing state. Since our initial state can be thought of as being a tail (or more correctly worded, as being that no head has yet occurred), we look to the corresponding column and add the entries to find the expected time.

In this case, we see it will take an expected number of $2+2=4$ flips to have flipped a tails after a heads.

• Thanks ! please suggest or give some good reference regarding this Markov Chain Method. – Debashish Sep 24 '16 at 6:38
• The wikipedia links I already included have a good bit of information in them. Otherwise, PatrickJMT covers the basics rather well, though his notation differs from mine and textbooks from which I've taught and studied from in the past in that he uses row-stochastic matrices instead of column-stochastic matrices, so his state vectors will appear on the left and have rows summing to one, whereas I would write it with column vectors on the right of matrix with columns summing to one. He begins discussing absorbing chains in part 7 of his videos. – JMoravitz Sep 24 '16 at 6:46