Jacobi symbol
n \ m | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | ||||||||||||||||
3 | 0 | 1 | -1 | ||||||||||||||
5 | 0 | 1 | -1 | -1 | 1 | ||||||||||||
7 | 0 | 1 | 1 | -1 | 1 | -1 | -1 | ||||||||||
9 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | ||||||||
11 | 0 | 1 | -1 | 1 | 1 | 1 | -1 | -1 | -1 | 1 | -1 | ||||||
13 | 0 | 1 | -1 | 1 | 1 | -1 | -1 | -1 | -1 | 1 | 1 | -1 | 1 | ||||
15 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | -1 | 1 | 0 | 0 | -1 | 0 | -1 | -1 | ||
17 | 0 | 1 | 1 | -1 | 1 | -1 | -1 | -1 | 1 | 1 | -1 | -1 | -1 | 1 | -1 | 1 | 1 |
The Jacobi symbol is a generalization of the Legendre symbol. Introduced by Jacobi in 1837,[1] it is of theoretical interest in modular arithmetic and other branches of number theory, but its main use is in computational number theory, especially primality testing and integer factorization; these in turn are important in cryptography.
Contents
Definition
For any integer and any positive odd integer the Jacobi symbol is defined as the product of the Legendre symbols corresponding to the prime factors of :
represents the Legendre symbol, defined for all integers and all odd primes by
Following the normal convention for the empty product, The Legendre and Jacobi symbols are indistinguishable exactly when the lower argument is an odd prime, in which case they have the same value.
Table of values
The following is a table of values of Jacobi symbol with n ≤ 60, k ≤ 30, n odd.
n \ k | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
3 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 |
5 | 1 | −1 | −1 | 1 | 0 | 1 | −1 | −1 | 1 | 0 | 1 | −1 | −1 | 1 | 0 | 1 | −1 | −1 | 1 | 0 | 1 | −1 | −1 | 1 | 0 | 1 | −1 | −1 | 1 | 0 |
7 | 1 | 1 | −1 | 1 | −1 | −1 | 0 | 1 | 1 | −1 | 1 | −1 | −1 | 0 | 1 | 1 | −1 | 1 | −1 | −1 | 0 | 1 | 1 | −1 | 1 | −1 | −1 | 0 | 1 | 1 |
9 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 |
11 | 1 | −1 | 1 | 1 | 1 | −1 | −1 | −1 | 1 | −1 | 0 | 1 | −1 | 1 | 1 | 1 | −1 | −1 | −1 | 1 | −1 | 0 | 1 | −1 | 1 | 1 | 1 | −1 | −1 | −1 |
13 | 1 | −1 | 1 | 1 | −1 | −1 | −1 | −1 | 1 | 1 | −1 | 1 | 0 | 1 | −1 | 1 | 1 | −1 | −1 | −1 | −1 | 1 | 1 | −1 | 1 | 0 | 1 | −1 | 1 | 1 |
15 | 1 | 1 | 0 | 1 | 0 | 0 | −1 | 1 | 0 | 0 | −1 | 0 | −1 | −1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | −1 | 1 | 0 | 0 | −1 | 0 | −1 | −1 | 0 |
17 | 1 | 1 | −1 | 1 | −1 | −1 | −1 | 1 | 1 | −1 | −1 | −1 | 1 | −1 | 1 | 1 | 0 | 1 | 1 | −1 | 1 | −1 | −1 | −1 | 1 | 1 | −1 | −1 | −1 | 1 |
19 | 1 | −1 | −1 | 1 | 1 | 1 | 1 | −1 | 1 | −1 | 1 | −1 | −1 | −1 | −1 | 1 | 1 | −1 | 0 | 1 | −1 | −1 | 1 | 1 | 1 | 1 | −1 | 1 | −1 | 1 |
21 | 1 | −1 | 0 | 1 | 1 | 0 | 0 | −1 | 0 | −1 | −1 | 0 | −1 | 0 | 0 | 1 | 1 | 0 | −1 | 1 | 0 | 1 | −1 | 0 | 1 | 1 | 0 | 0 | −1 | 0 |
23 | 1 | 1 | 1 | 1 | −1 | 1 | −1 | 1 | 1 | −1 | −1 | 1 | 1 | −1 | −1 | 1 | −1 | 1 | −1 | −1 | −1 | −1 | 0 | 1 | 1 | 1 | 1 | −1 | 1 | −1 |
25 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 |
27 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 | 1 | −1 | 0 |
29 | 1 | −1 | −1 | 1 | 1 | 1 | 1 | −1 | 1 | −1 | −1 | −1 | 1 | −1 | −1 | 1 | −1 | −1 | −1 | 1 | −1 | 1 | 1 | 1 | 1 | −1 | −1 | 1 | 0 | 1 |
31 | 1 | 1 | −1 | 1 | 1 | −1 | 1 | 1 | 1 | 1 | −1 | −1 | −1 | 1 | −1 | 1 | −1 | 1 | 1 | 1 | −1 | −1 | −1 | −1 | 1 | −1 | −1 | 1 | −1 | −1 |
33 | 1 | 1 | 0 | 1 | −1 | 0 | −1 | 1 | 0 | −1 | 0 | 0 | −1 | −1 | 0 | 1 | 1 | 0 | −1 | −1 | 0 | 0 | −1 | 0 | 1 | −1 | 0 | −1 | 1 | 0 |
35 | 1 | −1 | 1 | 1 | 0 | −1 | 0 | −1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | −1 | −1 | 0 | 0 | −1 | −1 | −1 | 0 | −1 | 1 | 0 | 1 | 0 |
37 | 1 | −1 | 1 | 1 | −1 | −1 | 1 | −1 | 1 | 1 | 1 | 1 | −1 | −1 | −1 | 1 | −1 | −1 | −1 | −1 | 1 | −1 | −1 | −1 | 1 | 1 | 1 | 1 | −1 | 1 |
39 | 1 | 1 | 0 | 1 | 1 | 0 | −1 | 1 | 0 | 1 | 1 | 0 | 0 | −1 | 0 | 1 | −1 | 0 | −1 | 1 | 0 | 1 | −1 | 0 | 1 | 0 | 0 | −1 | −1 | 0 |
41 | 1 | 1 | −1 | 1 | 1 | −1 | −1 | 1 | 1 | 1 | −1 | −1 | −1 | −1 | −1 | 1 | −1 | 1 | −1 | 1 | 1 | −1 | 1 | −1 | 1 | −1 | −1 | −1 | −1 | −1 |
43 | 1 | −1 | −1 | 1 | −1 | 1 | −1 | −1 | 1 | 1 | 1 | −1 | 1 | 1 | 1 | 1 | 1 | −1 | −1 | −1 | 1 | −1 | 1 | 1 | 1 | −1 | −1 | −1 | −1 | −1 |
45 | 1 | −1 | 0 | 1 | 0 | 0 | −1 | −1 | 0 | 0 | 1 | 0 | −1 | 1 | 0 | 1 | −1 | 0 | 1 | 0 | 0 | −1 | −1 | 0 | 0 | 1 | 0 | −1 | 1 | 0 |
47 | 1 | 1 | 1 | 1 | −1 | 1 | 1 | 1 | 1 | −1 | −1 | 1 | −1 | 1 | −1 | 1 | 1 | 1 | −1 | −1 | 1 | −1 | −1 | 1 | 1 | −1 | 1 | 1 | −1 | −1 |
49 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 |
51 | 1 | −1 | 0 | 1 | 1 | 0 | −1 | −1 | 0 | −1 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | −1 | 1 | 0 | 1 | −1 | 0 | −1 | 1 | 0 |
53 | 1 | −1 | −1 | 1 | −1 | 1 | 1 | −1 | 1 | 1 | 1 | −1 | 1 | −1 | 1 | 1 | 1 | −1 | −1 | −1 | −1 | −1 | −1 | 1 | 1 | −1 | −1 | 1 | 1 | −1 |
55 | 1 | 1 | −1 | 1 | 0 | −1 | 1 | 1 | 1 | 0 | 0 | −1 | 1 | 1 | 0 | 1 | 1 | 1 | −1 | 0 | −1 | 0 | −1 | −1 | 0 | 1 | −1 | 1 | −1 | 0 |
57 | 1 | 1 | 0 | 1 | −1 | 0 | 1 | 1 | 0 | −1 | −1 | 0 | −1 | 1 | 0 | 1 | −1 | 0 | 0 | −1 | 0 | −1 | −1 | 0 | 1 | −1 | 0 | 1 | 1 | 0 |
59 | 1 | −1 | 1 | 1 | 1 | −1 | 1 | −1 | 1 | −1 | −1 | 1 | −1 | −1 | 1 | 1 | 1 | −1 | 1 | 1 | 1 | 1 | −1 | −1 | 1 | 1 | 1 | 1 | 1 | −1 |
Properties
The following facts, even the reciprocity laws, are straightforward deductions from the definition of the Jacobi symbol and the corresponding properties of the Legendre symbol.[2]
The Jacobi symbol is defined only when the upper argument ("numerator") is an integer and the lower argument ("denominator") is a positive odd integer.
- 1) If is (an odd) prime, then the Jacobi symbol is equal to (and written the same as) the corresponding Legendre symbol.
- 2) If then
- 3)
If either the top or bottom argument is fixed, the Jacobi symbol is a completely multiplicative function in the remaining argument:
- 4) , so
- 5) , so
The law of quadratic reciprocity: if and are odd positive coprime integers, then
- 6)
and its supplements
- 7)
- 8)
Like the Legendre symbol:
- If then is a quadratic nonresidue .
- If is a quadratic residue and , then .
But, unlike the Legendre symbol:
- If then may or may not be a quadratic residue .
This is because for to be a quadratic residue it has to be a quadratic residue modulo every prime that divides , but the Jacobi symbol will equal one if for example is a non-residue for exactly two of the primes which divide .
Although the Jacobi symbol can't be uniformly interpreted in terms of squares and non-squares, it can be uniformly interpreted as the sign of a permutation by Zolotarev's lemma.
The Jacobi symbol is a Dirichlet character to the modulus .
Calculating the Jacobi symbol
The above formulas lead to an efficient [3] algorithm for calculating the Jacobi symbol, analogous to the Euclidean algorithm for finding the GCD of two numbers. (This should not be surprising in light of rule 3).
- Reduce the "numerator" modulo the "denominator" using rule 2.
- Extract any factors of 2 from the "numerator" using rule 4 and evaluate them using rule 8.
- If the "numerator" is , rules 3 and 4 give a result of . If the "numerator" and "denominator" are not coprime, rule 3 gives a result of .
- Otherwise, the "numerator" and "denominator" are now odd positive coprime integers, so we can flip the symbol using rule 6, then return to step 1.
Example of calculations
The Legendre symbol is only defined for odd primes . It obeys the same rules as the Jacobi symbol (i.e., reciprocity and the supplementary formulas for and and multiplicativity of the "numerator".)
Problem: Given that is prime, calculate
Using the Legendre symbol
Using the Jacobi symbol
The difference between the two calculations is that when the Legendre symbol is used the "numerator" has to be factored into prime powers before the symbol is flipped. This makes the calculation using the Legendre symbol significantly slower than the one using the Jacobi symbol, as there is no known polynomial-time algorithm for factoring integers.[4] In fact, this is why Jacobi introduced the symbol.
Primality testing
There is another way the Jacobi and Legendre symbols differ. If the Euler criterion formula is used modulo a composite number, the result may or may not be the value of the Jacobi symbol, and in fact may not even be or . For example,
So if it is unknown whether a number is prime or composite, we can pick a random number , calculate the Jacobi symbol and compare it with Euler's formula; if they differ modulo , then is composite; if they have the same residue modulo for many different values of , then is "probably prime".
This is the basis for the probabilistic Solovay–Strassen primality test and refinements such as the Baillie-PSW primality test and the Miller–Rabin primality test.
See also
- The Kronecker symbol is a generalization of the Jacobi symbol to all integers.
- The power residue symbol is a generalization for third, fourth, and higher powers.
Notes
- ↑ C.G.J.Jacobi "Uber die Kreisteilung und ihre Anwendung auf die Zahlentheorie", Bericht Ak. Wiss. Berlin (1837) pp 127-136.
- ↑ Almost any textbook on elementary or algebraic number theory, e.g. Ireland & Rosen pp. 56–57 or Lemmermeyer p. 10
- ↑ Cohen, pp. 29–31
- ↑ The number field sieve, the fastest known algorithm, requires operations to factor . See Cohen, p. 495
References
- Lua error in package.lua at line 80: module 'strict' not found.
- Lua error in package.lua at line 80: module 'strict' not found.
- Lua error in package.lua at line 80: module 'strict' not found.
External links
- Calculate Jacobi symbol shows the steps of the calculation.