TITLE: Finding the general formula for the powers of a matrix
QUESTION [6 upvotes]: Let $A=\begin{bmatrix}0&1\\1&0\end{bmatrix}$. Find the formula for $A^n$ and prove it.

The way I tried to solve it is like this:
If we find $A^2$, $A^3$ and so on you will notice this patern: If $n$ is odd $A^n=\begin{bmatrix}0&1\\1&0\end{bmatrix}$. If $n$ is even then $A^n=I$.
To prove this I used mathematical induction.
We see that the base case is $A^1$ and $A^2$.
Now we suppose the statement holds for a natural number $n$. If $n+1$ is odd then this means that n is even and we see that the matrix $A^{n+1}=A^nA=\begin{bmatrix}0&1\\1&0\end{bmatrix}$, so the statement holds in this case. If $n+1$ is even then this means that $n$ is odd and we see that the matrix $A^{n+1}=A^nA=I$, so the statement holds in this case also. As a consequence the statement holds for all natural numbers. 
I want to know if this proof is right or not? Can someone help me?

REPLY [2 votes]: Yes.
Another approach is by diagonalising the (symmetric) matrix $A$
$$
A = V D V^T
$$
where $D$ is the diagonal matrix of eigenvalues $(\pm1)$ and $V$ is the matrix formed from eigenvectors of $A$
Then
$$
A^n = V D^n V^T
$$
so it depends on $$D^n=\left( \begin{array}{cc}1 &0 \\
0& -1
\end{array} \right)^n$$
A key thing is that to compute a diagonal matrix to a power you raise the diagonal elements to that power.

If n is even then $D^n=I$, so $A^n=V I V^T = I $ due to orthogonality of $V$.
If n is odd then $D^n=D$, so $A^n=V D V^T = A $