Skip to content
Mar 11

Quadratic Residues and the Legendre Symbol

MT
Mindli Team

AI-Generated Content

Quadratic Residues and the Legendre Symbol

Understanding when a quadratic congruence has a solution is a fundamental problem in number theory with deep implications for algorithms and cryptography. This topic provides the tools to answer questions like: "For a given prime , which integers are perfect squares modulo ?" The answer lies in the elegant theory of quadratic residues, quantified by the Legendre symbol, and governed by the powerful Law of Quadratic Reciprocity.

Defining Quadratic Residues and Nonresidues

Let be an odd prime and let be an integer such that (i.e., is not divisible by ). We say is a quadratic residue modulo if the congruence has a solution. If the congruence has no solution, then is a quadratic nonresidue modulo .

For example, consider the prime . The squares modulo are: Thus, the quadratic residues modulo are , , and . The numbers , , and are quadratic nonresidues. A key observation is that exactly half of the non-zero integers modulo an odd prime are quadratic residues. In general, for an odd prime , there are quadratic residues and quadratic nonresidues.

The Legendre Symbol and Euler's Criterion

To efficiently encode this information, Adrien-Marie Legendre introduced a notation now called the Legendre symbol. For an odd prime and integer , it is defined as:

The Legendre symbol is a compact way to ask and answer the question of solvability. Computing it directly from the definition requires checking half the numbers modulo , which is inefficient. Fortunately, Euler's criterion provides a direct computational formula: The result is either or modulo (or if ). For instance, to compute , we calculate . Therefore, , confirming is a quadratic residue modulo (indeed, ).

Euler's criterion also leads to two immediate multiplicative properties of the Legendre symbol:

  1. .
  2. , provided .

These properties allow you to break down the computation of a Legendre symbol into its prime factors.

The Law of Quadratic Reciprocity

While Euler's criterion is conceptually powerful, performing modular exponentiation with large numbers is computationally heavy. The Law of Quadratic Reciprocity, first proven fully by Carl Friedrich Gauss, provides a dramatically more efficient method for calculation. This law establishes a profound relationship between the quadratic characters of two different odd primes.

Theorem (Quadratic Reciprocity): Let and be distinct odd primes. Then: This is often stated in two equivalent, more actionable forms:

  • If either or , then .
  • If both and , then .

To use reciprocity effectively, you combine it with two supplementary rules:

  1. The First Supplementary Law: . This equals if and if .
  2. The Second Supplementary Law: . This equals if and if .

Consider computing . First, factor: .

  • For : Since , the second supplementary law gives .
  • For : Reciprocity applies. Since and , we have .
  • For : Both and are , so .
  • Now compute . Since , reciprocity gives . By the second supplementary law, , so .

Multiplying the results: . Thus, is a quadratic nonresidue modulo .

The Jacobi Symbol for Efficient Computation

When the denominator in a Legendre symbol calculation is not prime, you cannot directly apply reciprocity. However, for odd composite integers, we use the Jacobi symbol, a generalization denoted for an odd integer with prime factorization . It is defined in terms of the Legendre symbol:

Crucially, the Jacobi symbol retains the same multiplicative properties and obeys the same reciprocity laws as the Legendre symbol. However, its meaning is different: a Jacobi symbol of does not guarantee that is a quadratic residue modulo . Its primary utility is computational. It allows you to apply the reciprocity algorithm without needing to factor the denominator, which is a massive advantage. This efficiency is exploited in algorithms like the Solovay-Strassen primality test.

For example, to compute the Jacobi symbol where : Here, as a Jacobi symbol tells us that is not a quadratic residue modulo at least one of the prime factors of (in fact, it's a nonresidue modulo both and ).

Applications to Representing Primes by Quadratic Forms

A classic application of this theory is determining which primes can be represented by certain binary quadratic forms. For instance, consider the question: "Which odd primes can be written as for integers and ?"

The answer is deeply connected to quadratic residues modulo . A prime can be expressed as a sum of two squares if and only if . The reasoning uses the fact that implies , or . Therefore, must be a quadratic residue modulo . By the first supplementary law, this happens exactly when .

Similarly, determining which primes are of the form involves checking whether is a quadratic residue modulo . Using the properties of the Legendre symbol, . Analyzing the conditions for this product to equal leads to the conclusion that is possible precisely when or . These results are prototypical examples of the deep interplay between quadratic reciprocity and the theory of quadratic forms.

Common Pitfalls

  1. Assuming the Jacobi symbol implies a quadratic residue. The most frequent error is interpreting a Jacobi symbol as proof that is solvable. Remember, the Jacobi symbol is a computational tool that generalizes the Legendre symbol's notation and rules, but its output of only guarantees that is a quadratic residue modulo if is prime. For composite , it is a necessary but not sufficient condition.
  2. Misapplying Quadratic Reciprocity. Reciprocity only applies to odd primes. A common mistake is to try to use it on a symbol like , where the numerator is composite. You must first factor the numerator using the multiplicative property: , making reciprocity unnecessary.
  3. Forgetting to "reduce the numerator modulo the denominator." Before applying any law, you should always reduce modulo when computing . For example, should first be simplified to because , which is trivially . Skipping this step leads to needlessly complex calculations.
  4. Overlooking the conditions for the supplementary laws. The second supplementary law for depends on modulo , not modulo . Confusing these conditions will yield an incorrect sign half the time.

Summary

  • A quadratic residue modulo an odd prime is an integer such that has a solution. The Legendre symbol elegantly encodes this information as , , or .
  • Euler's criterion, , provides a direct but computationally intense definition.
  • The Law of Quadratic Reciprocity, combined with the two supplementary laws for and , provides an efficient algorithm for computing Legendre symbols without solving congruences or performing large exponentiations.
  • The Jacobi symbol generalizes the notation and rules to odd composite denominators, enabling the same efficient algorithm. Crucially, a Jacobi symbol value of does not guarantee a quadratic residue exists modulo a composite number.
  • This theory directly answers questions about which primes can be represented by simple quadratic forms like , linking the solvability of a quadratic congruence to the structure of the prime numbers themselves.

Write better notes with AI

Mindli helps you capture, organize, and master any subject with AI-powered summaries and flashcards.