How statement and proof provenance work
The first chip identifies the source of the statement or construction; the second identifies the source of its local proof or verification.
- Literature-sourced: the exact statement appears in a cited source; only wording and notation differ.
- AI-adapted: a semantically identical restatement of literature-sourced material, modulo indexing, notation, and boundary cases adopted by the library.
- AI-generated: a genuinely novel statement formulated by AI, with no source for the claim itself.
These labels describe origin, not correctness: citations and verification chips remain separate evidence.
Quadratic Residues and the Legendre Symbol
1 · Prerequisites
- Binary Operations, Monoids, Groups and Subgroups
- Congruences, the Integers Modulo n and the Chinese Remainder Theorem
- Construction of the Natural Numbers
- Construction of the Real Numbers via Cauchy Sequences
- Construction of the Real Numbers via Dedekind Cuts
- Cosets, Index and Lagrange's Theorem
- Countability and Uncountability
- Cyclic Groups and Direct Products
- Divisibility, Greatest Common Divisors and Bézout's Identity
- Finite Counting, Factorials and Binomial Coefficients
- Foundations of the Real Numbers for Analysis
- Group Homomorphisms and the Isomorphism Theorems
- Normal Subgroups and Quotient Groups
- Polynomial Rings, the Division Algorithm and Roots
- Primes, Euclid's Lemma and the Fundamental Theorem of Arithmetic
- Primitive Roots and Unit Groups Modulo N
- Relations, Functions, and Quotients
- Rings, Subrings, Integral Domains and Fields
- Roots, Rational Powers, and Classical Inequalities
- The Fundamental Theorem of Finite Abelian Groups
- The ZFC Axioms and the Basic Set Constructions
2 · Summary
For a prime modulus, the nonzero residue classes form a cyclic unit group of order p-1. Congruence and quotient-ring algebra translate integer equations into equations in that group, while the power-congruence criterion counts their roots and the polynomial root bound controls equations over the field of prime residue classes. These facts make squaring a finite group operation whose image can be studied without choosing representatives.
A unit is a quadratic residue when its class is a square, and for an odd prime the square classes form an index-two subgroup. The Legendre symbol extends this dichotomy by a separate zero value, becomes the unique nontrivial sign character on the unit group, and satisfies Euler's criterion and multiplicativity. Exact solution counts follow for quadratic and general quadratic congruences. A signed permutation of the prime half-system yields Gauss's lemma, from which the formula for (2/p) follows; Euler's criterion gives the corresponding formula for (-1/p).
3 · Logical flowchart
4 · Definitions, theorems and proofs
Quadratic residues and nonresidues modulo an integer
Definition
Let and let satisfy . The integer is a quadratic residue modulo if there is an integer with
and otherwise it is a quadratic nonresidue modulo .
By For , is a unit if and only if , the coprimality hypothesis says that is a unit. Thus the terms quadratic residue and quadratic nonresidue here apply only to unit classes; a nonunit target belongs to neither class.
Quadratic residuosity is representative-independent and the residues are the image of squaring
Statement
Let . Whether an integer with is a quadratic residue modulo depends only on its class . Moreover, the quadratic-residue classes are exactly
the image of squaring on the unit group.
Facts & Assumptions
Given: An integer and integers representing unit classes modulo .
For , the integer is a quadratic residue modulo exactly when some integer satisfies (Quadratic residues and nonresidues modulo an integer).
Two classes in are equal exactly when their representatives are congruent modulo (The congruence class and the quotient set ).
The class is a unit exactly when , and this condition depends only on the class (For , is a unit if and only if ).
A class is a unit exactly when some satisfies (The unit group and Euler's totient for ).
Multiplication makes a commutative monoid with identity (For every natural , is an abelian group, multiplication is a commutative monoid operation, and both distributive laws hold).
Proof
If and , then , so ; reversing the roles of and gives the converse.
By [L3], congruent representatives are simultaneously units. If and is a unit with inverse , then , so is a unit. Thus every quadratic-residue class lies in the image of squaring on .
Conversely, let be a unit with . By [L4] there is with , so by [L5] and is itself a unit; [L3] then gives , which is the hypothesis [L1] requires. Since , [L2] gives , so [L1] makes a quadratic residue. Hence the quadratic-residue classes are exactly the displayed image.
A coprime exponent gives a unique nonzero -th root modulo a prime
Statement
Let be prime, let , and let satisfy and . Then has a unique nonzero solution class. If and
then that class is ; the formula is independent of the chosen nonnegative representative of the inverse class.
Facts & Assumptions
Given: A prime , an integer , and with and .
If admits a primitive root, , , and , then is solvable if and only if (Euler's criterion: if has a primitive root, , and , then is solvable if and only if ).
Every prime admits a primitive root modulo that prime (Every prime modulus admits a primitive root).
For every prime , (, and for every prime ).
Under the hypotheses of [L1], a soluble congruence has exactly solution classes (If has a primitive root, , , and is solvable, then it has exactly solution classes modulo ).
For and , the congruence is soluble exactly when divides , and then it has exactly solution classes (For , is solvable exactly when , and then has exactly solution classes modulo ).
If is prime and , then (Fermat's little theorem: for prime , implies , and always ).
If , then and are coprime (For a prime and any integer , is when and otherwise; so makes and coprime).
Proof
By [L7], . Facts [L2] and [L3] specialise [L1] to modulus , while reduces its test to , which holds by [L6]. Thus the root congruence is soluble.
Applying [L4] with and gives exactly solution class, so the root is unique. It is nonzero because a zero root would give , contrary to .
By [L5], the congruence has one solution class and has nonnegative representatives. If , every such is odd, so it represents the sole unit class and hence the unique root from step 2.1. Suppose is odd. For a nonnegative representative , the congruence forces , so with ; then [L6] gives . Two nonnegative representatives differ by a multiple of ; ordering them and applying [L6] to the nonnegative difference shows that their powers of represent the same class.
The nonzero squares modulo an odd prime form an index-two subgroup
Statement
Let be an odd prime. The nonzero quadratic-residue classes form the subgroup
For every primitive root modulo , this subgroup is and has index two in .
Facts & Assumptions
Given: An odd prime and the unit group .
The group is cyclic of order (For every prime , the multiplicative group is cyclic).
For a group element , the subgroup is exactly the set of all integer powers of (, and every cyclic group is abelian).
A group is cyclic exactly when it is generated by one element (The subgroup generated by a subset, the cyclic subgroup , and cyclic groups).
The quadratic-residue classes modulo are exactly the image of squaring on (Quadratic residuosity is representative-independent and the residues are the image of squaring).
Integer powers in a group satisfy and (Exponent laws in a group: and for all , and when and commute).
For every integer , there are unique integers with and (Division with remainder in : for and there are unique with and ).
The index of a finite-index subgroup is the cardinality of its coset space (The coset set and the index of a subgroup).
Proof
By [L1] and [L3], choose with ; then every is for some by [L2].
If , then by [L5], so every square lies in ; conversely , so every element of is a square. By [L4], the quadratic-residue classes are therefore exactly .
Write each exponent as with by [L6]. Then lies in when and in when . These cosets are distinct: if , then the order of would divide the odd integer , impossible because is even. Hence there are exactly two cosets, so the subgroup has index two by [L7].
An odd prime has nonzero quadratic residues and as many nonresidues
Statement
For an odd prime , exactly nonzero classes are quadratic residues modulo , and exactly are quadratic nonresidues. Each nonzero quadratic residue has exactly two square roots modulo , while each nonresidue has none.
Facts & Assumptions
Given: An odd prime .
The nonzero quadratic-residue classes form the subgroup , and this subgroup has index two in (The nonzero squares modulo an odd prime form an index-two subgroup).
If is finite and , then (Lagrange's theorem: for every subgroup of a finite group ).
Under its primitive-root, coprimality, positivity, and solubility hypotheses, has exactly solution classes (If has a primitive root, , , and is solvable, then it has exactly solution classes modulo ).
Every prime admits a primitive root modulo that prime (Every prime modulus admits a primitive root).
For every prime , (, and for every prime ).
The group is cyclic of order (For every prime , the multiplicative group is cyclic).
If , then and are coprime (For a prime and any integer , is when and otherwise; so makes and coprime).
Proof
Let be the subgroup of nonzero square classes, which by [L1] is exactly the set of quadratic-residue classes. By [L1], for , and [L6] gives ; hence [L2] gives . Its complement in has the same cardinality, and since [L1] identifies with the quadratic-residue classes, that complement consists exactly of the nonresidues.
If represents a class in , then , so [L7] gives . Facts [L4] and [L5] discharge the prime specialisation of [L3], which gives roots because is odd.
A nonresidue has no square root by the description of in [L1], while step 1.2 gives exactly two roots for each member of . Together with step 1.1, this proves all assertions.
The Legendre symbol, including its zero value
Definition
Let be an odd prime and let . The Legendre symbol is
The zero branch is separate from the quadratic residue and nonresidue branches of Quadratic residues and nonresidues modulo an integer, which apply only to unit numerators.
The Legendre symbol is well defined on residue classes
Statement
For every odd prime , the Legendre symbol belongs to , depends only on the numerator modulo , and satisfies
Facts & Assumptions
Given: An odd prime and integers with .
The Legendre symbol is on a numerator divisible by , on a quadratic residue modulo , and on a quadratic nonresidue (The Legendre symbol, including its zero value).
The congruence means that divides (Congruence modulo an integer: when , including the moduli and ).
Quadratic residuosity of a unit integer depends only on its residue class (Quadratic residuosity is representative-independent and the residues are the image of squaring).
Proof
By [L2], , so exactly when . Thus congruent numerators enter the zero branch of [L1] simultaneously.
If , then also by step 1.1, and [L3] says that and are simultaneously quadratic residues or simultaneously nonresidues. Hence [L1] assigns them the same sign.
The three disjoint branches in [L1] give only the values ; step 1.1 proves that divisibility gives value zero, and the two unit branches give nonzero values. Therefore the symbol is representative-independent and is zero exactly when divides its numerator.
On the units, the Legendre symbol is the unique nontrivial homomorphism to
Statement
Let be an odd prime. Restricted to , the Legendre symbol is the unique nontrivial homomorphism
It is surjective, and its kernel is the subgroup of nonzero square classes.
Facts & Assumptions
Given: An odd prime , the unit group , and the multiplicative group .
On unit classes, the Legendre symbol takes values in and is representative-independent (The Legendre symbol is well defined on residue classes).
The nonzero square classes form an index-two subgroup of (The nonzero squares modulo an odd prime form an index-two subgroup).
For a group homomorphism , and is surjective exactly when its image is (The kernel and image of a group homomorphism).
A group homomorphism satisfies for every in its domain (Monoid homomorphism and group homomorphism).
The group is cyclic of order (For every prime , the multiplicative group is cyclic).
Every group homomorphism preserves integer powers: (A group homomorphism automatically satisfies and , and for every ; for monoid homomorphisms preservation of the identity must be assumed).
For an odd prime , when and is a quadratic residue modulo , and when and is a quadratic nonresidue modulo (The Legendre symbol, including its zero value).
Proof
By [L2] the quadratic-residue classes are exactly the members of , so [L7] assigns the value to every class in and, every unit class outside being a nonresidue, the value to every class in the other coset; [L1] makes this independent of representatives. Thus its value-one set is exactly , and both values occur.
Choose , which is possible because [L2] gives index two. The two left cosets are and , so every element outside has the form with . The cyclic group from [L5] is abelian, and is a square, hence belongs to by [L2]. It follows that products from , , and lie respectively in , , and . The corresponding signs multiply as , , and . Hence , so [L4] makes a homomorphism; step 1.1 and [L3] give its kernel and surjectivity.
Choose a generator of by [L5]. Were , every power of would lie in the subgroup and so , contradicting the index two of [L2]; hence and step 1.1 gives , so by [L6]. If a homomorphism sent to , then [L6] would make for every integer , so would be trivial. Every nontrivial therefore sends to , and [L6] gives for every . Since generates , .
Euler's criterion:
Statement
For every integer and odd prime ,
Facts & Assumptions
Given: An integer and an odd prime .
The Legendre symbol is when , when is a quadratic residue modulo , and when is a quadratic nonresidue (The Legendre symbol, including its zero value).
If admits a primitive root, , , and , then is soluble exactly when (Euler's criterion: if has a primitive root, , and , then is solvable if and only if ).
Every prime admits a primitive root modulo that prime (Every prime modulus admits a primitive root).
For every prime , (, and for every prime ).
For every prime , the quotient is a field (For every prime , the two operations on make it a field).
Every field is an integral domain (Every field is a commutative ring with ; it is an integral domain, and it is a commutative division ring).
A nonzero polynomial of degree over an integral domain has at most distinct roots (A nonzero polynomial of degree over an integral domain has at most distinct roots).
If , then and are coprime (For a prime and any integer , is when and otherwise; so makes and coprime).
Proof
If , then [L1] gives , while and hence . The criterion holds in this case.
Suppose . By [L9], ; [L3] and [L4] specialise [L2] with and . Thus is a square modulo exactly when .
Put . By [L5], . Facts [L6] and [L7] make an integral domain, and [L8] says that the degree-two polynomial has at most two roots there. The two distinct roots and already exist because is odd, so is one of them.
In the unit case, step 1.2 gives exactly for a quadratic residue; otherwise step 1.3 forces . These are precisely the two values prescribed by [L1]. Combining this with step 1.1 proves the congruence for every integer .
The Legendre symbol is multiplicative for all integer numerators
Statement
For every odd prime and all integers ,
Consequently, if , then .
Facts & Assumptions
Given: An odd prime and integers .
The Legendre symbol is when its numerator is divisible by , on a quadratic residue, and on a quadratic nonresidue (The Legendre symbol, including its zero value).
A class is a unit exactly when (For , is a unit if and only if ).
Restricted to , the Legendre symbol is a homomorphism to whose kernel is the nonzero square subgroup (On the units, the Legendre symbol is the unique nontrivial homomorphism to ).
Proof
If divides or , then it divides . By [L1], the left side is zero and one factor on the right is zero, so the identity holds.
If divides neither factor, then [L2] makes and units. The homomorphism identity in [L3] gives the displayed multiplicativity.
If , then lies in the kernel described by [L3], so . Applying the proved multiplicative identity to and gives .
has exactly solution classes
Statement
For every integer and odd prime , the congruence
has exactly solution classes modulo .
Facts & Assumptions
Given: An integer and an odd prime .
The Legendre symbol is when , when is a quadratic residue modulo , and when is a quadratic nonresidue (The Legendre symbol, including its zero value).
The quotient is a field (For every prime , the two operations on make it a field).
Every field is an integral domain (Every field is a commutative ring with ; it is an integral domain, and it is a commutative division ring).
Under its primitive-root, coprimality, positivity, and solubility hypotheses, has exactly solution classes (If has a primitive root, , , and is solvable, then it has exactly solution classes modulo ).
Every prime admits a primitive root modulo that prime (Every prime modulus admits a primitive root).
For every prime , (, and for every prime ).
If , then and are coprime (For a prime and any integer , is when and otherwise; so makes and coprime).
Proof
If , the equation in the field [L2] is . Since [L3] gives no zero divisors, is the unique solution. This count is by [L1].
Suppose . By [L7], . If , the congruence is soluble by [L1], and [L4], [L5], and [L6] give exactly roots. If , [L1] says that no root exists.
The three possible symbol values therefore give respectively one, two, and zero solution classes, which in every case equals .
The discriminant counts roots of for odd prime
Statement
Let be an odd prime, and let with . Put . Then
has exactly
solution classes modulo .
Facts & Assumptions
Given: An odd prime and integers with ; write .
Addition and multiplication make a commutative ring (For every natural , is an abelian group, multiplication is a commutative monoid operation, and both distributive laws hold).
A class is a unit exactly when (For , is a unit if and only if ).
If , , and , then is soluble exactly when , and when soluble it has exactly solution classes (For , is solvable exactly when , and then has exactly solution classes modulo ).
For every integer and odd prime , the congruence has exactly solution classes ( has exactly solution classes).
Proof
In the commutative ring [L1], the identity holds.
Since is odd and , the prime divides neither nor , so [L2] makes both classes units. Fact [L3] then says that is a bijection of the residue classes, and cancellation of the unit in step 1.1 shows that the original congruence is equivalent to .
The bijection in step 2.1 preserves the number of solutions, and [L4] gives exactly solutions to the square congruence.
Multiplication by with permutes an odd prime's signed half-system up to sign
Statement
Let be an odd prime, let , and put . For each , there are unique and such that
The absolute representatives are a permutation of .
Facts & Assumptions
Given: An odd prime , an integer with , and .
Every class modulo a positive integer has exactly one representative with (For , every class in has one representative with , so ; while is in bijection with ).
The quotient is a field (For every prime , the two operations on make it a field).
Every injection from a finite set to itself is a bijection (A subset of a finite set is finite, with , and equality holds if and only if ).
Proof
For , [L1] gives the standard representative of . It is nonzero because [L2] permits cancellation of the nonzero classes and . If , set ; if , set . Since , this gives the stated unique signed representative with .
If , then or . Cancelling by [L2] gives or . In the first case forces ; in the second, , so , a contradiction. Thus is injective.
The map is an injection from the finite set to itself, so [L3] makes it a bijection. Therefore is a permutation of the half-system.
Gauss's quadratic-residue lemma
Statement
Let be an odd prime and let . Let be the number of least positive residues of
modulo that exceed . Then
Facts & Assumptions
Given: An odd prime , an integer with , and .
There are unique signs and a permutation of with for (Multiplication by with permutes an odd prime's signed half-system up to sign).
A finite indexed family in a monoid has a recursively defined product (The product of a finite list in a monoid, by recursion, with the empty product () equal to the identity).
A class is a unit exactly when (For , is a unit if and only if ).
Euler's criterion gives (Euler's criterion: ).
Multiplication on is associative and commutative with identity (For every natural , is an abelian group, multiplication is a commutative monoid operation, and both distributive laws hold).
If is prime and , then (For a prime and any integer , is when and otherwise; so makes and coprime).
For an odd prime , when and is a quadratic residue modulo , and when and is a quadratic nonresidue modulo (The Legendre symbol, including its zero value).
Proof
Use [L1] to write for . A sign is negative exactly when the least positive residue of exceeds , so exactly of the signs are negative.
Multiply the congruences using [L2] and [L5]. Since the permute , this gives .
Every factor satisfies , so and [L6] gives ; then [L3] makes each a unit, so their product is a unit and can be cancelled from step 2.1. Hence .
By [L4], . Since , [L7] gives , and is likewise or ; two such integers differing by a multiple of the odd prime differ by at most , so the congruence is equality in .
First supplement:
Statement
For every odd prime ,
Equivalently, if and only if , while if and only if .
Facts & Assumptions
Given: An odd prime .
Euler's criterion gives for every integer (Euler's criterion: ).
Division by a positive integer has a unique quotient and remainder in the standard range (Division with remainder in : for and there are unique with and ).
The congruence means that divides (Congruence modulo an integer: when , including the moduli and ).
For an odd prime , when and is a quadratic residue modulo , and when and is a quadratic nonresidue modulo (The Legendre symbol, including its zero value).
Proof
Substitute in [L1]. An odd prime never divides , so [L4] gives , and is likewise or ; two such integers differ by at most , so their congruence modulo the odd prime is equality: .
By [L2], write with . Since is odd, is or . If , then is even; if , then is odd.
By [L3], the two remainder cases in step 1.2 are exactly and . Combining their parities with step 1.1 proves both biconditionals.
Second supplement:
Statement
For every odd prime ,
Equivalently, if and only if or , while if and only if or .
Facts & Assumptions
Given: An odd prime .
If counts the least positive residues of modulo , for , that exceed , then (Gauss's quadratic-residue lemma).
Division by a positive integer has a unique quotient and remainder in the standard range (Division with remainder in : for and there are unique with and ).
The congruence means that divides (Congruence modulo an integer: when , including the moduli and ).
Proof
Put . For , the least positive residue of is itself because . It exceeds exactly when , so [L1] counts precisely the integers with .
By [L2], write with . Since is odd, . In these cases the crossing indices of step 1.1 are respectively ; ; ; and . Their counts are , , , and .
For , direct substitution gives , , , and , respectively. These have parity even, odd, odd, and even, exactly matching the four crossing counts in step 2.1.
Fact [L1] and step 3.1 give . The exhaustive remainder cases yield value exactly for residues modulo , and value exactly for residues .
5 · Examples, counterexamples and false statements
None yet.
Sources
Standard references
Recommended treatments; not extraction sources.
- H. Hackman, Elementary Number Theory, Chapter D, Section D.I
- W. Stein, Elementary Number Theory, Section 4.1
- A. Gorodnik, Number Theory, Lecture 9, Section 1
- N. Mascot, Legendre Symbols and Quadratic Reciprocity, Chapter 3
- W. Stein, Elementary Number Theory, Section 4.2
- A. Gorodnik, Number Theory, Lecture 9, Theorem 1.5
- A. Gorodnik, Number Theory, Lecture 9, Theorem 1.6
- W. Stein, Elementary Number Theory, Corollary 4.2.3
- H. Hackman, Elementary Number Theory, Chapter D, Section D.IV
- W. Stein, Elementary Number Theory, Section 4.3
- W. Stein, Elementary Number Theory, Lemma 4.3.1
- W. Stein, Elementary Number Theory, Theorem 4.1.7
- H. Hackman, Elementary Number Theory, Chapter D, Sections D.I and D.IV