Suppose we roll a fair $6$ sided die repeatedly. Find the expected number of rolls required to see $3$ of the same number in succession.

For $n\in \{0,1,2\}$ Let $E[n]$ denote the answer given that you are starting from a streak of $n$ consecutive rolls. The answer you want is $E=E[0]$, though you are never in state $0$ except at the start.

We note $$E[2]=\frac 16\times 1+\frac 56\times \left(E[1]+1\right)$$ $$E[1]=\frac 16\times \left(E[2]+1\right)+\frac 56\times \left(E[1]+1\right)$$

$$E=E[0]=E[1]+1$$

this system is easily solved and, barring error (always possible), yields $$\boxed {E=43}$$


From Did's answer here, the probability generating function $u_0(s)=\mathbb{E}(s^T)$ for the number of trials $T$ needed to get three consecutive values the same is
$$u_0(s)={s^3\over 36-30s-5s^2}.$$ Differentiating this and setting $s=1$ in the derivative shows that $\mathbb{E}(T)=43.$


We can treat this as a three-state absorbing markov chain: a length3 run has been seen, otherwise the current run is length2, current run is length 1. Transition matrix: $\begin{bmatrix}1&\frac{1}{6}&0\\0&0&\frac{1}{6}\\0&\frac{5}{6}&\frac{5}{6}\end{bmatrix}$

This is in standard form $\left[\begin{array}{c|c}I&S\\\hline0&R\end{array}\right]$

We turn our attention to the fundamental matrix $(I-R)^{-1} = \begin{bmatrix}1&-\frac{1}{6}\\-\frac{5}{6}&\frac{1}{6}\end{bmatrix}^{-1}=\begin{bmatrix}6&6\\30&36\end{bmatrix}$

After the first roll, we enter the markov chain in the third state. Adding the entries of the fundamental matrix corresponding to that column tells us the expected time until we reach an absorbing state, i.e. until we have a chain of three consecutive rolls of the same number.

Thus the expected number of rolls needed is $1+36+6=43$