# Prove that if A is idempotent and fullfills $A = A^{-1}$ then it follows that $A = I_n$

I'm currently learning linear algebra and I have stumbled across the following example in my book without a solution.

A matrix $$B \in \mathbb {R}^{n x n}$$ is called idempotent if $$BB = B$$. Prove that if A is idempotent and fullfills $$A = A^{-1}$$ then it follows that $$A = I_n$$.

$$A = A^{-1}$$ gives $$A^2=I_n$$. Since $$A$$ is idempotent, we have $$A=A^2.$$
Hint: $$AA^{-1}=I_n$$ by definition.