TITLE: Proving these trigonometric sums $\sum\limits_{k=0}^{n-1}\sin\frac{2k^2\pi}{n}=\frac{\sqrt{n}}{2}\left(\cos\frac{n\pi}{2}-\sin\frac{n\pi}{2}+1\right)$
QUESTION [6 upvotes]: Can someone help me to prove that:
$$ \sum_{k=0}^{n-1}\sin\frac{2k^2\pi}{n}=\frac{\sqrt{n}}{2}\left(\cos\frac{n\pi}{2}-\sin\frac{n\pi}{2}+1\right)$$
$$\sum_{k=0}^{n-1}\cos\frac{2k^2\pi}{n}=\frac{\sqrt{n}}{2}\left(\cos\frac{n\pi}{2}+\sin\frac{n\pi}{2}+1\right)$$

REPLY [6 votes]: Let $A = \sum_{k=0}^{n-1}\cos\frac{2k^2\pi}{n}$ and $B = \sum_{k=0}^{n-1}\sin\frac{2k^2\pi}{n}$ then we are looking to show:
$$ \sum_{k=0}^{n-1} e^{2\pi i k^2/n} = A + iB = e^{\tfrac{\pi i n}{2}}\sqrt{n}\tfrac{1+i}{2}  $$
I believe this is the Gauss sum

I have seen the Gauss sum for primes $p$ but not necessarily for $n$.  However,
You know the absolute value because you can find the norm, i.e. multiply by the complex conjugate, or use Parseval Theorem
$$ \bigg|\bigg|\sum_{k=0}^{n-1} e^{2\pi i k^2/n}\bigg|\bigg|^2 = 
\sum_{k=0}^{n-1} e^{2\pi i k^2/n} \times 
\overline{\sum_{k=0}^{n-1} e^{2\pi i k^2/n}}
= 1\cdot 1 + \dots 1 + \cdot 1 = n$$
The norm of our Gauss sum is $\sqrt{n}$ and we need to compute the sign.