# $A^2$ $B=A^2-B$ then $AB=BA$

If for $2$ real $n$ by $n$ matrices we have $A^2B=A^2-B$ then prove that the two matrices commute.

This is a problem from a competition.

I've tried several manipulations but none of them work.

Can't come up with a counter example, as well.

• Hint. The given identity is equivalent to $(I+A^2)(I-B) = I$. Can you write $B$ in terms of $A$? – Sangchul Lee Mar 21 '16 at 3:10
• With your help, I ended up at $A^2B=BA^2$. – aboat Mar 21 '16 at 3:16
• $B = A^2(I+A^2)^{-1}$. So, $B$ commutes with $A$. – Friedrich Philipp Mar 21 '16 at 3:20
• Nice exercise!. – Friedrich Philipp Mar 21 '16 at 3:24
• I still don't see it. Definitely blind. Why does the inverse of $I+A^2$ commute with $A$? – aboat Mar 21 '16 at 3:31

As Sangchul Lee says in the comments, putting everything to one side allows us to add $I$ to both sides and factor as $I=(I+A^2)(I-B)$, telling us $I+A^2$ and $I-B$ are invertible, and $B=I-(I+A^2)^{-1}$.
Obviously to determine $B$ commutes with $A$, it suffices to see $(I+A^2)^{-1}$ commutes with $A$.
Prove that whenever $X$ is invertible, $X$ and $A$ commute if and only if $X^{-1}$ and $A$ commute. Then you can apply this principle with $X=I+A^2$.