Let $\{X_n\}$ be a markov chain, with transition probability matrix: $$\displaystyle P=\left( \begin{array}{ccccccc} 1/2 & 1/2 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1/2 & 1/2 & 0 & 0 & 0 & 0 \\ 1/4 & 0 & 0 & 1/2 & 1/4 & 0 & 0 \\ 0 & 0 & 0& 1/2 & 1/2 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1/2 & 1/4 & 1/4 \\ 0 & 0 & 0 & 0 & 1/4 & 1/2 & 1/4 \\ 0 & 0 & 0 & 0 & 1/2 & 1/2 & 0 \\ \end{array} \right).$$ If $X_0=1$, find $$\mathbb{E}\bigg[\sum_{k=1}^{T}\mathbb{I}_{\{X_k=3\}}\bigg],$$ where $T=\inf\{k\geq 0: ~X_k\in \{5,6,7\}\}.$
($\mathbb{I}_A$ denotes the index function on set $A$)
Attempt. There are three communication classes, the open $\{1,2,3\},~\{4\}$ and the closed $\{5,6,7\}$ (whose invariant distribution is $\pi =(2/5,2/5,1/5)$). I thought of a one step analysis, but i don't think it would get me anywhere.
Thank you in advance!
Answer: $4/3$.
Sketch: The only way from $1$ to $\{5,6,7\}$ (in fact, here we will always stop in $5$) lies through $3$. Each time when we visit $3$, a coin is flipped, and we either (with probability $1/4$) get heads and return to $1$ or (with probability $3/4$) get tails and go either to $5$ or to $4$, which also eventually leads to $5$. Thus, the number of visits of the state $3$ is the number of attempts to get tails when flipping a coin with $\mathbb{P}(\text{tails}) = 3/4$. So this number follows a geometric distribution with success probability $3/4$, hence the answer.