The Legendre symbol (sometimes written (a|p) for typographical convenience) is defined for integers a and positive odd primes p by (assuming the gcd of a and p is 1):
If (a|p) = 1, a is called a quadratic residue (mod p); if (a|p) = −1, a is called a quadratic nonresidue (mod p).
It is usual to treat zero as a special case.
The periodic sequence (a|p) for a equal to 0,1,2,... is sometimes called the Legendre sequence, sometimes with {0,1,-1} values replaced by {1,0,1} or {0,1,0}, respectively.
Legendre originally defined his symbol (for a relatively prime to p) as
Euler had earlier proved that this expression is ≡ 1 (mod p) if a is a quadratic residue (mod p) and that it is ≡ −1 if a is a quadratic nonresidue; this equivalence is now known as Euler's criterion.
In addition to this fundamental formula, there are many other expressions for (a|p), most of which are used in proofs of quadratic reciprocity.
Gauss proved that if then
=frac{1+zeta^{a}+zeta^{4a}+zeta^{9a}+dots+zeta^{(p-1)^2a}}{1+zeta+zeta^{4}+zeta^{9}+dots+zeta^{(p-1)^2}}
=frac{2(1+zeta^{a}+zeta^{4a}+zeta^{9a}+dots+zeta^{(p-1)^2a})}{sqrt p(1+i)(1+(-i)^p)}.
This is the basis for his fourth and sixth, and for many subsequent, proofs of quadratic reciprocity. See Gauss sum.
Kronecker's proof is to establish that
One of Eisenstein's proofs begins by showing
Using elliptic functions instead of the sine, he was able to prove cubic and quartic reciprocity as well.
The Fibonacci numbers 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ... are defined by the recurrence F1 = F2 = 1, Fn+1 = Fn + Fn-1.
If p is a prime number then
For example,
This result comes from the theory of Lucas sequences, which are used in primality testing. See Wall-Sun-Sun prime.
There are a number of useful properties of the Legendre symbol which can be used to speed up calculations. They include:
left(frac{ab}{p}right) = left(frac{a}{p}right)left(frac{b}{p}right) (It is a completely multiplicative function in its top argument. This property can be understood to mean: the product of two residues or non-residues is a residue, whereas the product of a residue with a non-residue is a non-residue.)
left(frac{a}{p}right) = left(frac{b}{p}right)
left(frac{a^2}{p}right) = 1
left(frac{-1}{p}right) = (-1)^{(p-1)/2} =begin{cases} +1mbox{ if }p equiv 1pmod{4} -1mbox{ if }p equiv 3pmod{4} end{cases}
This is called the first supplement to the law of quadratic reciprocity.
left(frac{2}{p}right) = (-1)^{(p^2-1)/8} =begin{cases} +1mbox{ if }p equiv 1mbox{ or }7 pmod{8} -1mbox{ if }p equiv 3mbox{ or }5 pmod{8} end{cases}
This is called the second supplement to the law of quadratic reciprocity. The general law of quadratic reciprocity is
left(frac{q}{p}right) = left(frac{p}{q}right)(-1)^{ frac{p-1}{2} frac{q-1}{2} }.
See the articles quadratic reciprocity and proofs of quadratic reciprocity.
There are special formulas for some small values of p:
left(frac{3}{p}right) = (-1)^left lceil frac{p+1}{6} right rceil =begin{cases} +1mbox{ if }p equiv 1mbox{ or }11 pmod{12} -1mbox{ if }p equiv 5mbox{ or }7 pmod{12} end{cases}
left(frac{5}{p}right) =(-1)^left lfloor frac{p-2}{5} right rfloor =begin{cases} +1mbox{ if }p equiv 1mbox{ or }4 pmod5 -1mbox{ if }p equiv 2mbox{ or }3 pmod5 end{cases},
but in general it is simpler to list the residues and non-residues
left(frac{7}{p}right) =begin{cases} +1mbox{ if }p equiv 1, 3, 9, 19, 25,mbox{ or }27pmod{28} -1mbox{ if }p equiv 5, 11, 13, 15, 17, mbox{ or } 23 pmod{28} end{cases}
The Legendre symbol (a|p) is a Dirichlet character (mod p).
The above properties, including the law of quadratic reciprocity, can be used to evaluate any Legendre symbol. For example:
The article Jacobi symbol has more examples of Legendre symbol manipulation.