# Quadratic Gauss sum

In number theory, quadratic Gauss sums are certain finite sums of roots of unity. A quadratic Gauss sum can be interpreted as a linear combination of the values of the complex exponential function with coefficients given by a quadratic character; for a general character, one obtains a more general Gauss sum. These objects are named after Carl Friedrich Gauss, who studied them extensively and applied them to quadratic, cubic, and biquadratic reciprocity laws.

## Definition

For an odd prime number p and an integer a, the quadratic Gauss sum g(a; p) is defined as
    $g(a;p)=\sum _{n=0}^{p-1}\zeta _{p}^{an^{2}},$
where $\zeta _{p}$ is a primitive pth root of unity, for example $\zeta _{p}=\exp(2\pi i/p)$. Equivalently,
    $g(a;p)=\sum _{n=0}^{p-1}{\big1+\left({\tfrac {n}{p}}\right){\big )}\,\zeta _{p}^{an}.$
For a divisible by p, and we have $\zeta _{p}^{an^{2}}=1$ and thus
    $g(a;p)=p.$
For a not divisible by p, we have $\sum _{n=0}^{p-1}\zeta _{p}^{an}=0$, implying that
    $g(a;p)=\sum _{n=0}^{p-1}\left({\tfrac {n}{p}}\right)\,\zeta _{p}^{an}=G(a,\left({\tfrac {\cdot }{p}}\right)),$
where
    $G(a,\chi )=\sum _{n=0}^{p-1}\chi (n)\,\zeta _{p}^{an}$
is the Gauss sum defined for any character χ modulo p.

## Properties

* The value of the Gauss sum is an algebraic integer in the pth cyclotomic field $\mathbb {Q} (\zeta _{p})$.
* The evaluation of the Gauss sum for an integer a not divisible by a prime p > 2 can be reduced to the case a = 1:
       $g(a;p)=\left({\tfrac {a}{p}}\right)g(1;p).$
* The exact value of the Gauss sum for a = 1 is given by the formula:
       $g(1;p)=\sum _{n=0}^{p-1}e^{\frac {2\pi in^{2}}{p}}={\begin{cases}(1+i){\sqrt {p}}&{\text{if}}\ p\equiv 0{\pmod {4}},\\{\sqrt {p}}&{\text{if}}\ p\equiv 1{\pmod {4}},\\0&{\text{if}}\ p\equiv 2{\pmod {4}},\\i{\sqrt {p}}&{\text{if}}\ p\equiv 3{\pmod {4}}.\end{cases}}$

### Remark

In fact, the identity
    $g(1;p)^{2}=\left({\tfrac {-1}{p}}\right)p$
was easy to prove and led to one of Gauss's proofs of quadratic reciprocity. However, the determination of the sign of the Gauss sum turned out to be considerably more difficult: Gauss could only establish it after several years' work. Later, Dirichlet, Kronecker, Schur and other mathematicians found different proofs.

## Generalized quadratic Gauss sums

Let a, b, c be natural numbers. The generalized quadratic Gauss sum G(a, b, c) is defined by
    $G(a,b,c)=\sum _{n=0}^{c-1}e^{2\pi i{\frac {an^{2}+bn}{c}}}$.
The classical quadratic Gauss sum is the sum g(a, p) = G(a, 0, p).

### Properties

* The Gauss sum G(a,b,c) depends only on the residue class of a and b modulo c.
* Gauss sums are multiplicative, i.e. given natural numbers a, b, c, d with gcd(c, d) = 1 one has
       $G(a,b,cd)=G(ac,b,d)G(ad,b,c).$
    This is a direct consequence of the Chinese remainder theorem.
* One has G(a, b, c) = 0 if gcd(a, c) > 1 except if gcd(a,c) divides b in which case one has
       $G(a,b,c)=\gcd(a,c)\cdot G\left({\frac {a}{\gcd(a,c)}},{\frac {b}{\gcd(a,c)}},{\frac {c}{\gcd(a,c)}}\right)$.
    Thus in the evaluation of quadratic Gauss sums one may always assume gcd(a, c) = 1.
* Let a, b, c be integers with ac ≠ 0 and ac + b even. One has the following analogue of the quadratic reciprocity law for (even more general) Gauss sums
       $\sum _{n=0}^{|c|-1}e^{\pi i{\frac {an^{2}+bn}{c}}}=\left|{\frac {c}{a}}\right|^{\frac {1}{2}}e^{\pi i{\frac {|ac|-b^{2}}{4ac}}}\sum _{n=0}^{|a|-1}e^{-\pi i{\frac {cn^{2}+bn}{a}}}$.
* Define
       $\varepsilon _{m}={\begin{cases}1&{\text{if}}\ m\equiv 1{\pmod {4}}\\i&{\text{if}}\ m\equiv 3{\pmod {4}}\end{cases}}$
    for every odd integer m. The values of Gauss sums with b = 0 and gcd(a, c) = 1 are explicitly given by
       $G(a,c)=G(a,0,c)={\begin{cases}0&{\text{if}}\ c\equiv 2{\pmod {4}}\\\varepsilon _{c}{\sqrt {c}}\left({\dfrac {a}{c}}\right)&{\text{if}}\ c\equiv 1{\pmod {2}}\\(1+i)\varepsilon _{a}^{-1}{\sqrt {c}}\left({\dfrac {c}{a}}\right)&{\text{if}}\ c\equiv 0{\pmod {4}}.\end{cases}}$
    Here (⁠a/c⁠) is the Jacobi symbol. This is the famous formula of Carl Friedrich Gauss.
* For b > 0 the Gauss sums can easily be computed by completing the square in most cases. This fails however in some cases (for example, c even and b odd), which can be computed relatively easy by other means. For example, if c is odd and gcd(a, c) = 1 one has
       $G(a,b,c)=\varepsilon _{c}{\sqrt {c}}\cdot \left({\frac {a}{c}}\right)e^{-2\pi i{\frac {\psi (a)b^{2}}{c}}},$
    where ψ(a) is some number with 4ψ(a)a ≡ 1 (mod c). As another example, if 4 divides c and b is odd and as always gcd(a, c) = 1 then G(a, b, c) = 0. This can, for example, be proved as follows: because of the multiplicative property of Gauss sums we only have to show that G(a, b, 2$^m$) = 0 if n > 1 and a, b are odd with gcd(a, c) = 1. If b is odd then an$^2$ + bn is even for all 0 ≤ n < c − 1. For every q, the equation an$^2$ + bn + q = 0 has at most two solutions in $\mathbb {Z}$/2$^n$$\mathbb {Z}$. Indeed, if $n_{1}$ and $n_{2}$ are two solutions of same parity, then $(n_{1}-n_{2})(a(n_{1}+n_{2})+b)=\alpha 2^{m}$ for some integer $\alpha$, but $(a(j_{1}+j_{2})+b)$ is odd, hence $j_{1}\equiv j_{2}{\pmod {2^{m}}}$. Because of a counting argument an$^2$ + bn runs through all even residue classes modulo c exactly two times. The geometric sum formula then shows that G(a, b, 2$^m$) = 0.
* If c is an odd square-free integer and gcd(a, c) = 1, then
       $G(a,0,c)=\sum _{n=0}^{c-1}\left({\frac {n}{c}}\right)e^{\frac {2\pi ian}{c}}.$
    If c is not squarefree then the right side vanishes while the left side does not. Often the right sum is also called a quadratic Gauss sum.
* Another useful formula
       $G\left(n,p^{k}\right)=p\cdot G\left(n,p^{k-2}\right)$
    holds for k ≥ 2 and an odd prime number p, and for k ≥ 4 and p = 2.