Definition:Legendre Symbol

The Legendre symbol is a function introduced by Adrien-Marie Legendre in Paris in 1798, during his partly successful attempt to prove the Law of Quadratic Reciprocity.

The function was later expanded into the Jacobi Symbol, the Kronecker Symbol, the Hilbert Symbol and the Artin Symbol.

Definition
Legendre defined the symbol as follows:

Let $$p$$ be an odd prime.

Let $$a \in \Z$$.

Then:
 * $$\left({\frac{a}{p}}\right) = \pm 1 \equiv a^{(p-1)/2} \pmod p$$.

where



\left({\frac{a}{p}}\right) = \begin{cases} \;\;\,0\mbox{ if } a \equiv 0 \pmod{p} \\+1\mbox{ if }a \not\equiv 0\pmod{p} \mbox{ and for some integer }x, x^2\equiv \;a \pmod{p} \\-1\mbox{ if there is no such } x. \end{cases}$$

From Euler's Criterion, this can be seen to be equivalent to:

$$ \left({\frac{a}{p}}\right) = \begin{cases} 0 & : a \equiv 0 \pmod{p} \\ +1 & : a \mbox{ is a quadratic residue of } p \\ -1 & : a \mbox{ is a quadratic non-residue of } p \end{cases}$$

For a given $$p$$, the Legendre symbol is usually treated as a function $$f_p: \Z \to \left\{{-1, 0, 1}\right\}$$.

Applications
The Legendre Symbol can be used as a tool to finding whether a number is a Quadratic Residue (mod $$p$$) through the following conditions:


 * $$\left({\frac{a}{p}}\right) = 1$$ iff $$a$$ is a Quadratic Residue mod $$p$$;
 * $$\left({\frac{a}{p}}\right) = -1$$ iff $$a$$ is a Quadratic Non-Residue mod $$p$$.

This follows directly from the definitions of quadratic residue and quadratic non-residue, and Euler's Criterion.

Properties
There are a number of useful properties of the Legendre symbol which can be used to speed up calculations. They include:


 * $$\left({\frac{a b}{p}}\right) = \left({\frac{a}{p}}\right) \left({\frac{b}{p}}\right)$$;


 * If $$a \equiv b \pmod p$$, then $$\left({\frac{a}{p}}\right) = \left({\frac{b}{p}}\right)$$;


 * $$\left({\frac{a^2}{p}}\right) = 1$$.

See Properties of Legendre Symbol.

Law of Quadratic Reciprocity

 * If $$p$$ and $$q$$ are odd primes then:
 * $$ \left({\frac{q}{p}}\right) = \left({\frac{p}{q}}\right)(-1)^{(p-1)(q-1)/4}$$.

This is called the Law of Quadratic Reciprocity.

+1\mbox{ if }p \equiv 1\pmod{4} \\ -1\mbox{ if }p \equiv 3\pmod{4} \end{cases}$$
 * $$\left({\frac{-1}{p}}\right) = (-1)^{(p-1)/2} = \begin{cases}

This is called the First Supplement to the Law of Quadratic Reciprocity.

+1\mbox{ if }p \equiv 1\mbox{ or }7 \pmod{8} \\ -1\mbox{ if }p \equiv 3\mbox{ or }5 \pmod{8} \end{cases}$$
 * $$\left({\frac{2}{p}}\right) = (-1)^{(p^2-1)/8} = \begin{cases}

This is called the Second Supplement to the Law of Quadratic Reciprocity.