Does anyone have an idea how to prove the following identity? $$ \mathop{\mathrm{Tr}}\left(\prod_{j=0}^{n-1}\begin{pmatrix} x^{-2j} & -x^{2j+1} \\ 1 & 0 \end{pmatrix}\right)= \begin{cases} 2 & \text{if } n=0\pmod{6}\\ 1 & \text{if } n=1,5\pmod{6}\\ -1 & \text{if } n=2,4\pmod{6}\\ 4 & \text{if } n=3\pmod{6} \end{cases}, $$ where $x=e^{\frac{\pi i}{n}}$ and the product sign means usual matrix multiplication. I have tried induction but there are too many terms in all of four entries as $n$ grows. I think maybe using generating functions is the way?