21.01.06 · number-theory / elementary

Quadratic residues, the Legendre symbol, and Euler's criterion

shipped3 tiersLean: none

Anchor (Master): Gauss 1801 *Disquisitiones Arithmeticae* arts. 95-152 (originator: quadratic residues, Legendre symbol, Euler's criterion, Gauss's lemma, the first complete proof of quadratic reciprocity, the theorema aureum); Euler 1744 *Comm. Acad. Petrop.* 14, 151-181 (special-case conjectures of reciprocity for divisors of $p a^2 + q b^2$); Legendre 1798 *Essai sur la théorie des nombres* (statement of the law and partial proof); Jacobi 1837 *J. reine angew. Math.* 30, 166-182 (Jacobi symbol $(a/n)$ for $n$ odd composite, reciprocity for the Jacobi symbol); Eisenstein 1844 *J. reine angew. Math.* 27, 289-310 (cubic and biquadratic reciprocity, lattice-point counting proof of quadratic reciprocity); Hilbert 1897 *Jahresber. DMV* 4, 175-546 (Hilbert reciprocity, general reciprocity in the *Zahlbericht*); Takagi 1920 *J. Coll. Sci. Tokyo* 41, 1-133 (class field theory for relatively abelian number fields); Artin 1927 *Hamb. Abh.* 5, 353-363 (Artin reciprocity, modern formulation of general reciprocity for abelian extensions); Tonelli 1891 *Göttinger Nachr.* 1891, 344-346 (square roots modulo $p$); Shanks 1972 *Proc. Second Manitoba Conf. Numer. Math.* 51-70 (Tonelli-Shanks algorithm); Goldwasser-Micali 1982 *STOC* 365-377 (probabilistic encryption from quadratic-residuosity); Hardy-Wright 2008 6e §§V-VII

Intuition Beginner

A quadratic residue modulo a prime is a nonzero residue that is the square of some other residue modulo . For the prime , square each of the nonzero residues: , , , , , . The squares produce . So the quadratic residues modulo are , and the non-residues — the residues that are not squares — are .

The pattern repeats. For every odd prime , exactly half of the nonzero residues are squares, and exactly half are not. Each nonzero square comes from exactly two square roots: , and these two roots are distinct because is odd. So the squaring map sends inputs onto outputs in a two-to-one fashion.

The Legendre symbol is a compact notation that records the quadratic-residue status of modulo . The value is if is a nonzero quadratic residue modulo , if is a non-residue, and if divides . For example , , .

Euler's criterion is the computational test: for every . The right-hand side is a power computation that takes about modular multiplications by repeated squaring, dramatically faster than searching for a square root. For and , compute , confirming that and is a non-residue.

Why does this concept exist? Because the question "is a square modulo ?" is the most basic non-linear question in modular arithmetic, and its answer drives algorithms ranging from the Tonelli-Shanks square-root extraction (used to compress public keys in elliptic-curve cryptography) to the quadratic sieve (the second-fastest integer-factorisation algorithm known). The Legendre symbol packages the answer into a multiplicative structure that supports rapid computation.

Worked example: is a quadratic residue modulo ? By Euler's criterion, evaluate . Compute , so . So , and is not a square modulo . Cross-check by enumeration: the squares modulo are — namely — and is not on the list.

Visual Beginner

The picture shows the squaring map on the six nonzero residues modulo . Each arrow points from a residue to its square. The map collapses pairs onto a single output, producing three quadratic residues from six inputs.

The picture captures the central numerical fact: each nonzero quadratic residue modulo an odd prime has exactly two square roots , and the squaring map is two-to-one on . So among the nonzero residues, exactly are quadratic residues, and exactly are non-residues.

Worked example Beginner

Determine whether is a quadratic residue modulo the prime , using Euler's criterion.

Step 1. The exponent in Euler's criterion is . We need to compute .

Step 2. Repeated squaring. Compute , so .

Step 3. Square again: .

Step 4. Square once more: .

Step 5. By Euler's criterion, , so .

Step 6. Conclusion: is a non-residue modulo , so the congruence has no solutions in integers .

What this tells us: Euler's criterion converts the existence question "is a square modulo ?" into a single modular exponentiation, computable in steps by repeated squaring. No search through residue classes is needed. The value is the result of three squarings — about steps — and the answer tells us has no square root modulo . Cross-check by listing the squares modulo : — that is . The residue is not on the list, confirming the criterion.

Check your understanding Beginner

Formal definition Intermediate+

We restate the quadratic-residue concepts in the precise language inherited from the cyclic structure of established in 21.01.05.

Definition (quadratic residue modulo ). Let be an odd prime and an integer with . The integer is a quadratic residue modulo if there exists with ; otherwise is a quadratic non-residue modulo . The set of quadratic residues modulo is denoted ; the set of non-residues is denoted .

Definition (Legendre symbol). Let be an odd prime. The Legendre symbol is defined for every integer by $$ \left(\frac{a}{p}\right) ;=; \begin{cases} +1, & a \in \mathrm{QR}_p \ -1, & a \in \mathrm{NR}_p \ 0, & p \mid a. \end{cases} $$ The Legendre symbol is a function depending only on the residue class of modulo .

The Legendre symbol factors through : whenever . Restricting to , the Legendre symbol is the unique non-identity group homomorphism (the quadratic character modulo ), with kernel .

Definition (squaring homomorphism). The map , , is a group homomorphism with kernel and image . The exact sequence $$ 1 \to {\pm 1} \to (\mathbb{Z}/p\mathbb{Z})^\times \xrightarrow{\sigma_p} \mathrm{QR}_p \to 1 $$ identifies as the image, of index in , with .

Counterexamples to common slips

  • "The product of two quadratic non-residues is a non-residue." False: the product of two non-residues is a residue. The multiplicative property gives . For instance are both non-residues modulo , but is the identity residue .

  • " is multiplicative as a function of too." False: the Legendre symbol is multiplicative in for fixed , but in general. The latter would be the Jacobi symbol for odd composite — see Theorem 4 below — but it carries different information than the Legendre symbols for the individual prime factors.

  • "Euler's criterion holds for ." False: the formula requires odd. For the exponent is not an integer, and the Legendre symbol is not defined in the usual sense. Quadratic-residue theory modulo is degenerate: every odd integer is a square modulo (with ).

Key theorem with proof Intermediate+

The signature theorem of this unit is Euler's criterion, the bridge from the multiplicative structure of to the existence of square roots.

Theorem (Euler's criterion; Euler 1748, Gauss 1801 art. 106). Let be an odd prime and an integer with . Then $$ \left(\frac{a}{p}\right) ;\equiv; a^{(p - 1)/2} \pmod p. $$ Equivalently, if is a quadratic residue modulo , and if is a non-residue modulo .

Proof. Let , cyclic of order by the Key Theorem of 21.01.05. Fix a primitive root modulo , so . Every nonzero residue is for a unique .

Step 1 — Squaring image. The image of the squaring map , , equals . Since is even, the powers are exactly the elements with even modulo . So is a quadratic residue iff is even.

Step 2 — Compute . For , $$ a^{(p - 1)/2} ;=; g^{k (p - 1)/2} ;=; \big(g^{(p - 1)/2}\big)^k. $$ The element has order exactly in (since has order and is the maximal proper divisor), so in (the unique element of order ). Hence $$ a^{(p - 1)/2} ;=; (-1)^k \pmod p. $$

Step 3 — Combine. is a quadratic residue iff is even (Step 1), iff (basic parity), iff (Step 2). By complementarity, is a non-residue iff . Combining with the Legendre-symbol definition gives .

Bridge. Euler's criterion builds toward 21.01.07 quadratic reciprocity, where the law is the signature theorem; the criterion supplies the order- character interpretation that makes the law a statement about characters on and matching up. The central insight is exactly that the unique order- element — itself for any primitive root — controls every quadratic phenomenon modulo : the Legendre symbol equals or according to whether lies in the index- subgroup or the other coset. The bridge is to the broader framework of 21.03.02 Dirichlet -functions, where the Legendre symbol extends to the quadratic Dirichlet character and the -function encodes the distribution of quadratic residues across arithmetic progressions. Putting these together, Euler's criterion is the elementary appearance of the principle that organises all of 21.03.03 -function reciprocity: characters of finite abelian groups detect coset memberships, and modular-power computations evaluate those characters in polynomial time.

Exercises Intermediate+

Lean formalization Intermediate+

Mathlib supplies the abstract scaffolding for the Legendre symbol and Euler's criterion. The relevant declarations live in Mathlib.NumberTheory.LegendreSymbol.

-- Operative imports: Mathlib.NumberTheory.LegendreSymbol.Basic,
-- Mathlib.NumberTheory.LegendreSymbol.QuadraticReciprocity,
-- Mathlib.NumberTheory.LegendreSymbol.GaussSum

#check @ZMod.legendreSym
-- The Legendre symbol (a/p) : ZMod p → ℤ, valued in {-1, 0, 1}.

#check @ZMod.euler_criterion
-- (a/p) ≡ a^((p - 1) / 2) (mod p) for p odd prime and a coprime to p.

#check @ZMod.legendreSym_one
-- (1/p) = 1.

#check @ZMod.legendreSym_neg_one
-- (-1/p) = (-1)^((p - 1) / 2), the first supplementary law.

#check @ZMod.legendreSym_two
-- (2/p) = (-1)^((p^2 - 1) / 8), the second supplementary law.

#check @ZMod.quadraticReciprocity
-- (p/q) * (q/p) = (-1)^((p - 1)/2 * (q - 1)/2), the main reciprocity law.

#check @ZMod.exists_sq_eq_iff_legendreSym_eq_one
-- a is a quadratic residue modulo p iff (a/p) = 1 (for a coprime to p).

The Mathlib formalisation is comprehensive at the level of the law itself, the two supplementary laws, and the Euler-criterion identity. What Mathlib has not yet packaged: the explicit Tonelli-Shanks algorithm for computing when , with a constructive correctness proof in time where ; the binary Jacobi-symbol algorithm via repeated reciprocity steps (the standard algorithm in cryptographic libraries); the Goldwasser-Micali probabilistic-encryption security reduction from the quadratic-residuosity assumption modulo ; the explicit link from the Legendre symbol to the Hilbert symbol at the prime and the product formula . These are the formalisation gaps documented in the unit metadata Mathlib gap analysis.

Advanced results Master

Theorem 1 (Euler's criterion). For an odd prime and coprime to , [Gauss 1801]. Proved above as the Key Theorem via the cyclic structure of and the order- element . Euler himself stated this in 1748 Comm. Acad. Petrop. without the explicit Legendre symbol (which appeared in Legendre 1798); Gauss 1801 article 106 gave the modern formulation.

Theorem 2 (Gauss's lemma). For an odd prime and coprime to , where is the number of for which the least positive residue of modulo exceeds [Gauss 1801]. Proved above as Exercise 6 via the permutation-of-absolute-residues argument. Gauss's lemma is the operational tool for proving the two supplementary laws (Exercises 5, 7) and is one of the eight independent proof routes Gauss took for the full reciprocity law.

Theorem 3 (Quadratic reciprocity; Gauss 1801, theorema aureum). For distinct odd primes , $$ \left(\frac{p}{q}\right) \left(\frac{q}{p}\right) ;=; (-1)^{\frac{p - 1}{2} \cdot \frac{q - 1}{2}}. $$ Equivalently, unless , in which case [Gauss 1801]. Gauss called the law the theorema aureum — "the golden theorem" — and announced his first complete proof in his mathematical diary entry of April 1796, formalised in Disquisitiones Arithmeticae articles 125-152. Gauss produced eight independent proofs over his lifetime: the original induction proof (1796/1801), the Gauss-sum proof (Gauss 1811 Werke II), the lemma-and-counting proof (Gauss 1818), the cyclotomic proof (Gauss 1818), and four more proofs in Werke II. Today more than independent proofs are known (Lemmermeyer 2000 Reciprocity Laws catalogues most of them). The full proof is deferred to 21.01.07.

Theorem 4 (Jacobi symbol and its reciprocity; Jacobi 1837). For odd positive composite with prime factorisation and coprime to , the Jacobi symbol is $$ \left(\frac{a}{n}\right) ;=; \prod_{i = 1}^k \left(\frac{a}{p_i}\right)^{e_i}. $$ The Jacobi symbol satisfies (multiplicativity) and the reciprocity law for odd coprime positive, plus the supplementary laws and [Jacobi 1837]. The Jacobi symbol crucially does not detect quadratic residuosity in general — does not imply is a square modulo when is composite — but it does enable the binary Jacobi-symbol algorithm: compute in time by alternating reduction and reciprocity flip without factoring . This is the algorithm used in OpenSSL, GMP, and every standard cryptographic library for primality-testing pre-checks and computing Legendre symbols quickly.

Theorem 5 (Tonelli-Shanks square-root algorithm; Tonelli 1891, Shanks 1972). Let be an odd prime, a quadratic residue modulo . The square root can be computed in expected time where [Shanks 1972]. Write with odd. Find a non-residue modulo (random search succeeds in tries on average since half the residues are non-residues); set , which has order exactly in . Initialise , , ; while find the smallest with , then update , , , , . Terminates when with a square root of . The Tonelli 1891 Göttinger Nachr. algorithm preceded Shanks's refinement; the combined Tonelli-Shanks method is the standard square-root algorithm in cryptography (elliptic-curve point decompression in EdDSA, ECDSA, BLS12-381 pairing-friendly curves).

Theorem 6 (Goldwasser-Micali probabilistic encryption; Goldwasser-Micali 1982). Let be an RSA modulus (product of two large primes) and a pseudosquare modulo — i.e., via the Jacobi symbol but is not a quadratic residue modulo . The encryption scheme: to encrypt a bit , pick random and output ciphertext . Decryption: decrypts to iff is a quadratic residue modulo , testable via the Legendre symbol using the secret factorisation. Semantic security follows from the quadratic-residuosity assumption: distinguishing pseudosquares from squares modulo is computationally hard given only [Goldwasser-Micali 1982]. This is the first semantically secure public-key encryption scheme — the founding example of the modern provable-security paradigm. The ciphertext is one bit per group element ( bits per bit of plaintext), making the scheme inefficient in practice but a clean theoretical model. Refinements include Paillier 1999 EUROCRYPT (additively homomorphic, more efficient per bit) and the bilinear-pairing reformulation in identity-based encryption (Boneh-Franklin 2001).

Theorem 7 (Hilbert reciprocity; Hilbert 1897). For , the Hilbert symbol at each place of (finite primes and the archimedean place) detects whether the quadratic form has a non-zero solution in . The product formula $$ \prod_v (a, b)_v ;=; 1 $$ holds, with all but finitely many factors equal to [Hilbert 1897]. The Hilbert symbol at a finite prime relates to the Legendre symbol: for units, where is the reduction modulo . The product formula encodes quadratic reciprocity in the cleanest form: matching the signs at the two finite primes and the archimedean place gives . Hilbert's Zahlbericht (1897) developed this in the Theorie der algebraischen Zahlkörper §§64-90, and Hilbert's 9th problem (1900 ICM Paris) asked for the most general reciprocity law in any algebraic number field. The general reciprocity programme is the framework that organises every subsequent reciprocity law.

Theorem 8 (Artin reciprocity; Takagi 1920, Artin 1927). For a finite abelian extension of number fields, the Artin map induces an isomorphism $$ \mathrm{Art}{L/K} : I_K(\mathfrak{m}) / N{L/K}(I_L(\mathfrak{m})) P_{L/K}(\mathfrak{m}) ;\xrightarrow{\sim}; \mathrm{Gal}(L/K), $$ where is the group of fractional ideals of coprime to a conductor , is the norm map, is the principal ideal subgroup, and the map sends a prime to its Frobenius element [Artin 1927]. Specialised to the quadratic extension where is the signed prime, the Artin map sends to the Frobenius , whose image in is . The Artin map's compatibility with the conductor recovers quadratic reciprocity. Takagi 1920 J. Coll. Sci. Tokyo 41 had proved existence of the abelian-extension classification; Artin 1927 Hamb. Abh. 5 added the explicit Frobenius-isomorphism formulation, the "Artin reciprocity law." The non-abelian generalisation is the Langlands programme: Artin reciprocity = abelian Langlands; Langlands functoriality conjectures (Langlands 1967 letter to Weil; Langlands 1970 Yale Lectures) extend to all reductive groups via -functions of automorphic representations.

Synthesis. The quadratic-residue framework is the foundational reason that the cyclic structure of admits a clean index- subgroup of squares, with the Legendre symbol identifying the coset and Euler's criterion computing it via the single modular power . The central insight is exactly that the unique order- element — itself for any primitive root — controls every quadratic phenomenon: the squares are the kernel of the unique order- character , and the Legendre symbol is the explicit evaluation of . Putting these together with multiplicativity, the two supplementary laws (, ), Gauss's lemma, and the law of quadratic reciprocity, the entire quadratic-character theory of is captured by the Legendre symbol with -time computation via the Jacobi-symbol binary algorithm. The bridge is to the broader framework of 21.03.02 Dirichlet -functions and 21.03.03 Hecke and Artin -functions, where the Legendre symbol extends to general characters of generalised ideal class groups, and to the Langlands programme as the non-abelian extension.

The historical arc from Euler 1744 to Artin 1927 is the canonical example of how an elementary observation grows into a structural principle. Euler 1744 Comm. Acad. Petrop. 14 conjectured special cases of quadratic reciprocity disguised as theorems about divisors of ; Legendre 1798 Essai sur la théorie des nombres gave the statement in the modern symbol form (with an incomplete proof depending on the unproven Dirichlet theorem on primes in arithmetic progressions); Gauss 1801 articles 125-152 gave the first complete proof. Jacobi 1837 J. reine angew. Math. 30 extended to the Jacobi symbol with the algorithmic consequence of efficient computation; Eisenstein 1844 J. reine angew. Math. 27 added cubic and biquadratic reciprocity in the cyclotomic rings and ; Hilbert 1897 Jahresber. DMV 4 generalised to the Hilbert symbol and the product formula, with the 9th Hilbert problem (1900) asking for the most general reciprocity. Takagi 1920 and Artin 1927 completed the classical reciprocity programme via class field theory for abelian extensions of number fields. The non-abelian generalisation is the Langlands programme (Langlands 1967, 1970), and Wiles-Taylor 1995 Ann. Math. 142 proved the modularity theorem for elliptic curves over as the first non-abelian Langlands reciprocity case.

The applied half builds the modern cryptographic infrastructure. Tonelli 1891 Göttinger Nachr. and Shanks 1972 Proc. Manitoba gave the deterministic square-root algorithm used in elliptic-curve point decompression (every ECDSA signature, every Edwards-curve EdDSA verification, every BLS aggregate signature). Goldwasser-Micali 1982 STOC founded the modern provable-security paradigm with the first semantically-secure encryption scheme from the quadratic-residuosity assumption. The pattern recurs in the quadratic sieve of Pomerance 1985 Lecture Notes Math. 1122, the second-fastest integer-factorisation algorithm — find smooth values of over a factor base, build a linear system in , and solve to produce a non-degenerate congruence of squares from which is a factor of . The same quadratic-residue framework that Gauss laid out in Disquisitiones Arithmeticae arts. 95-152 underlies every modern public-key cryptographic protocol where modular square roots appear, from RSA (Rabin variant) to elliptic-curve point compression to bilinear-pairing-based signatures.

Full proof set Master

Proposition 1 (Euler's criterion). For an odd prime and coprime to , .

Proof. Reprised from the Key Theorem with sharpened notation. Let , cyclic of order (Theorem 21.01.05.1). Fix a primitive root , so every is for a unique .

The squaring image is . Since is even, this is exactly the index- subgroup of even powers, of order . So is a quadratic residue iff is even.

The element has order in : , and the only smaller power is , distinct from since the order of is . In a field, the only solutions of are , so , and it is not (else the order of would divide ). Hence in .

Compute: . By the squaring-image analysis, is a quadratic residue iff is even iff iff . The complementary case gives the non-residue branch. So .

Proposition 2 (multiplicativity). For an odd prime and coprime to , .

Proof. By Euler's criterion, $$ \left(\frac{ab}{p}\right) ;\equiv; (ab)^{(p - 1)/2} ;=; a^{(p - 1)/2} \cdot b^{(p - 1)/2} ;\equiv; \left(\frac{a}{p}\right) \cdot \left(\frac{b}{p}\right) \pmod p. $$ Both sides are in . For , two elements of congruent modulo are equal as integers (since the difference lies in , and divides this only when the difference is ).

Proposition 3 (first supplementary law). For an odd prime, if and if .

Proof. By Euler's criterion, as integers in . Case : even, . Case : odd, .

Proposition 4 (Gauss's lemma). For an odd prime and coprime to , where is the number of for which .

Proof. For each , write $$ j a ;\equiv; \epsilon_j r_j \pmod p, \quad r_j \in {1, 2, \ldots, (p - 1)/2}, ;; \epsilon_j \in {\pm 1}, $$ choosing exactly when .

The values are pairwise distinct in , hence a permutation. If with , then , cancelling gives . With , the case forces (contradiction), and the case forces which requires — impossible since .

Multiply the relations: , so $$ a^{(p - 1)/2} \cdot ((p - 1)/2)! ;\equiv; (-1)^\mu \cdot ((p - 1)/2)! \pmod p. $$ Cancelling (coprime to ): . By Euler's criterion (Proposition 1), the left side is in . So .

Proposition 5 (second supplementary law). For an odd prime, .

Proof. Apply Gauss's lemma (Proposition 4) with . The set has elements, and .

Four cases by :

  • : even, so .
  • : odd, so .
  • : odd, so .
  • : even, so .

So iff , iff . Direct check: iff . So .

Proposition 6 (correctness of the Tonelli-Shanks algorithm). Given an odd prime, a quadratic residue modulo , the Tonelli-Shanks algorithm outputs with .

Proof. Write with odd. Let be a quadratic non-residue modulo (so has order exactly in ).

Initialise , , , . Loop invariants:

  1. (so holds when ).
  2. is a -th root of unity in .
  3. is a primitive -th root of unity (an order- element).

Initial verification: ✓. ✓. has order ✓.

At each iteration: find the smallest with ; if then and the algorithm terminates with as the answer. Otherwise (since is a -th but not a -th root). Set , so and (since has order and is the unique order- element). Update , , , .

Invariant preservation: ✓. ✓. has order ✓.

The loop terminates because strictly decreases at each iteration. When , is a -th root of unity, so , and the algorithm exits with . Number of iterations is at most ; total cost is multiplications modulo .

Connections Master

  • Primitive roots and structure of 21.01.05. Just shipped. The cyclicity of proved in 21.01.05 supplies the operative tool for Euler's criterion: the order- element is exactly for any primitive root , and the index- subgroup of squares is the kernel of the unique order- character. The discrete-logarithm framework of 21.01.05 gives the explicit identification iff is even. The Tonelli-Shanks algorithm (Theorem 5) uses the discrete-logarithm structure indirectly via the -Sylow subgroup of generated by .

  • Fermat-Euler-Wilson theorems 21.01.04. Shipped. Euler's criterion is a refinement of Fermat: Fermat says for coprime to , and Euler's criterion sharpens this by computing — the unique square root of in accessible to — to detect quadratic-residue status. The first supplementary law iff characterises the primes expressible as sums of two squares (Fermat 1640, Euler 1755), one of the canonical applications of 21.01.04.

  • Congruences and CRT 21.01.03. Shipped. The Jacobi symbol is defined by CRT-decomposing and taking the product of Legendre symbols. The Goldwasser-Micali encryption scheme (Theorem 6) uses CRT decomposition to detect quadratic residuosity modulo via separate Legendre-symbol tests modulo and modulo — the secret-key advantage that gives semantic security.

  • Quadratic reciprocity and Gauss sums 21.01.07. Pending. The main theorem of which the present unit is the setting: for distinct odd primes , . The full proof — Gauss's first proof by induction (1796/1801), Eisenstein's lattice-point proof (1844), Dirichlet's Gauss-sum proof (1854) — is deferred to 21.01.07. The present unit supplies all the operative tools: the Legendre symbol, Euler's criterion, multiplicativity, the two supplementary laws, and Gauss's lemma. 21.01.07 adds the reciprocity-law proof and the Jacobi-symbol generalisation.

  • Riemann zeta function 21.03.01. Shipped. The quadratic-character framework lifts to Dirichlet -functions associated to characters of for various . The Legendre symbol extends to the quadratic Dirichlet character (taking values ), and the Dirichlet -function has functional equation and Euler product that mirror — Dirichlet 1837 Werke I proved for non-principal to deduce the infinitude of primes in arithmetic progressions. The quadratic Dirichlet -functions are the simplest non-principal twists of and the prototype for the entire Dirichlet -function theory.

  • -adic numbers and Hensel's lemma 21.02.07. Pending. The square-root question modulo extends to modulo and ultimately to the -adic integers . Hensel's lemma: if is a quadratic residue modulo (with odd) and , then for any solution modulo , there exists a unique lift with and in . The case requires the more delicate Hensel condition for to be a square in . The Hilbert symbol (Theorem 7) is the -adic completion of the Legendre symbol, with the product formula encoding quadratic reciprocity adelically.

Historical & philosophical context Master

Euler 1744 Comm. Acad. Petrop. 14, 151-181 [Euler 1744] is the originator of quadratic reciprocity in the disguised form of theorems about divisors of binary quadratic forms . Euler observed empirically that the set of prime divisors of depends only on the residue class of the prime modulo — a statement equivalent to quadratic reciprocity once translated through the Legendre-symbol formalism (not available to Euler). Continued in Euler 1783 Opera Postuma I, 64-84, which contains the cleanest formulation Euler attained.

Legendre 1798 Essai sur la théorie des nombres [Legendre 1798] introduced the symbol that bears his name and gave the modern formulation of the reciprocity law: for distinct odd primes , . Legendre's proof is incomplete: it depends on the unproven assumption that for every residue class coprime to , there exist infinitely many primes — a statement equivalent to Dirichlet's theorem on primes in arithmetic progressions, not proved until Dirichlet 1837 Werke I via the analytic non-vanishing for non-principal Dirichlet characters. So Legendre had the right statement but no complete proof.

Gauss 1801 Disquisitiones Arithmeticae arts. 125-152 [Gauss 1801] gave the first complete proof. Gauss had discovered the law independently in April 1796 (mathematical diary entry of 19 April 1796: "Per inductionem inveni 24 Mart. 1796: ..." — "By induction I discovered on March 24, 1796: ..."), as a 19-year-old, and called it the theorema aureum — "the golden theorem" — or the fundamental theorem of arithmetic in his later writings. Gauss produced eight independent proofs over his lifetime, six appearing in Werke II 1863: the induction proof (1801), the Gauss-sum proof (1811 unpublished, 1818 published), the lemma-and-permutation proof (1818), the cyclotomic proof (1818), and three more in the Nachlass. Gauss's intent in proving the law eight times was to find the conceptually right proof — and the multiplicity of methods is itself a signal that the law sits at a deep junction of arithmetic, geometry, and analysis. Today more than independent proofs are known, catalogued in Lemmermeyer 2000 Reciprocity Laws.

Jacobi 1837 J. reine angew. Math. 30, 166-182 [Jacobi 1837] extended the Legendre symbol to the Jacobi symbol for odd positive composite, by multiplicativity in the prime-power decomposition. The Jacobi symbol satisfies the same reciprocity law for odd coprime positive, and the same two supplementary laws. The algorithmic consequence is the binary Jacobi-symbol algorithm: compute in time by alternating reduction and reciprocity flip, without factoring — the algorithm used in every modern cryptographic library.

Eisenstein 1844 J. reine angew. Math. 27, 289-310 [Eisenstein 1844] proved cubic reciprocity in the cyclotomic ring of Eisenstein integers; the companion paper in Crelle 28 gave biquadratic reciprocity in . Eisenstein's 1847 Crelle 35 paper gave the lattice-point-counting proof of quadratic reciprocity that became the standard textbook proof: count integer points strictly under the line of slope inside the rectangle , and observe that the total point count modulo equals by counting two ways.

Hilbert 1897 Jahresber. DMV 4, 175-546 [Hilbert 1897] — the Zahlbericht, Hilbert's encyclopaedic report on algebraic number theory — developed the Hilbert symbol at each place of a number field and the product formula . The Hilbert symbol at a finite prime detects whether has non-zero solutions over the local field; quadratic reciprocity becomes the Euler-factor matching of the product formula. Hilbert's 9th problem (1900 ICM Paris) asks for the most general reciprocity law in any algebraic number field — the question answered by Takagi 1920 and Artin 1927.

Takagi 1920 J. Coll. Sci. Tokyo 41, 1-133 [Takagi 1920] proved class field theory for relatively abelian extensions of number fields: every finite abelian extension corresponds bijectively to a generalised ideal class group of , with the conductor-discriminant formula expressing the abelian -function as a product of Hecke -functions. Specialised to and quadratic , Takagi's theorem reduces to quadratic reciprocity. Artin 1927 Hamb. Abh. 5, 353-363 [Artin 1927] added the explicit Frobenius-isomorphism formulation — the Artin reciprocity law — identifying the Artin map as the canonical isomorphism. The non-abelian generalisation is the Langlands programme: Artin reciprocity equals abelian Langlands; the Langlands functoriality conjectures (Langlands 1967 letter to Weil, Langlands 1970 Yale Lectures) extend to all reductive groups via -functions of automorphic representations.

The applied legacy: Tonelli 1891 Göttinger Nachr. [Tonelli 1891] and Shanks 1972 Proc. Manitoba [Shanks 1972] gave the deterministic modular-square-root algorithm used in elliptic-curve point decompression — every ECDSA verification, every Ed25519 signature check. Goldwasser-Micali 1982 STOC [Goldwasser-Micali 1982] founded the modern provable-security paradigm with the first semantically-secure encryption scheme from the quadratic-residuosity assumption. The quadratic sieve of Pomerance 1985 Lecture Notes Math. 1122 — the second-fastest classical integer-factorisation algorithm, with sub-exponential complexity — finds smooth values of to build a non-degenerate congruence of squares from which factors . The same quadratic-residue framework Gauss developed in 1801 underlies every modern cryptographic protocol involving modular square roots.

Bibliography Master

@article{Euler1744,
  author  = {Euler, Leonhard},
  title   = {Theoremata circa divisores numerorum in hac forma $p a^2 + q b^2$ contentorum},
  journal = {Commentarii Academiae Scientiarum Imperialis Petropolitanae},
  volume  = {14},
  pages   = {151--181},
  year    = {1744},
  note    = {The originator paper conjecturing special cases of quadratic reciprocity in the disguised form of theorems about prime divisors of binary quadratic forms $p a^2 + q b^2$. Continued in Euler 1783 *Opera Postuma* I, 64-84.}
}

@book{Legendre1798,
  author    = {Legendre, Adrien-Marie},
  title     = {Essai sur la th{\'e}orie des nombres},
  publisher = {Duprat},
  address   = {Paris},
  year      = {1798},
  note      = {First statement of the law of quadratic reciprocity in the modern symbol form. The Legendre symbol $(a/p)$ is introduced as a convenient notation. The proof depends on the unproven Dirichlet theorem on primes in arithmetic progressions and is therefore incomplete.}
}

@book{Gauss1801,
  author    = {Gauss, Carl Friedrich},
  title     = {Disquisitiones Arithmeticae},
  publisher = {Gerhard Fleischer},
  address   = {Leipzig},
  year      = {1801},
  note      = {Articles 95-152 are the canonical originator development of quadratic residues, the Legendre symbol, Euler's criterion, Gauss's lemma, the two supplementary laws, and the first complete proof of quadratic reciprocity (the theorema aureum). Gauss produced eight independent proofs over his lifetime; six appear in *Werke* II 1863. English translation by Arthur A. Clarke, Yale University Press, 1965/1986.}
}

@article{Jacobi1837,
  author  = {Jacobi, Carl Gustav Jacob},
  title   = {{\"U}ber die Kreistheilung und ihre Anwendung auf die Zahlentheorie},
  journal = {Journal f{\"u}r die reine und angewandte Mathematik},
  volume  = {30},
  pages   = {166--182},
  year    = {1837},
  note    = {Introduces the Jacobi symbol $(a/n)$ for $n$ odd positive composite, with the same reciprocity law and two supplementary laws as the Legendre symbol. Enables the binary $O((\log n)^2)$-time algorithm for computing the Legendre/Jacobi symbol without factoring.}
}

@article{Eisenstein1844,
  author  = {Eisenstein, Gotthold},
  title   = {Beweis des Reciprocit{\"a}tssatzes f{\"u}r die cubischen Reste in der Theorie der aus den dritten Wurzeln der Einheit zusammengesetzten complexen Zahlen},
  journal = {Journal f{\"u}r die reine und angewandte Mathematik},
  volume  = {27},
  pages   = {289--310},
  year    = {1844},
  note    = {Cubic reciprocity in the cyclotomic ring $\mathbb{Z}[\zeta_3]$ of Eisenstein integers. Companion paper *Crelle* 28 (1844) gives biquadratic reciprocity in $\mathbb{Z}[i]$. Eisenstein 1847 *Crelle* 35 added the lattice-point-counting proof of quadratic reciprocity that became the standard textbook proof.}
}

@article{Hilbert1897,
  author  = {Hilbert, David},
  title   = {Die Theorie der algebraischen Zahlk{\"o}rper},
  journal = {Jahresbericht der Deutschen Mathematiker-Vereinigung},
  volume  = {4},
  pages   = {175--546},
  year    = {1897},
  note    = {The *Zahlbericht* — Hilbert's encyclopaedic report on algebraic number theory. Develops the Hilbert symbol $(a, b)_v$ at each place of a number field and the product formula $\prod_v (a, b)_v = 1$. Hilbert's 9th problem (1900 ICM Paris) asks for the most general reciprocity law in any algebraic number field.}
}

@article{Takagi1920,
  author  = {Takagi, Teiji},
  title   = {{\"U}ber eine Theorie des relativ-Abelschen Zahlk{\"o}rpers},
  journal = {Journal of the College of Science, Tokyo},
  volume  = {41},
  pages   = {1--133},
  year    = {1920},
  note    = {Class field theory for relatively abelian extensions of number fields. Every finite abelian extension corresponds bijectively to a generalised ideal class group via the Artin map.}
}

@article{Artin1927,
  author  = {Artin, Emil},
  title   = {Beweis des allgemeinen Reziprozit{\"a}tsgesetzes},
  journal = {Abhandlungen aus dem Mathematischen Seminar der Universit{\"a}t Hamburg},
  volume  = {5},
  pages   = {353--363},
  year    = {1927},
  note    = {Artin reciprocity. The Artin map induces an isomorphism from generalised ideal classes to the Galois group, sending a prime $\mathfrak{p}$ to its Frobenius element. The modern formulation of all reciprocity laws for abelian extensions; the non-abelian generalisation is the Langlands programme.}
}

@article{Tonelli1891,
  author  = {Tonelli, Alberto},
  title   = {Bemerkung {\"u}ber die Aufl{\"o}sung quadratischer Congruenzen},
  journal = {Nachrichten von der K{\"o}niglichen Gesellschaft der Wissenschaften zu G{\"o}ttingen},
  year    = {1891},
  pages   = {344--346},
  note    = {The first deterministic algorithm for computing square roots modulo a prime $p$.}
}

@inproceedings{Shanks1972,
  author    = {Shanks, Daniel},
  title     = {Five number-theoretic algorithms},
  booktitle = {Proceedings of the Second Manitoba Conference on Numerical Mathematics},
  address   = {Winnipeg},
  pages     = {51--70},
  year      = {1972},
  note      = {Tonelli-Shanks algorithm for modular square roots. The standard algorithm in cryptographic libraries for elliptic-curve point decompression.}
}

@inproceedings{GoldwasserMicali1982,
  author    = {Goldwasser, Shafi and Micali, Silvio},
  title     = {Probabilistic encryption and how to play mental poker keeping secret all partial information},
  booktitle = {Proceedings of the 14th Annual ACM Symposium on Theory of Computing (STOC)},
  pages     = {365--377},
  year      = {1982},
  note      = {Refined in *Journal of Computer and System Sciences* 28 (1984), 270-299. The first semantically secure public-key encryption scheme, founded on the quadratic-residuosity assumption. The founding example of the modern provable-security paradigm.}
}

@book{HardyWright2008,
  author    = {Hardy, G. H. and Wright, E. M.},
  title     = {An Introduction to the Theory of Numbers},
  edition   = {6},
  publisher = {Oxford University Press},
  year      = {2008},
  note      = {Revised by D. R. Heath-Brown and J. H. Silverman. Chapters V-VII develop quadratic residues, the Legendre symbol, Gauss's lemma, the supplementary laws, the law of quadratic reciprocity, and the Jacobi symbol.}
}

@book{IrelandRosen1990,
  author    = {Ireland, Kenneth and Rosen, Michael},
  title     = {A Classical Introduction to Modern Number Theory},
  edition   = {2},
  series    = {Graduate Texts in Mathematics},
  volume    = {84},
  publisher = {Springer},
  year      = {1990},
  note      = {Chapter 5 develops the Legendre symbol, Euler's criterion, Gauss's lemma, and the supplementary laws. Chapter 6 proves quadratic reciprocity via Gauss sums.}
}

@book{Apostol1976,
  author    = {Apostol, Tom M.},
  title     = {Introduction to Analytic Number Theory},
  series    = {Undergraduate Texts in Mathematics},
  publisher = {Springer},
  year      = {1976},
  note      = {Chapter 9 develops quadratic residues, the Legendre symbol, and the Jacobi symbol with the analytic perspective. Includes the Gauss-sum derivation of quadratic reciprocity.}
}

@book{Burton2010,
  author    = {Burton, David M.},
  title     = {Elementary Number Theory},
  edition   = {7},
  publisher = {McGraw-Hill},
  year      = {2010},
  note      = {Chapter 9 develops quadratic residues, the Legendre symbol, and Euler's criterion at the undergraduate Beginner-tier level, with explicit residue tables for small primes.}
}

@book{Cox2013,
  author    = {Cox, David A.},
  title     = {Primes of the form $x^2 + n y^2$: Fermat, class field theory, and complex multiplication},
  edition   = {2},
  publisher = {Wiley},
  year      = {2013},
  note      = {The canonical modern textbook on quadratic reciprocity and its consequences for Fermat-style 'primes of the form' problems, with the entire originator chain Fermat-Euler-Lagrange-Legendre-Gauss developed from primary sources.}
}

@book{Lemmermeyer2000,
  author    = {Lemmermeyer, Franz},
  title     = {Reciprocity Laws: From Euler to Eisenstein},
  series    = {Springer Monographs in Mathematics},
  publisher = {Springer},
  year      = {2000},
  note      = {Catalogue of more than $300$ independent proofs of quadratic reciprocity, with the historical development from Euler 1744 to Eisenstein 1844 traced in primary-source detail.}
}