Method to compute powers of the transition matrix

Here is a quick(ish) method to compute $p_{11}(n)$:

If $P$ has $k=|I|$ distinct eigenvalues, then it is diagonalisable: $P^n = U\op{diag}(\lambda_1^n, \ldots, \lambda_k^n) U\inv$, so $$ \begin{align*} p_{11}(n) = (P^n)_{11} = a_1 \lambda_1^n + a_2 \lambda_2^n + \ldots + a_k \lambda_k^n. \end{align*} $$ So we can compute $P^n$ for small values of $n$, and then solve for $a_1, \ldots, a_k$.

If there are repeated eigenvalues, e.g. $\lambda$ is repeated $m$ times, then we use the Jordan normal form instead and we have the term $(b_0 + b_1 n + \ldots + b_{m-1} n^{m-1}) \lambda^n$.

If there are complex eigenvalues, they come in conjugate pairs, e.g. $re^{i\theta}$ and $re^{-i\theta}$, and since $p_{11}(n)$ is real, these two eigenvalues will give the terms $ar^n\cos(n\theta) + br^n\sin(n\theta)$.

Examples