In my answer to [this question](https://mathoverflow.net/q/420359), there appears the following sub-question about a sum of roots of unity. Denoting $z=\exp\frac{i\pi}N$ (so that $z^N=-1$), can the quantity
$$\sum\_{k=0}^{N-1}z^{2k^2+k}$$
vanish ?


The answer is clearly **No** for $N\le7$. I suspect that it never vanishes, which should answer definitively the above matricial question. Any idea of a general argument ?



Vanishing of a sum of roots of unity
For general $N$, we can reason by induction on the $2$-adic valuation of $N$. If $N$ is odd, GH from MO's answer shows that $S\_N :=\sum\_{k=0}^{N-1} \zeta\_{2N}^{2k^2+k} \neq 0$, where $\zeta\_{2N} = z = e^{\pi i/N}$ is a primitive $2N$-th root of unity. The same argument shows that for any odd $N$ and any $b \neq 1$, the following variant of $S\_N$ is nonzero:
\begin{equation\*}
S\_{N,b} :=\sum\_{k=0}^{N-1} \zeta\_{2N}^{2^b k^2+k} \neq 0.
\end{equation\*}
For convenience of the reader, the proof goes as follows. In the ring $\mathbb{Z}[z]/(2)$, we have
\begin{equation\*}
S\_{N,b}^{2^{b+3}} = \sum\_{k=0}^{N-1} z^{2^{b+3} (2^b k^2+k)} = \sum\_{k=0}^{N-1} \zeta\_N^{2^{2b+2} k^2+2^{b+2} k} = \sum\_{k=0}^{N-1} \zeta\_N^{(2^{b+1} k + 1)^2 - 1} = \zeta\_N^{-1} \sum\_{\ell=0}^{N-1} \zeta\_N^{\ell^2},
\end{equation\*}
and one conclude as in GH from MO's answer.


Now write $N=2^a M$ with $M$ odd, and assume $a \geq 1$. The Galois group of $\mathbb{Q}(\zeta\_{2N})/\mathbb{Q}(\zeta\_N)$ is of order 2, generated by the automorphism $\sigma : \zeta\_{2N} \mapsto \zeta\_{2N}^{1+N} = - \zeta\_{2N}$. Moreover, we have
\begin{equation\*}
\sigma(S\_{N,b}) = \sum\_{k=0}^{N-1} (-\zeta\_{2N})^{2^b k^2+k} = \sum\_{k=0}^{N-1} (-1)^k \zeta\_{2N}^{2^b k^2+k},
\end{equation\*}
so that
\begin{equation\*}
\frac12 (S\_{N,b}+\sigma(S\_{N,b})) = \sum\_{\substack{k=0 \\ k \textrm{ even}}}^{N-1} \zeta\_{2N}^{2^b k^2+k} = \sum\_{k=0}^{N/2-1} \zeta\_{2N}^{2^{b+2} k^2+2k} = \sum\_{k=0}^{N/2-1} \zeta\_N^{2^{b+1} k^2+k} = S\_{N/2, b+1}.
\end{equation\*}
By induction, we have $S\_{N/2,b+1} \neq 0$, which implies $S\_{N,b} \neq 0$.


