Given a matrix $ A = \begin{pmatrix} 1 && 1 && 2 \\ 0 && 1 && 1 \\ 0 && 0 && 1 \end{pmatrix}$ determine the general formula for $A^k$ . I tried to solve it by induction and therefore computed the first steps up to $A^4$. The diagonal seems to stay constantly at 1, while $a_{12}$ and $a_{23}$ are equal to $k$. What I can't figure out is $a_{13}$. I've computed it for $A, A^2, A^3, A^4$ and the values are $2, 5, 9, 14, 20$.
How can I find the general pattern and prove it? Is there a general algorithm for finding $A^k$ where $A \in M_{i,j}(C)$ where M is the set of all matrixes that can be formed with elements from $C$.