The Jacobi Symbol #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
We define the Jacobi symbol and prove its main properties.
Main definitions #
We define the Jacobi symbol, jacobi_sym a b
, for integers a
and natural numbers b
as the product over the prime factors p
of b
of the Legendre symbols legendre_sym p a
.
This agrees with the mathematical definition when b
is odd.
The prime factors are obtained via nat.factors
. Since nat.factors 0 = []
,
this implies in particular that jacobi_sym a 0 = 1
for all a
.
Main statements #
We prove the main properties of the Jacobi symbol, including the following.
-
Multiplicativity in both arguments (
jacobi_sym.mul_left
,jacobi_sym.mul_right
) -
The value of the symbol is
1
or-1
when the arguments are coprime (jacobi_sym.eq_one_or_neg_one
) -
The symbol vanishes if and only if
b ≠ 0
and the arguments are not coprime (jacobi_sym.eq_zero_iff
) -
If the symbol has the value
-1
, thena : zmod b
is not a square (zmod.nonsquare_of_jacobi_sym_eq_neg_one
); the converse holds whenb = p
is a prime (zmod.nonsquare_iff_jacobi_sym_eq_neg_one
); in particular, in this casea
is a square modp
when the symbol has the value1
(zmod.is_square_of_jacobi_sym_eq_one
). -
Quadratic reciprocity (
jacobi_sym.quadratic_reciprocity
,jacobi_sym.quadratic_reciprocity_one_mod_four
,jacobi_sym.quadratic_reciprocity_three_mod_four
) -
The supplementary laws for
a = -1
,a = 2
,a = -2
(jacobi_sym.at_neg_one
,jacobi_sym.at_two
,jacobi_sym.at_neg_two
) -
The symbol depends on
a
only via its residue class modb
(jacobi_sym.mod_left
) and onb
only via its residue class mod4*a
(jacobi_sym.mod_right
)
Notations #
We define the notation J(a | b)
for jacobi_sym a b
, localized to number_theory_symbols
.
Tags #
Jacobi symbol, quadratic reciprocity
Definition of the Jacobi symbol #
We define the Jacobi symbol $\Bigl(\frac{a}{b}\Bigr)$ for integers a
and natural numbers b
as the product of the Legendre symbols $\Bigl(\frac{a}{p}\Bigr)$, where p
runs through the
prime divisors (with multiplicity) of b
, as provided by b.factors
. This agrees with the
Jacobi symbol when b
is odd and gives less meaningful values when it is not (e.g., the symbol
is 1
when b = 0
). This is called jacobi_sym a b
.
We define localized notation (locale number_theory_symbols
) J(a | b)
for the Jacobi
symbol jacobi_sym a b
.
The Jacobi symbol of a
and b
Equations
- jacobi_sym a b = (list.pmap (λ (p : ℕ) (pp : nat.prime p), legendre_sym p a) b.factors _).prod
Properties of the Jacobi symbol #
The symbol J(a | 0)
has the value 1
.
The symbol J(a | 1)
has the value 1
.
The Legendre symbol legendre_sym p a
with an integer a
and a prime number p
is the same as the Jacobi symbol J(a | p)
.
The Jacobi symbol is multiplicative in its second argument.
The Jacobi symbol is multiplicative in its second argument.
The Jacobi symbol takes only the values 0
, 1
and -1
.
The symbol J(1 | b)
has the value 1
.
The Jacobi symbol is multiplicative in its first argument.
The symbol J(a | b)
is nonzero when a
and b
are coprime.
The symbol J(0 | b)
vanishes when b > 1
.
The symbol J(a | b)
takes the value 1
or -1
if a
and b
are coprime.
We have that J(a^e | b) = J(a | b)^e
.
We have that J(a | b^e) = J(a | b)^e
.
The square of J(a | b)
is 1
when a
and b
are coprime.
The symbol J(a^2 | b)
is 1
when a
and b
are coprime.
The symbol J(a | b)
depends only on a
mod b
.
The symbol J(a | b)
depends only on a
mod b
.
We can pull out a product over a list in the first argument of the Jacobi symbol.
If J(a | n) = -1
, then n
has a prime divisor p
such that J(a | p) = -1
.
If J(a | b)
is -1
, then a
is not a square modulo b
.
If p
is prime and J(a | p) = 1
, then a
is q square mod p
.
Values at -1
, 2
and -2
#
If χ
is a multiplicative function such that J(a | p) = χ p
for all odd primes p
,
then J(a | b)
equals χ b
for all odd natural numbers b
.
If b
is odd, then J(-1 | b)
is given by χ₄ b
.
If b
is odd, then J(-a | b) = χ₄ b * J(a | b)
.
If b
is odd, then J(2 | b)
is given by χ₈ b
.
If b
is odd, then J(-2 | b)
is given by χ₈' b
.
Quadratic Reciprocity #
The Law of Quadratic Reciprocity for the Jacobi symbol, version with qr_sign
The Law of Quadratic Reciprocity for the Jacobi symbol
The Law of Quadratic Reciprocity for the Jacobi symbol: if a
and b
are natural numbers
with a % 4 = 1
and b
odd, then J(a | b) = J(b | a)
.
The Law of Quadratic Reciprocity for the Jacobi symbol: if a
and b
are natural numbers
with a
odd and b % 4 = 1
, then J(a | b) = J(b | a)
.
The Law of Quadratic Reciprocityfor the Jacobi symbol: if a
and b
are natural numbers
both congruent to 3
mod 4
, then J(a | b) = -J(b | a)
.
The Jacobi symbol J(a | b)
depends only on b
mod 4*a
(version for a : ℕ
).
The Jacobi symbol J(a | b)
depends only on b
mod 4*a
.