Let $A, B \in M_n(\mathbb{R})$ such that : $AB-BA$ invertible and $A^2+B^2 = AB$ then prove that : $3 \mid n$.
I have seen answers here. But I was wondering if the other direction is also true, that is: say we have $A^2+B^2 = AB$ and if $3 \mid n$, then $AB-BA$ is invertible. If it is not true, then are there any cases divided where if A and B are nonzero, then AB-BA is either invertible or not invertible?