I have Markov Chain $\{X_n\}$ and the states $S=\{0,1,2\}$, with the probability matrix
$$P= \Bigg [\matrix {p &q &0\\0&p&q\\0&0&1} \Bigg] \quad where \quad p \in [0,1)$$ I want to find the probablity distribution of getting $$T=inf\{ n \leq 0: X_n=2 \}$$ to state 2 when the chain starts from state 0, i.e. $X_0=0$. And to find $$E[T|X_0=1]$$.
I started by thinking about the distribution. And used the fact that the sum $Z=X_1+...+X_n$ independent r.v. geometrically distribiuted fllows negatively binomial distribution, so I wrote: $$P(Z=k|X_0)=\Bigg(\matrix{k-1\\k-d}\Bigg) (1-p)^{d}p^{k-d} \quad k \geq d.$$ And I dont know where to go next. Thank you for your help!