There is a monkey which every second picks a letter uniformly from the 26 letters of the English alphabet $\mathcal A$ and hits the key corresponding to that letter. He starts at time 0.
Question. What is the expected amount of time when the monkey first hits the sequence $AB$?
I want to see if this can be done via a Markov chain approach.
Suppose we have the state space $S$ as the set of all the pairs $\{xy:\ x, y\in \mathcal A\}$. So $S=\{AA, AB, AC, ..., BA, BB, BC, ...\}$. There is a natural natural graph on this state space. We join an (directed) edge between $xy$ and $yz$ for all $x, y, z\in \mathcal A$. The symmetry of the graph gives that the uniform distribution $\pi$ is the stationary distribution.
I basically want to know the following: Suppose it is given that the starting distribution is $\pi$ (the uniform distribution), then what is the expected time when one reaches the state $AB$.
(I realize that this is slightly different that the question I originally posed but this is good enough for me.)
Is there some general theorem about the expected time of reaching a particular state? At least for regular graphs?
This is a general theorem for when you have a random stream of i.i.d. uniform letters from a finite alphabet, and you want the expected time it takes for a particular word to appear consecutively.
For example, with $w=AB$, since $A$ does not equal $B$, the expected time to see $AB$ is $26^2$. If you were instead waiting for $AA$, then the substring $A$ does equal $A$, so the expected wait time increases to $26^2+26$.
For a delightful proof of this theorem, see Expected number of consecutive guesses to get a given sequence of numbers.