Does the equation $(AB-BA)^2=I_n$ have a solution for each $n\geq 3$? $A$ and $B$ are matrices?
I found out that the equation $(AB-BA)^m=I_n$ does have solution when $n=km$ where $k$ is an arbitrary integer number. It should be noted that $m>1$ is an integer number. To prove, we just need to consider $C=\operatorname{diag}(r_1,..., r_m)$ where $r_1,..., r_m$ are the roots of $x^m-1=0$, i.e., the eigenvalues of matrix $C$. In this case we know $\operatorname{trace}(C)=0$, and so there are two matrices $A$ and $B$ such that $C=AB-BA$, and also it is vivid that $C^m=I_m$. For each $n=km$, we can duplicate the matrix $C$, $k$ times to get an $mk\times mk$ matrix to consider as new matrix $C$.
Let $$ U = \frac{1}{2}\begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix}, V = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} $$ Then $$ UV = \frac{1}{2}\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}, VU = \frac{1}{2}\begin{bmatrix} -1 & 0 \\ 0 & 1 \end{bmatrix} $$ hence $$ UV - VU = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} $$ and its square is the identity.
To create a $2n \times 2n$ matrix with the same characteristic, let $A_n$ consist of $n$ copies of $U$ along the diagonal in blocks, and let $B_n$ be $n$ copies of $V$ along the diagonal in blocks. Then $$(A_n B_n - B_n A_n)^2 = I_{2n}.$$
This leaves open the question for matrices of odd size. Offhand, I'm guessing that there might be no solution in that case, but perhaps there's something similar to this one, where $AB - BA$ turns out to be rotation by $\pi$ about the axis $(1,1,1)$ or something.
Post-comment remarks Will Jagy closes this out by noting that if $n$ is odd, and you have a solution consisting of matrices $A$ and $B$, then you can let $$ W = AB - BA $$ This can be put in Jordan normal form so that $$ P^{-1} W P $$ is a Jordan-block matrix. And its square is the identity, because it's $P^{-1} W^2 P$, and $W^2$ is assumed to be $I$. The square of a jordan block is the identity only if the block itself is diagonal, hence $P^{-1}WP$ is diagonal.
Replacing $A$ and $B$ with $A' = P^{-1}AP$ and $B' = P^{-1} B P$, we have $$ A'B' - B'A' = P^{-1} W P $$ is diagonal, and its square is still the identity. Hence all its diagonal entries are $\pm 1$, so its trace is $\pm 3$ or $\pm 1$. But in general, $tr(AB - BA) = 0$, so we have a contradiction.
Conclusion: for odd $n$, there are no such matrices $A$ and $B$.