Artificial intelligent assistant

Integer $2 \times 2$ matrices such that $A^n = I$ An earlier question today motivates this slight variant: For what natural numbers $n$ does there exist a non-identity integer $2\times 2$ matrix $A$, such that $A^n = I$? (And let's say $A^k \ne I$ for $|k| < |n|$, too.) Clearly there are solutions for $n=2,3$, because $(-I)^2 = I$, and for $n=3$ we have $\left( \begin{smallmatrix} -2 & 1\\\ -3 & 1 \\\\\end{smallmatrix} \right)$ The solution for $n = 3$ suggests to me that something involving the euclidean algorithm might come into play...and the fact the the determinant is $\pm 1$ suggests that this is really an $SL(2, \mathbb Z)$ (or $PSL(2, \mathbb Z)$)problem...but that's a group I'm woefully ignorant about. For $n = 4$, there's $\left( \begin{smallmatrix} 0 & -1\\\ 1 & 0 \\\\\end{smallmatrix} \right)$. And right about there I run out of ideas.

For $n=6$ there's $\left( \begin{smallmatrix} 2 & -1\\\ 3 & -1 \\\\\end{smallmatrix} \right)$, not surprisingly. And these are the only such $n$, even if you allow rational entries instead of just integers.

Suppose that $A^n=I$ but $A^k\
e I$ for $k

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 39d07d25a40044a40a3e57ae2dcff092