1

Let $A,B$ be $n\times n$ matrices. Suppose that $A^2+B^2=0_n$ and $AB-BA$ is invertible. Show that $n$ is even

My approach to this problem is that:
$A^2 + B^2 = 0_n\implies A^2 = -B^2\implies \det(A^2) = (-1)^n \det(B^2)$ and if $A$ and $B$ is invertible then $n$ has to be even since $\det(A^2) = (\det A)^2$
However, I am unable to prove $A$ and $B$ is invertible and I still could not use the information $AB-BA$ is invertible

Please give me the answer to this problem, thank you.