Alternative method to find n-th power of square matrix I looking for the name of this technique to find the nth power of a square matrix:

The only two methods I know of are:

*

*$A^n = \prod \limits_{i=1}^{n}A $


*$A^n = PD^nP^{-1}$ where D is a diagonal matrix formed by the eigenvectors and P is formed from the eigenvectors.
I'm not really familiar with this method of adding matrices...So I was hoping to find the name of this technique so I can find a more detailed example of it.
 A: It's Lagrange interpolation. In general, suppose that $P\in \mathbb C^{r\times r}$ has $r$ distinct eigenvalues. Then $P$ admits an eigendecomposition $P=VDV^{-1}=V\operatorname{diag}(\lambda_1,\lambda_2,\ldots,\lambda_r)V^{-1}$. Therefore, if $f$ is any polynomial such that
$$
f(\lambda_i)=\lambda_i^n\ \text{ for each } i,\tag{1}
$$
then
$$
f(P)=f(VDV^{-1})=Vf(D)V^{-1}=VD^nV^{-1}=(VDV^{-1})^n=P^n.
$$
Thus the problem of finding $P^n$ reduces to the problem of finding a suitable polynomial $f$ such that $(1)$ holds for each eigenvalue $\lambda_i$. In particular, one can simply pick the Lagrange interpolation polynomial
$$
f(x)=\prod_{i\ne1}\frac{x-\lambda_i}{\lambda_1-\lambda_i}\lambda_1^n
+\prod_{i\ne2}\frac{x-\lambda_i}{\lambda_2-\lambda_i}\lambda_2^n
+\cdots
+\prod_{i\ne r}\frac{x-\lambda_i}{\lambda_r-\lambda_i}\lambda_r^n.\tag{2}
$$
When $r=2$, the above formula becomes
$$
f(x)=\frac{x-\lambda_2}{\lambda_1-\lambda_2}\lambda_1^n
+\frac{x-\lambda_1}{\lambda_2-\lambda_1}\lambda_2^n,
$$
so that
$$
f(P)=\frac{P-\lambda_2I}{\lambda_1-\lambda_2}\lambda_1^n
+\frac{P-\lambda_1I}{\lambda_2-\lambda_1}\lambda_2^n
=\lambda_1^nE_1+\lambda_2^nE_2.
$$
A: The trick here is that $E_1\cdot E_2 = E_2 \cdot E_1 = 0$, where
$$ E_1 = \frac1{a+b}\begin{bmatrix} a& b \\ a & b \end{bmatrix}, \quad E_2 =\frac1{a+b} \begin{bmatrix} b & -b \\ -a & a \end{bmatrix}. $$
It is easy to check that $E_i$ ($i=1,2$) is idempotent, i.e. $E_i^n = E_i$ for any $n$. It remains to find $c_1,c_2$ s.t.
\begin{align} P = c_1 E_1 + c_2 E_2. \end{align}
Letting $a=0.2, b=0.1, c_1 = 1, c_2 = 0.7$ does the job. So
\begin{align}
P^n &= (c_1E_1 + c_2 E_2)^n = c_1^n E_1^n + c_1^{n-1} c_2 (E_1^{n-1}E_2 + E_2 E_1^{n-1} + E_1E_2E_1^{n-2} +...) + {}\\
&+c_1^{n-2}c_2^2 (E_1^{n-2} E_2^2 + E_2 E_1^{n-1} E_2 + ...) + ... + c_2^n E_2^n = c_1^n E_1 + c_2^n E_2 
\end{align}
since $E_1 E_2 = E_2E_1 = 0$ and the $E_i$'s are all idempotent.
