Quadratic Gauss sum
= Quadratic Gauss sum
{title2=$G(\chi)$}
{wiki}
For an <odd prime> $p$, put $\omega=e^{2\pi i/p}$ and let $\chi$ be the <Legendre symbol>. The quadratic Gauss sum is
$$
G(\chi)=\sum_{a=1}^{p-1}\chi(a)\omega^a.
$$
With this choice of $\omega$ and the positive real <square root> of $p$, its exact value is
$$
G(\chi)=\begin{cases}\sqrt p,&p\equiv1\pmod4,\\i\sqrt p,&p\equiv3\pmod4.\end{cases}
$$
The <modulus> can be established without determining the sign. Expanding $G(\chi)\overline{G(\chi)}$ and putting $a=tb$ gives
$$
|G(\chi)|^2=\sum_{t=1}^{p-1}\chi(t)\sum_{b=1}^{p-1}\omega^{(t-1)b}=p.
$$
The inner <sum> is $p-1$ for $t=1$ and $-1$ otherwise, while $\sum_{t=1}^{p-1}\chi(t)=0$ because the nonzero <quadratic residues> and <quadratic nonresidues> are equally numerous. Also, <complex conjugation> followed by $a\mapsto-a$ gives $\overline{G(\chi)}=\chi(-1)G(\chi)$. Hence the sum is real for $p\equiv1\pmod4$ and purely imaginary for $p\equiv3\pmod4$. These two observations determine its magnitude and its real or imaginary axis; choosing the sign in the exact evaluation is an additional step.