AoPSWiki
Do you have what it takes to be the next brilliant trader, researcher, or developer at Jane Street Capital? Find out in the Careers in Mathematics Forum.
Personal tools

Quadratic residues

From AoPSWiki

Let and be integers, with . We say that is a quadratic residue modulo if there is some integer so that is divisible by .

Contents

Legendre Symbol

Determining whether is a quadratic residue modulo is easiest if is a prime. In this case we write \left(\frac{a}{p}\right)=\begin{cases} 0 & \mathrm{if }\ p\mid a, \\ 1 & \mathrm{if }\ p\nmid a\ \mathrm{ and }\ a\ \mathrm{\ is\ a\ quadratic\ residue\ modulo\ }\ p, \\ -1 & \mathrm{if }\ p\nmid a\ \mathrm{ and }\ a\ \mathrm{\ is\ a\ quadratic\ nonresidue\ modulo\ }\ p. \end{cases}

The symbol is called the Legendre symbol.

Quadratic Reciprocity

Let and be distinct odd primes. Then \left(\frac{p}{q}\right)\left(\frac{q}{p}\right)=(-1)^{\frac{p-1}{2}\frac{q-1}{2}}. This is known as the Quadratic Reciprocity Theorem. Whereas the above are properties of the Legendre symbol, they still hold for any odd coprime integers and when using the Jacobi symbol defined below.

Additional properties

Also, we have for any odd prime the following rules:

Multiplicaticity: \left(\frac{a}{p}\right) \left(\frac{b}{p}\right) = \left(\frac{ab}{p}\right)

Euler's criterion: \left(\frac{a}{p}\right) \equiv a^{\frac{p-1}{2}} \mod p

First supplementary rule: \left(\frac{-1}{p}\right)=(-1)^{\frac{p-1}{2}}, so \left(\frac{-1}{p}\right)=1 \iff p \equiv 1 \mod 4

Second supplementary rule: \left(\frac{2}{p}\right)=(-1)^{\frac{p^2-1}{8}}, so \left(\frac{2}{p}\right)=1 \iff p \equiv \pm 1 \mod 8

It's also useful not to forget that the symbols are only properties , so a \equiv b \mod p \implies \left(\frac{a}{p}\right)=\left(\frac{b}{p}\right)

Jacobi Symbol

Now suppose that is odd, and let . Then we write \left(\frac{a}{m}\right)=\left(\frac{a}{p_1}\right)^{e_1}\cdots\left(\frac{a}{p_n}\right)^{e_n}. This symbol is called the Jacobi symbol. All properties mentioned above except Euler's criterion are also true for Jacobi symbols with odd (positive) integers and instead.

Note that does not mean that is a quadratic residue (but is necassary for it to be).

Calculation and examples

With the rules and properties already mentioned, it's eays to calculate Jacobi symbols. Since they are for primes identical to the Legendre symbol, this gives a fast way to decide if an integer is a quadratic residue or not.

Example:

\left(\frac{12345}{13337}\right) =

=\left(\frac{13337}{12345}\right) = \left(\frac{992}{12345}\right) = \left(\frac{2^5}{12345}\right)\left(\frac{31}{12345}\right)=\left(\frac{2}{12345}\right)^5 \left(\frac{12345}{31}\right)=

= 1^5 \left(\frac{7}{31}\right) = -\left(\frac{31}{7}\right) = -\left(\frac{3}{7}\right) = \left(\frac{7}{3}\right) = \left(\frac{1}{3}\right)=

Thus we know that is a quadratic residue modulo the prime . Indeed:

In a more general manner, one, for example, also gets:

\left(\frac{-2}{p}\right) = \left(\frac{-1}{p}\right)\left(\frac{2}{p}\right) = (-1)^{\frac{(p-2)^2-1}{8}}, so \left(\frac{-2}{p}\right)=1 \iff p \equiv 1,3 \mod 8.

\left(\frac{3}{p}\right) = (-1)^{\frac{p-1}{2}} \left(\frac{p}{3}\right), so \left(\frac{3}{p}\right)=1 \iff p \equiv \pm 1 \mod 12.

\left(\frac{-3}{p}\right) = \left(\frac{p}{3}\right), so \left(\frac{-3}{p}\right)=1 \iff p \equiv 1 \mod 3.

The general case

In general, to determine whether is a quadratic residue modulo , one has to check whether is a quadratic residue modulo every odd prime dividing . This is enough if is odd or and is odd. If and is odd, one also has to check that a\equiv 0\mathrm{\ or\ }1\mod 4. Finally, if is divisible by , one also has to check that a\equiv 0,1,\mathrm{\ or\ }4\mod 8.

The Art of Problem Solving Bookstore now offers two titles from the creator of Math Olympiads in the Elementary and Middle Schools. Click here and here to check them out.
© Copyright 2008 AoPS Incorporated. All Rights Reserved. • FoundationPrivacyContact Us