Theorem (linear equations for mean hitting time)
Consider a Markov chain on $I$ with a transition matrix $P$, and $A\subseteq I$.
The mean hitting time $(k_i^A)_{i\in I}$ is the minimal non-negative solution to the system of linear equations $$ \begin{align*} k_i^A = \begin{cases} 0, &\text{if } i \in A, \\ 1 + \sum_{j\not\in A} P(i,j) \,k_j^A, &\text{if }i\not\in A. \end{cases} \end{align*} $$