|
Quadratic ResiduesModular Arithmetic and Quadratic EquationsHow does one determine the solvability and the solutions of an equation such as
The problem boils down to the question: Which nonzero residues (mod R) have square roots (mod R)? That is, for which a in NR are there x in NR such that
The following two definitions apply only to nonzero elements of NR: If a is a nonzero residue (mod R) which has a square root (mod R), then a is said to be a quadratic residue (mod R); otherwise, a is said to be a non-quadratic residue (mod R) (textbooks often say quadratic non-residue instead of non-quadratic residue). It is always the case that 1 is a quadratic residue mod R; the main interest is in determining if there are any others. Examples:
The following theorems provide us with computational tools to determine if for odd prime number P, a given number in NP has a square root mod P. Theorem (Euler) Let P be an odd prime number and let a be a nonzero number in NP. Then a(p-1)/2 mod P = 1, or a(p-1)/2 mod P = P-1. (Recall that in NP, -1 is the same thing as P-1.) Theorem (Euler's Criterion): Let P be an odd prime number and let a be a nonzero number in NP. Then the following are equivalent:
Hence we can also conclude that a is a nonquadratic residue if, and only if, a(p-1)/2 mod P = P-1. Legendre SymbolThe quantity a(p-1)/2 mod P is denoted by a special symbol, called the Legendre symbol, which is
(a/P) is 1 iff a is a quadratic residue (mod P). The Legendre symbol has the following properties which are quite useful in computing whether one number is a quadratic residue modulo another, which is an odd prime: Theorem: Let P be an odd prime number and let a and b be nonzero elements of NP. Then:
From item 3 in the last theorem one gleans: Corollary: Let P be an odd prime number. Then
Moreover, there are for a given odd prime number P as many quadratic residues mod P as there are non-quadratic residues mod P: Theorem: For an odd prime number P, there are (P-1)/2 quadratic residues mod P, and there are (P-1)/2 non-quadratic residues mod P. The following important theorem is due to Gauss: Theorem (Gauss): If P is an odd prime number, then (2/P) is equal to (-1) raised to the power (P2-1)/8. The deepest of the results regarding quadratic residues was first proven rigorously by Gauss, and is known as the Quadratic Reciprocity Law. It states: Quadratic Reciprocity LawTheorem (Quadratic Reciprocity Law): Let P and Q be odd prime numbers. Then
Another way to express the quadratic reciprocity law is:
Using the Quadratic Reciprocity Law Alan Baker's book "A concise introduction to the theory of numbers" uses this as an example of how to use the law of quadratic reciprocity to show that (-3/p) = (p/3). First, by quadratic reciprocity,
Then, by the identities (ab/P) = (a/P) (b/P) and (-1/P) = (-1)(p-1)/2,
Now, to find the primes, p, for which -3 is a quadratic residue (mod p) -- which are also the primes, p, that are a quadratic residue (mod 3),
Primes which have a given number, d, as a quadratic residue: Mathworld's article, Quadratic Residue includes a table giving the primes which have a given number, d, as a quadratic residue (left). One of the many delightful fractal images (right) shows (y/x), i.e. a dot is shown if y is a quadratic residue (mod x). The dark horizontal lines are the numbers that are square in any modulus -- 1, 4, 9, 16, ... The diagonal lines are the squares that are between 1 and 2 times the modulus. That is, the points for which (y/x)=1 because y+x is a square. If you look very carefully, you can also see some steeper diagonal lines (with a slope of -2) that represent the points (y/x) for which y+2x is a square. And, of course, the snowstorm of black dots in between these lines represent points (y/x) for which y+mx is a square, for some value of m, so in a sense, all the dots are part of some diagonal with slope -m.
How do you compute a square root mod P? We now have a computational method for determining for an odd prime number P whether a given a in NP is a quadratic residue mod P, or not. Once it is known that such a square root exists, one can proceed to try and find such a square root. How is this done? A second, equally important question, is: suppose we know that a is a quadratic residue modulo the prime number P: Can we find a quadratic residue b modulo P such that b2 = a mod P? And what about the case when P is a composite number? In the case when P = 3 mod 4, or where the modulus is a product of two distinct prime numbers, each equal to 3 mod 4, there is a simple algorithm for this: First, one solves the quadratic equation x2 = a mod P for the case when P is an odd prime equal to 3 mod 4 and a is a quadratic residue mod P. The method is given in the following theorem. Theorem: Let P be a prime number such that P mod 4 = 3. Let a be a quadratic residue mod P. Define k by (P-1)/2 = 2*k + 1. Then
is a solution for x2 = a mod P. Moreover, x is a quadratic residue mod P, and is the only such solution to this equation. Then, using the method for doing this, one solves the equation x2 mod R = a where R = P*Q and P and Q are two prime numbers, each equal to 3 mod 4. This is done by first solving each of the equations x2 = a mod P and x2 mod Q = a, and then using the Chinese remainder theorem to find the final result. Thus, say we have found p in NP and q in NQ such that
Then we use the technique of the Chinese Remainder Theorem to compute from p and q an element x of NR such that
(Tonelli-Shanks algorithm) Internet References
Related Pages in this website
|
|
The webmaster and author of the Math
Help site is Graeme McRae. |