# Relationship between type of matrix and eigenvalues

Prove that if the eigenvalues of a diagonalizable matrix $A\in M_n(\mathbb{R})$ are all $1$ or $-1$, then $A^{-1}=A$

What I tried to reverse the way to get the rough idea.

$$A^{-1}=A\implies A^2=I\implies A^2-I=0\implies(A+I)(A-I)=0$$

So I can only get two eigenvalues which is $1$ and $-1$ here.

So what is the proper way in proving this question?

The matrix $A$ is similar to $D=\operatorname{diag}(1,\ldots,1,-1,\ldots,-1)$ i.e. there's an invertible matrix $P$ such that $$A=PDP^{-1}$$ so what's $A^{-1}$? Can you take it from here?