Jacobi Symbol
Introduction
The Jacobi symbol is a generalization of the Legendre symbol that extends the theory of quadratic residues from prime moduli to arbitrary odd moduli. While the Legendre symbol
The Jacobi symbol was introduced by Carl Gustav Jacob Jacobi in
The power of the Jacobi symbol lies in its multiplicative properties. These allow us to reduce computations involving large arguments to simpler cases using only the extended Euclidean algorithm, avoiding the need for prime factorization entirely.
Formal Definition
The Legendre Symbol (Review)
Before defining the Jacobi symbol, we recall the Legendre symbol. For an odd prime
By Euler's criterion,
Definition of the Jacobi Symbol
Let
where each
The Jacobi symbol
Fundamental Properties
The Jacobi symbol satisfies several important properties that make it computationally useful. Let
Multiplicativity in the Numerator
This follows directly from the definition and the multiplicativity of the Legendre symbol.
Multiplicativity in the Denominator
This also follows from the definition: the prime factorization of
Periodicity
The Jacobi symbol is periodic in the numerator with period
More generally,
The Value at -1
For any odd positive integer
This generalizes the corresponding result for the Legendre symbol. The proof uses that
The Value at 2
For any odd positive integer
This is known as the second supplement to quadratic reciprocity. The exponent
The Law of Quadratic Reciprocity
The most important property of the Jacobi symbol is that it satisfies the law of quadratic reciprocity. For odd positive integers
Equivalently,
This remarkable law, first proven by Gauss, allows us to flip the numerator and denominator (with a possible sign change). Combined with the other properties, this enables efficient computation.
The Jacobi Symbol Algorithm
The properties above lead to an efficient algorithm for computing the Jacobi symbol that runs in time
Reduce
a modulon to get0≤a<n .If
a=0 return0 (or1 ifn=1 ).Extract powers of
2 : writea=2⋅(a^′) where(a^′) is odd.Compute
(2/n)e using the second supplement.Apply quadratic reciprocity to swap:
((a^′)/n)=±(n/(a^′)) .Repeat with the new arguments.
Relationship to Quadratic Residues
An important caveat: unlike the Legendre symbol, the Jacobi symbol
For example,
However, we do have the following implications:
If
If
Applications
Primality Testing
The Jacobi symbol is central to the Solovay-Strassen primality test. For an odd integer
If
Computing Legendre Symbols
To compute the Legendre symbol
Cryptography
The Jacobi symbol appears in several cryptographic protocols. In the Goldwasser-Micali encryption scheme, the ciphertext consists of numbers whose Jacobi symbol is
Generalizations
The Jacobi symbol generalizes to the Kronecker symbol, which extends the definition to allow
Higher power residue symbols generalize both the Legendre and Jacobi symbols. For an
Summary
The Jacobi symbol
The Jacobi symbol is multiplicative in both arguments, periodic in the numerator, and satisfies the law of quadratic reciprocity:
These properties enable efficient computation without factoring. The supplements give
Unlike the Legendre symbol,
The Jacobi symbol is used in primality testing (Solovay-Strassen), computing Legendre symbols efficiently, and cryptographic protocols. It generalizes to the Kronecker symbol and higher power residue symbols, connecting elementary number theory to class field theory.