I consider a continuous-time homogenous Markov chain: with discrete state $X$ taking values in $\mathcal{F}=\{1,\cdots,N\}$ with the transition rates satisfying: \begin{equation} \begin{cases} Pr\{X(t+h)=j\lvert X(t)=i\}=\lambda_{ij}h+o(h),\\ Pr\{X(t+h)=i\lvert X(t)=i\}=1-\lambda_{ii}h+o(h) \end{cases} \end{equation} where $\lambda_{ii}=\sum_{i\neq j}\lambda_{ij}$.
Transition Probabilities are defined as $P_{ij}(t)=Pr\{X(t)=j\,|\,X(0)=i\}, t\geq 0$. These probabilities are obtained by solving the Kolmogorov forward equation given as:
$ \dot{P}_{ij}=-\lambda_{ii}P_{ij}(t)+\sum_{y\neq j}P_{iy}(t)\lambda_{yj}$
Now, probability of being at state $j$ denoted by $\pi_j(t)$ is given by: \begin{equation} \pi_j(t)=Pr\{X(t)=j\}=\sum_i Pr\{X(t)=j\,|\,X(0)=i\}Pr\{X(0)=i\}=\sum_iP_{ij}Pr\{X(0)=i\} \end{equation} Using the above equation and kolmogorov forward equation, it is concluded that: \begin{equation} \dot{\pi}_j=-\lambda_{jj}\pi_j+\sum_{y\neq j}\pi_{y}\lambda_{yj}, \end{equation} or in the matrix form: \begin{equation} \dot{\pi}(t)=A\pi(t) \end{equation} where \begin{equation} A_{ij}=\begin{cases} -\lambda_{ii}~\text{if}~i=j\\ \lambda_{ji}~\text{if}~i\neq j \end{cases}. \end{equation} I am interested in finding the mean-time that it spent in a state i?
My attempt:
Suppose $X(0)=i$
Let us denote the time that is spent in $i$ by $T_i$. For some $s,t\geq 0$, we have:
\begin{equation}
Pr\{T_i\geq s+t|T_i> s\}=Pr(T_i> t)
\end{equation}
I guess that I need to find the $Pr\{T_i\leq t\}$ and then
$E(T_i)=\int_0^\infty t\frac{d}{dt}Pr\{T_i\leq t\}dt $.