Finding the general formula for the powers of a matrix

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?

This looks absolutely correct. Another way to view it is that matrix multiplication corresponds to function composition. In particular, this is the map $T:\mathbb R^2 \to \mathbb R^2$ given by $(x,y) \mapsto (y,x)$, which is a reflection about the line $y=x$, so $T \circ T=Id$, which in turn implies that $T \circ \dots\circ T=T^{2n+1}=T \circ T^{2n}=T$, and $T^{2n}=Id$
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$$
• 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$