<s>[INST] Calculating $n$-th power of a matrix I was doing an exercise of a past exam in which one of the things I had to do was calculating the $n$th power of a Jordan matrix
$$J=\begin{pmatrix}
2 & 1 & 0 \\
0 & 2 & 1 \\
0 & 0 & 2
\end{pmatrix}.$$
I started calculating until the 5th power but I couldn't guess the expression for the $a_{1,2}$, $a_{1,3}$ and $a_{2,3}$ components. When I looked it up in an online calculator it showed that:
$$J^n=\begin{pmatrix}
2^n & \frac{2^n·n}{2} & \frac{2^n·(n^2-n)}{8} \\
0 & 2^n & \frac{2^n·n}{2} \\
0 & 0 & 2^n
\end{pmatrix}.$$
My question is: when the relationships are as difficult as these　(especially the $a_{1,3}$ component), are there any tricks for figuring out the$n$th power component? Because these kind of relationships are difficult to think in the middle of an exam.
 [/INST] $J=2I+A$, where $A=\begin{pmatrix} 0&1&0 \\0&0&1 \\ 0&0&0\end{pmatrix}$. As $A$ and $I$ commute, we can apply the binomial formula.
Observe that  $A^2=\begin{pmatrix} 0&0&1 \\0&0&0 \\ 0&0&0\end{pmatrix}$, $A^k=0$ for $k\ge 3$, so the $n$-th power is
$$J^n=2^n I+n2^{n-1}A+\frac{n(n-1) 2^{n-2} }2A^2=2^n I+n2^{n-1}A+n(n-1) 2^{n-3}A^2. $$
</s>