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?



Product of a Finite Number of Matrices Related to Roots of Unity
The following is a conjectured generalization of the claimed identity which may help in proving it. We prove this generalization (and hence also the identity from the question) in the case that $3$ does not divide $n$, and give a partial result in the remaining case.


The idea of the generalization is to observe that $x^2$ is a primitive $n$-th root of unity, and to replace the factor $-x$ in $-x^{2j+1}=(-x)(x^2)^j$ with a new variable $z$.


Thus let $\zeta$ be a primitive $n$-th root of unity and $z$ be a variable. Then it seems to be the case that
\begin{equation}
\mathop{\mathrm{Tr}}\left(\prod\_{j=0}^{n-1}\begin{pmatrix} 
\zeta^{-j} & \zeta^jz \\
1 & 0
\end{pmatrix}\right)=
\begin{cases}
-(-1)^n(1+3(\zeta z)^{n/3}) & \text{if } n\equiv0\pmod{3}\\
-(-1)^n & \text{if } n\not\equiv0\pmod{3}
\end{cases}.
\end{equation}
Let $P(z)$ the term on the left hand side. It is clear that $P(z)$ is a polynomial in $z$ of degree at most $n-1$. Cyclically permuting the factors on the left hand side does not change the trace, and neither does conjugating each factor with the same matrix. Set $\delta=\zeta^k$ for some $0\le k\le n-1$. Then
\begin{equation}
\begin{pmatrix}1&0\\0&\delta\end{pmatrix}
\begin{pmatrix}\zeta^{-j} & \zeta^jz \\1 & 0\end{pmatrix}
\begin{pmatrix}1&0\\0&1/\delta\end{pmatrix}
=
\begin{pmatrix}\zeta^{-j} & \zeta^jz/\delta \\\delta & 0\end{pmatrix}=
\delta\begin{pmatrix}\zeta^{-j-k} & \zeta^{j+k}(z\zeta^{-3k}) \\1 & 0\end{pmatrix}.
\end{equation}
This is a cyclic permutation shifted by $k$, and shows $P(z)=P(z\zeta^{-3k})$ for all $0\le k\le n-1$.


So if $n\not\equiv0\pmod{3}$, then $P(z)$ must be a constant. One easily computes $P(0)$ and obtains the claim.


In the case $3\mid n$, we get that that $P(z)$ is a polynomial in $z^{n/3}$. Also, as the product of any two consecutive factors in $P(z)$ has each matrix entry of degree at most $1$, we see that $P(z)$ actually has degree at most $(n+1)/2$. Thus $P(z)=a\_n+b\_nz^{n/3}$. We get $a\_n=P(0)$. Right now I do not see how to get $b\_n$. Maybe one can analyze $P(z)$ for $z\to\infty$, or there is another trick to compute $P(1/\zeta)$ (which should be $\pm4$).


