I found a problem in my textbook and I have tried solving it, but I had no succes. The problem is:


Let $A$ and $B$ be $n \times n$ matrices with complex number entries. Given that $AB−BA$ is invertible and $(A−B)^2=I\_n$, where $I\_n$ is the identity matrix, prove that $tr(A)=tr(B)$ and that $n$ is even. How should I approach this problem? I have tried to actually compute the inverse of $AB−BA$ from $(A−B)^2$ but I had no succes. I can also say that the eignevalues of $A-B$ are $+1$ or $-1$, but how does that help?



Proving 2 matrices have the same trace
Let's call $C=A-B$. Then you have $C^2=I\_n$ and $BC-CB$ is invertible. You want to show that $C$ has an equal dimension of $1$ and $(-1)$ eigenspaces, which in turn implies both the equality $tr(A)=tr(B)$ and $n$ being even.


Pick an eigen basis of the space to assume that
$$
C=\left(
\begin{array}{c}I\_m & 0\\ 0&-I\_k\end{array} 
\right),
~~
B=\left(
\begin{array}{c}B\_1 & B\_2\\ B\_3&B\_4\end{array} 
\right)
$$
with the appropriate sizes of $B\_i$.
Then
$$
BC-CB=\left(
\begin{array}{c}0 & \*\\ \* &0\end{array} 
\right).
$$
If $m>k$, then the first $m$ rows are linearly dependent and if $m<k$ then the last $k$ rows are.


