Computing the matrix powers of a non-diagonalizable matrix Define 
\begin{equation}
A = \begin{pmatrix} \frac{1}{2} &\frac{1}{2} & 0\\ 0& \frac{3}{4} & \frac{1}{4}\\ 0& \frac{1}{4} & \frac{3}{4} \end{pmatrix}.
\end{equation}
Note that the sum of the dimensions of the eigenspaces of $A$ is only two. $A$ is thus not diagonalizable. How can we compute $A^n$?

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 !).
