TITLE: How prove $\left(\sum\cos{\frac{2k-1}{p}\pi}\right)\cdot\left(\sum\cos{\frac{2k-1}{p}\pi}\right)$
QUESTION [6 upvotes]: Question:let $p$ be an odd prime number,let $A$ be the set of the (postive and less than $p$) quadratic residues modulo $p$,and $B$ be the set of the (positive and less than $p$ quadraric non-residues modulo $p$,

if we let $$p=4t+1$$
  prove or disprove 
  $$\left(\sum_{1\le k\le 2t,(2k-1)\in A}\cos{\dfrac{2k-1}{p}\pi}\right)\cdot\left(\sum_{1\le k\le 2t,(2k-1)\in B}\cos{\dfrac{2k-1}{p}\pi}\right)=-\dfrac{t}{4}$$

This problem is my found,because I know prove this follow 
(1):$p=5,t=1,$
$$\left(\cos{\dfrac{\pi}{5}}\right)\cdot\left(\cos{\dfrac{3\pi}{5}}\right)=-\dfrac{1}{2}$$
(2):$p=13,t=3$
$$\left(\cos{\dfrac{3\pi}{13}}+\cos{\dfrac{9\pi}{13}}+\cos{\dfrac{\pi}{13}}\right)
\cdot\left(\cos{\dfrac{7\pi}{13}}+\cos{\dfrac{11\pi}{13}}+\cos{\dfrac{5\pi}{13}}\right)=
-\dfrac{3}{4}$$
and so on,and I use computer  to have this:


maybe this is true,and How prove it? Thank you

REPLY [3 votes]: Note that $-1$ is a square $\bmod\,p$ and $$2k-1 \equiv 2\left(k+\frac{p-1}{2}\right) \equiv -2\left(-k+\frac{p+1}{2}\right)\mod p.$$ 
Let us first assume that $2$ is also a square $\bmod\,p$ and $k \in \{1,\ldots,(p-1)/2\}$ in what follows. Then the following are equivalent:

$2k-1$ is a quadratic residue
$k+(p-1)/2$ is a quadratic residue
$-k+(p+1)/2$ is a quadratic residue

Let $\zeta_n$ denote the root of unity $\exp(2\pi\mathrm{i}/n)$. Then we have
$$\begin{eqnarray}
\sum_{2k-1 \textrm{ square}}\cos\left(\frac{2k-1}{p}\pi\right)&=&\tfrac{1}{2}\sum_{2k - 1 \textrm{ square}}\left(\zeta_{2p}^{2k-1}+\zeta_{2p}^{-2k+1}\right)\\
&=&-\tfrac{1}{2}\sum_{2k-1 \textrm{ square}}\left(\zeta_{p}^{k+(p-1)/2}+\zeta_{p}^{-k+(p+1)/2}\right)\\
&=&-\tfrac{1}{2}\sum_{k \textrm{ square}}\zeta_{p}^k\\
&=&\frac{1-\sqrt{p}}{4}
\end{eqnarray}$$
where the last equality follows from the explicit expression for a quadratic Gauss sum. Then
$$\left(\sum_{2k-1 \textrm{ square}}\cos\left(\frac{2k-1}{p}\pi\right)\right)
\left(\sum_{2k-1 \textrm{ not square}}\cos\left(\frac{2k-1}{p}\pi\right)\right) = \frac{1-\sqrt{p}}{4} \left(\frac{1}{2}-\frac{1-\sqrt{p}}{4}\right) = \frac{1-p}{16}.
$$
The case that $2$ is not a square $\bmod\,p$ can be shown similarly but now you have to use the equivalence of:

$2k-1$ is a quadratic residue
$k+(p-1)/2$ is a quadratic non residue
$-k+(p+1)/2$ is a quadratic non residue