Let $\left\{X_{n}\right\}_{n\geq0}$ be a homogeneous markov chain with state space E and transition matrix P. Let $\tau$ be the first time n for which $X_{n}$ $\neq$ $X_{0}$, where $\tau=+\infty$ if $X_{n}=X_{0}$ for all $n\geq0$. We need to compute $E[\tau|X_{0}=i]$ in terms of $p_{ii}$
My solution
For any $l>0$ let $l$ be the first for which $X_{n}$ $\neq$ $X_{0}$ which means that $\forall$ $m$ such that $1\leq m <l$ the value of $X_{m}=X_{0}$ but $X_{i} \neq X_{0}$. The probability of this happening is the product of probability of $P_{ii}^{m}$ for all $m$ multiplied by $(1-P_{ii}^{l})$. The resulting product is then again multiplied by the value of $l$ and then summed over for all possible values of $l$ i.e from 1 to $\infty$ to find expectation
The expected value therefore is $(1-P_{ii}^{1})+2(1-P^{2}_{ii})P_{ii}^{1}+3(1-P_{ii}^{3})P_{ii}^{2}P_{ii}^{1}+.....=\sum_{j=1}^{\infty}(j(1-P^{j}_{ii})\prod_{k=0}^{j-1}P^{k}_{ii})$ where $P^{0}_{ii}=1$
Is this correct ?