Computing the matrix powers of a non-diagonalizable matrix

Here is a different way using a rather classical trick, converting the issue into a binomial expansion. Indeed, we can write :

$$A=\frac12(I+B) \ \text{where} \ B:=\begin{pmatrix}0&1&0 \\0&1/2&1/2\\0&1/2&1/2\end{pmatrix}$$

where matrix $B$ has the following particularity

$$B^n=C \ \text{for all} \ n>1 \ \text{where} \ C:=\begin{pmatrix}0&1/2&1/2\\0&1/2&1/2\\0&1/2&1/2\end{pmatrix}$$

Therefore

$$A^n = \dfrac{1}{2^n}\left(I+\binom{n}{1}B+\binom{n}{2}B^2+\binom{n}{3}B^3+\cdots+\binom{n}{n}B^n\right)$$

$$A^n = \dfrac{1}{2^n}\left(I+nB+\binom{n}{2}C+\binom{n}{3}C+\cdots+\binom{n}{n}C\right)\tag{1}$$

As is well known, $\sum_{k=0}^n \binom{n}{k}=2^n$, reducing (1) to :

$$A^n = \dfrac{1}{2^n}\left(I+nB+(2^n-n-1)C\right)$$

It suffices now to replace $B$ and $C$ by their expression

$$A^n = \dfrac{1}{2^n}\left(\begin{pmatrix}1&0&0\\0&1&0\\0&0&1\end{pmatrix}+n\begin{pmatrix}0&1&0 \\0&1/2&1/2\\0&1/2&1/2\end{pmatrix}+(2^n-n-1)\begin{pmatrix}0&1/2&1/2\\0&1/2&1/2\\0&1/2&1/2\end{pmatrix}\right)$$

to get the result (coinciding with yours !).


Note that your matrix $A$ has the generalized eigenvectors

\begin{equation}v_1=\begin{pmatrix}1 \\ 0 \\ 0\end{pmatrix}, v_2=\begin{pmatrix}0 \\ 2 \\ -2\end{pmatrix}, v_3=\begin{pmatrix}0\\ 0 \\ 1\end{pmatrix}.\end{equation}

Thus, by Jordan decomposition, $A=\big(v_1,v_2,v_3\big)J\big(v_1,v_2,v_3\big)^{-1}$, where

\begin{equation}J=\begin{pmatrix}\frac12 & 1 & 0\\0 & \frac12 & 0\\0 & 0 & 1\end{pmatrix}.\end{equation}

The problem of calculating $A^n$ is thus reduced to calculating $J^n$. Let $a_{ij}^{(n)}$ denote the entry of $J^n$ in the $i$-th row and $j$-th column.

The product of an arbitrary $3\times3$-matrix with $J$ is given by: \begin{equation} \begin{pmatrix} a&b&c\\d&e&f\\g&h&i \end{pmatrix} J = \begin{pmatrix} \frac a2&a+\frac b2&c\\\frac d2&d+\frac e2&f\\\frac g2&g+\frac h2&i \end{pmatrix}. \end{equation}

We can deduce that, for all $n\in\Bbb N$: \begin{align} a_{11}^{(n)}&=a_{22}^{(n)}=\frac1{2^n}, \\a_{21}^{(n)}&=a_{31}^{(n)}=0,\\ a_{13}^{(n)}&=a_{23}^{(n)}=a_{32}^{(n)}=0, \\ a_{33}^{(n)}&=1,\\ a_{12}^{(n+1)}&=a_{11}^{(n)}+\frac{a_{12}^{(n)}}2=\frac1{2^n}+\frac{a_{12}^{(n)}}2. \end{align}

Thus, all $a_{ij}^{(n)}$ are explicitly known except for $a_{12}^{(n)}$. Note that, by the last equation, \begin{equation}a_{12}^{(n+1)}=2^{-n}+\frac{a_{12}^{(n)}}2 = 2^{-n}+2^{-n}+\frac{a_{12}^{(n-1)}}4 = \dots = (n+1)\cdot2^{-n}.\end{equation}

Thus, \begin{equation}J^n=\begin{pmatrix}2^{-n}&n\cdot 2^{1-n} & 0\\0 & 2^{-n} & 0\\0 & 0 & 1\end{pmatrix}.\end{equation}

And by some calculations, we find that \begin{equation} A^n=\big(v_1,v_2,v_3\big)J^n\big(v_1,v_2,v_3\big)^{-1}= \begin{pmatrix} 2^{-n} & n\cdot 2^{-n-1} - 2^{-n-1} + \frac12 & {1-\frac{n+1}{2^n}\over2}\\ 0 & {2^{-n}+1\over2} & {1-2^{-n}\over2} \\ 0 & {1-2^{-n}\over2} & {2^{-n}+1\over2} \end{pmatrix}. \end{equation}