I have the following orthogonal matrix:
$M_{5,5}=\left( \begin{array}{ccccc} 0 & 1 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 & 0 \\ \end{array} \right)$
My aim here is to diagonalize it and check some interesting properties of powers of $M$. Then I proceed to express $M$ as $M=P.D.P^{-1}$
In[125]:= M={
{0,1,0,0,0},
{1,0,0,0,0},
{0,0,0,1,0},
{0,0,0,0,1},
{0,0,1,0,0}
}
In[264]:= {d, P} = Eigensystem[M]
In[265]:= P = Transpose[P]
In[266]:= d = DiagonalMatrix[d]
In[343]:= Round[P.d.Inverse[P]] == M
Out[343]= True(*True*)
In[344]:= Round[P.d.d.Inverse[P]] == M.M
Out[344]= True(*True*)
This means that $M^k = P.D^k.P^{-1}$ so the eigenvalues of $A^k$ are $\lambda^k=\{D^k_{1,1},D^k_{2,2},D^k_{3,3},D^k_{4,4},D^k_{5,5}\}$
but when I compare $\lambda^2$ with the eigenvalues of $M^2$ the output is False.
Now I start to think that $M^2$ can be written in 2 different ways:
$M^2 = P.D^2.P^{-1}$ which we have seen it is true.
$M^2 = Q.D'.Q^{-1}$ this means that other eigen decomposition exists in ${M^2}$.
Can someone tell me If I'm wrong? If true why $M^2$ can be written in these two expressions?
EDIT:
Let's make the eigen decomposition of $M^2$ and check for equalities:
In[280]:= {dp, Pp} = Eigensystem[M.M]
In[281]:= Pp = Transpose[Pp]
In[282]:= dp = DiagonalMatrix[dp]
In[339]:= Round[Pp.dp.Inverse[Pp]] == M.M
Out[339]= True
In[340]:=(*True*)
Round[P.d.d.Inverse[P]] == M.M
Out[340]= True(*True*)
In[341]:= d==dp
Out[341]= False(*False*)
In[342]:= P == Pp
Out[342]= False(*False*)
We have seen that Eigenvectors of $M$ and $M^2$ are different and Eigenvalues of $M^2$ are not $\lambda^2$, but yet you can write $M^2$ in two different expressions.