The Legendre Symbol

Fix an odd prime pp. Among the nonzero residues 1,2,…,p−11, 2, \dots, p-1 modulo pp, exactly half are perfect squares mod pp. The other half are not. But which half, and how does this splitting behave under multiplication? The Legendre symbol answers this question. It packages the entire question "is aa a square mod pp?" into a single arithmetic function (a/p)(a/p). This function takes only the values +1+1, −1-1, and 00. This small piece of notation turns a yes/no question about Quadratic Residues and Nonresidues into a genuine number-theoretic function. That function has striking multiplicative properties. It transforms a combinatorial counting problem into an algebraic one. The importance of this symbol is hard to overstate. It is the load-bearing notation for one of the deepest theorems in classical number theory, the Law of Quadratic Reciprocity. It is also the natural home for computational tools like Euler's Criterion and Gauss's Lemma. Once the Legendre symbol is defined and its multiplicativity established, some key questions become tractable. For instance: "for which primes pp is −1-1 a square mod pp?" Or: "for which pp is 22 a square mod pp?" These questions become systematic, and eventually completely solvable. The big picture is this: the set of nonzero residues mod pp forms a group under multiplication. The squares among them form an index-2 subgroup. The Legendre symbol is precisely the group homomorphism from this multiplicative group onto {±1}\{\pm 1\}. Its kernel is that subgroup. Recognizing this algebraic structure — a homomorphism onto {±1}\{\pm1\} — is important for two reasons. It makes the multiplicativity of the symbol immediate, once one knows the structure of (Z/pZ)×(\mathbb{Z}/p\mathbb{Z})^\times. And it is what makes the symbol the correct language for reciprocity. This article gives the precise definition of the Legendre symbol. It proves its fundamental multiplicative property from first principles. This proof uses only the cyclicity of (Z/pZ)×(\mathbb{Z}/p\mathbb{Z})^\times and basic group theory, not reciprocity or Euler's criterion. The article also works through concrete numerical examples. Finally, it highlights exactly which hypotheses are essential: the oddness of pp, and the primality of pp.

Key takeaways
  • The Legendre symbol (a/p)(a/p) encodes whether aa is a quadratic residue mod an odd prime pp, using values +1,−1,0+1, -1, 0.
  • It is defined purely combinatorially, using the notion of a quadratic residue, with no analytic input.
  • Its central property is multiplicativity: (ab/p)=(a/p)(b/p)(ab/p) = (a/p)(b/p), proved via the cyclic structure of (Z/pZ)×(\mathbb{Z}/p\mathbb{Z})^\times.
  • The symbol depends only on aa modulo pp, so it is really a function on residue classes.
  • It sets up the machinery — Euler's criterion, Gauss's lemma — used to prove quadratic reciprocity.
  • The definition genuinely requires pp odd and prime; both hypotheses fail dramatically without care.
  • Key idea: the Legendre symbol is the unique group homomorphism (Z/pZ)×→{±1}(\mathbb{Z}/p\mathbb{Z})^\times \to \{\pm1\} whose kernel is the subgroup of squares.

Where this lives today

The Legendre symbol is the backbone of the Law of Quadratic Reciprocity, which in turn is used to efficiently decide the solvability of x2≡a(modp)x^2 \equiv a \pmod p for large primes without brute-force search, a task central to computational number theory. In cryptography, fast evaluation of Legendre and Jacobi symbols underlies primality tests (such as the Solovay–Strassen test) and is used in constructing quadratic residue codes and certain pseudorandom bit generators, where the sequence of ±1\pm1 values behaves like a pseudorandom binary sequence with strong statistical independence properties. In the theory of quadratic forms, the Legendre symbol determines exactly which primes are represented by forms like x2+ny2x^2 + ny^2, connecting directly to Quadratic Residues and Nonresidues and class field theory. In algebraic number theory more broadly, the symbol is the prototype for Artin symbols and Frobenius elements, generalizing the same "is this a square (or higher power) modulo this prime" idea to arbitrary number fields and Galois extensions.

Ask the tutor: How does Euler's Criterion give a fast formula for computing the Legendre symbol without factoring or listing residues?

DefinitionThe Legendre Symbol

Let pp be an odd prime and let aa be an integer. The Legendre symbol (ap)\left(\dfrac{a}{p}\right) is defined by

(ap)={0if p∣a,1if p∤a and a is a quadratic residue mod p,−1if p∤a and a is a quadratic nonresidue mod p.\left(\frac{a}{p}\right) = \begin{cases} 0 & \text{if } p \mid a, \\ 1 & \text{if } p \nmid a \text{ and } a \text{ is a quadratic residue mod } p, \\ -1 & \text{if } p \nmid a \text{ and } a \text{ is a quadratic nonresidue mod } p. \end{cases}

Here aa is a quadratic residue mod pp if there exists an integer xx with x2≡a(modp)x^2 \equiv a \pmod p; otherwise, provided p∤ap \nmid a, it is a quadratic nonresidue. Since the condition "x2≡a(modp)x^2 \equiv a \pmod p" and the condition "p∣ap \mid a" both depend only on the residue class of aa modulo pp, the symbol (a/p)(a/p) depends only on a  pa \bmod p; hence it may be regarded as a function

(⋅p):Z/pZ⟶{−1,0,1}.\left(\frac{\cdot}{p}\right) : \mathbb{Z}/p\mathbb{Z} \longrightarrow \{-1, 0, 1\}.

Intuition

Think of the nonzero residues 1,2,…,p−11, 2, \dots, p-1 mod pp as the elements of a finite cyclic group G=(Z/pZ)×G = (\mathbb{Z}/p\mathbb{Z})^\times of order p−1p-1 under multiplication. Squaring is a group homomorphism G→GG \to G, x↦x2x \mapsto x^2, and its image is precisely the set of quadratic residues. Because pp is odd, p−1p - 1 is even, and it turns out (this is the content of the theorem below) that squaring is exactly 2-to-1: each square has precisely two square roots, xx and −x-x, and these are distinct because x≡−x(modp)x \equiv -x \pmod p would force 2x≡02x \equiv 0, impossible for x≢0x \not\equiv 0 when pp is odd. So the squares form a subgroup of index exactly 22. The Legendre symbol is nothing more than the indicator of membership in that subgroup, encoded as ±1\pm 1 instead of "yes/no". This is exactly the right encoding because the quotient group G/(G2)G / (G^2) has order 22, and the unique nontrivial homomorphism from a group of order 22 into {±1}⊂C×\{\pm 1\} \subset \mathbb{C}^\times is an isomorphism — so (a/p)(a/p) literally is (the pullback along G→G/G2G \to G/G^2 of) this isomorphism. Multiplicativity of the symbol is then just the statement that a composite of group homomorphisms is a homomorphism: nothing deeper is happening algebraically, though the number-theoretic consequences are enormous. Picture GG as p−1p-1 points arranged around a circle (a cyclic group), colored red if the point is a square and blue if not; the picture below does this for p=13p = 13, where GG has order 1212 and there are 66 residues of each color, alternating in a pattern governed by the discrete-log exponent parity, not by naive adjacency.

Figure
The 12 nonzero residues mod 13, colored by quadratic residue status
1 2 3 4 5 6 7 8 9 10 11 12 red = (a/13)=1 (residue), blue = (a/13)=-1 (nonresidue)

Intuition continued: multiplication as a symmetry

A second way to see the same idea: draw the graph of a↦(a/p)a \mapsto (a/p) for p=11p = 11 as a bar chart over a=1,…,10a = 1, \dots, 10. The pattern of ±1\pm 1's looks irregular, yet multiplying any two heights (a/11)⋅(b/11)(a/11)\cdot(b/11) always equals the height at ab  11ab \bmod 11 — the multiplicativity theorem below is exactly this hidden consistency, verified structurally rather than by checking all 100100 products by hand.

Figure
Legendre symbol values (a/11) for a = 1..10
1 2 3 4 5 6 7 8 9 10 +1 −1
TheoremMultiplicativity of the Legendre Symbol

Let pp be an odd prime, and let a,ba, b be integers. Then

(abp)=(ap)(bp).\left(\frac{ab}{p}\right) = \left(\frac{a}{p}\right)\left(\frac{b}{p}\right).

Equivalently, the map (⋅p):(Z/pZ)×→{−1,1}\left(\dfrac{\cdot}{p}\right) : (\mathbb{Z}/p\mathbb{Z})^\times \to \{-1, 1\} is a group homomorphism.

LemmaStructure of squares in (Z/pZ)×(\mathbb{Z}/p\mathbb{Z})^\times

Let pp be an odd prime and let G=(Z/pZ)×G = (\mathbb{Z}/p\mathbb{Z})^\times, a group of order p−1p - 1 under multiplication. Let Q={x2:x∈G}⊆GQ = \{x^2 : x \in G\} \subseteq G be the subgroup of quadratic residues. Then: 1. QQ is a subgroup of GG. 2. Every element of QQ has exactly two square roots in GG. 3. ∣Q∣=(p−1)/2|Q| = (p-1)/2, i.e. QQ has index 22 in GG.

Proof

Proof of the Lemma. (1) QQ is a subgroup. The squaring map σ:G→G\sigma : G \to G, σ(x)=x2\sigma(x) = x^2, is a group homomorphism because GG is abelian: (xy)2=x2y2(xy)^2 = x^2 y^2. The image of a group homomorphism is a subgroup of the codomain, so Q=σ(G)Q = \sigma(G) is a subgroup of GG. (2) Exactly two square roots. Suppose a∈Qa \in Q, say a=x2a = x^2 for some x∈Gx \in G. If y∈Gy \in G also satisfies y2=ay^2 = a, then x2≡y2(modp)x^2 \equiv y^2 \pmod p, so p∣(x−y)(x+y)p \mid (x-y)(x+y). Since pp is prime, p∣x−yp \mid x - y or p∣x+yp \mid x + y, i.e. y≡xy \equiv x or y≡−x(modp)y \equiv -x \pmod p. Thus the square roots of aa in GG lie in {x,−x}\{x, -x\}. These two are distinct elements of GG: if x≡−x(modp)x \equiv -x \pmod p then p∣2xp \mid 2x, and since pp is odd, p∤2p \nmid 2, forcing p∣xp \mid x, contradicting x∈Gx \in G (i.e. p∤xp \nmid x). Hence x≢−xx \not\equiv -x, and both x,−xx, -x are genuine square roots, giving exactly two. (3) Index computation. The squaring map σ:G→Q\sigma: G \to Q is surjective by definition of QQ, and by part (2) every fiber σ−1(a)\sigma^{-1}(a) for a∈Qa \in Q has exactly 22 elements. Since GG is finite and partitioned into these fibers,

∣G∣=∑a∈Q∣σ−1(a)∣=2∣Q∣.|G| = \sum_{a \in Q} |\sigma^{-1}(a)| = 2|Q|.

As ∣G∣=p−1|G| = p - 1, we conclude ∣Q∣=(p−1)/2|Q| = (p-1)/2, which is an integer since pp is odd (so p−1p - 1 is even). This proves QQ has index [G:Q]=∣G∣/∣Q∣=2[G : Q] = |G|/|Q| = 2. ■\blacksquare (Lemma)

Proof of the Theorem, from the Lemma. Since Q≤GQ \le G has index 22, the quotient group G/QG/Q has order 22; write its two elements as QQ (the identity coset) and gQgQ for any fixed non-residue gg. Define χ:G/Q→{1,−1}\chi : G/Q \to \{1, -1\} by χ(Q)=1\chi(Q) = 1 and χ(gQ)=−1\chi(gQ) = -1. Since G/QG/Q has order 22, it is isomorphic to {±1}\{\pm 1\} under multiplication (the unique group of order 22), and χ\chi is precisely such an isomorphism: it is a bijection by construction, and it is a homomorphism because in any group of order 22 with identity ee and other element ff, we have f⋅f=ef \cdot f = e, matching (−1)(−1)=1(-1)(-1) = 1 and 1⋅1=11 \cdot 1 = 1 under χ\chi. Let π:G→G/Q\pi : G \to G/Q be the canonical quotient homomorphism, π(x)=xQ\pi(x) = xQ. Then χ∘π:G→{±1}\chi \circ \pi : G \to \{\pm 1\} is a composite of two group homomorphisms, hence itself a group homomorphism:

(χ∘π)(ab)=(χ∘π)(a)⋅(χ∘π)(b)for all a,b∈G.(\chi \circ \pi)(ab) = (\chi\circ\pi)(a)\cdot(\chi\circ\pi)(b) \quad \text{for all } a, b \in G.

It remains to check that (χ∘π)(a)=(a/p)(\chi \circ \pi)(a) = (a/p) for every aa with p∤ap \nmid a (equivalently, for every a∈Ga \in G, viewing aa as its residue class). By definition, (χ∘π)(a)=χ(aQ)(\chi \circ \pi)(a) = \chi(aQ), which equals 11 if aQ=QaQ = Q, i.e. if a∈Qa \in Q, i.e. if aa is a quadratic residue mod pp; and it equals −1-1 if aQ≠QaQ \ne Q, i.e. a∉Qa \notin Q, i.e. aa is a quadratic nonresidue mod pp. By the definition of the Legendre symbol, this says exactly (χ∘π)(a)=(a/p)(\chi\circ\pi)(a) = (a/p) for p∤ap \nmid a. Therefore, for integers a,ba, b both not divisible by pp,

(abp)=(χ∘π)(ab)=(χ∘π)(a)⋅(χ∘π)(b)=(ap)(bp),\left(\frac{ab}{p}\right) = (\chi\circ\pi)(ab) = (\chi\circ\pi)(a)\cdot(\chi\circ\pi)(b) = \left(\frac{a}{p}\right)\left(\frac{b}{p}\right),

using that p∤abp \nmid ab (since pp is prime and divides neither factor, by Euclid's lemma applied contrapositively) so that (ab/p)(ab/p) is likewise given by the nonzero-case formula. Finally, if p∣ap \mid a or p∣bp \mid b, then p∣abp \mid ab, so (ab/p)=0(ab/p) = 0 by definition; and at least one of (a/p),(b/p)(a/p), (b/p) is 00 by definition, so (a/p)(b/p)=0(a/p)(b/p) = 0 as well. The identity holds trivially in this remaining case. Combining both cases, (ab/p)=(a/p)(b/p)(ab/p) = (a/p)(b/p) for all integers a,ba, b, completing the proof. ■\blacksquare

∎
CorollaryThe Legendre symbol as a homomorphism, and squares of the symbol

For any odd prime pp and any integer aa with p∤ap \nmid a:

(a2p)=1,(−ap)=(−1p)(ap).\left(\frac{a^2}{p}\right) = 1, \qquad \left(\frac{-a}{p}\right) = \left(\frac{-1}{p}\right)\left(\frac{a}{p}\right).

More generally, for integers a1,…,aka_1, \dots, a_k,

(a1a2⋯akp)=(a1p)(a2p)⋯(akp).\left(\frac{a_1 a_2 \cdots a_k}{p}\right) = \left(\frac{a_1}{p}\right)\left(\frac{a_2}{p}\right)\cdots\left(\frac{a_k}{p}\right).
Proof

The first identity is the case a=ba = b of the theorem: (a2/p)=(a/p)2(a^2/p) = (a/p)^2, and since (a/p)∈{1,−1}(a/p) \in \{1,-1\} for p∤ap \nmid a, its square is always 11. The second identity is the case b=−1b = -1 of the theorem, using −a=(−1)⋅a-a = (-1)\cdot a. The general product identity follows from the two-variable case by induction on kk: the case k=1k=1 is trivial, and if the identity holds for k−1k-1 factors, then applying the two-variable theorem to a1⋯ak−1a_1 \cdots a_{k-1} and aka_k gives

(a1⋯akp)=(a1⋯ak−1p)(akp)=(a1p)⋯(ak−1p)(akp),\left(\frac{a_1\cdots a_k}{p}\right) = \left(\frac{a_1 \cdots a_{k-1}}{p}\right)\left(\frac{a_k}{p}\right) = \left(\frac{a_1}{p}\right)\cdots\left(\frac{a_{k-1}}{p}\right)\left(\frac{a_k}{p}\right),

completing the induction. ■\blacksquare

∎

Worked examples

Example 1: computing (45/17)(45/17) by direct factorization and multiplicativity. Take p=17p = 17 (an odd prime) and a=45a = 45. First reduce: 45=2⋅17+1145 = 2\cdot 17 + 11, so 45≡11(mod17)45 \equiv 11 \pmod{17}, and since the symbol depends only on a  pa \bmod p,

(4517)=(1117).\left(\frac{45}{17}\right) = \left(\frac{11}{17}\right).

Rather than testing all square roots directly, use multiplicativity with the factorization 45=9⋅545 = 9 \cdot 5:

(4517)=(917)(517).\left(\frac{45}{17}\right) = \left(\frac{9}{17}\right)\left(\frac{5}{17}\right).

Since 9=329 = 3^2, the corollary above gives (9/17)=1(9/17) = 1. For (5/17)(5/17), we search for xx with x2≡5(mod17)x^2 \equiv 5 \pmod{17} by squaring residues: 12=1, 22=4, 32=9, 42=16, 52=25≡8, 62=36≡2, 72=49≡15, 82=64≡131^2=1,\ 2^2=4,\ 3^2=9,\ 4^2=16,\ 5^2=25\equiv8,\ 6^2=36\equiv2,\ 7^2=49\equiv15,\ 8^2=64\equiv13. The full set of quadratic residues mod 1717 (using that x2≡(17−x)2x^2 \equiv (17-x)^2, so it suffices to square 1,…,81,\dots,8) is {1,4,9,16,8,2,15,13}\{1,4,9,16,8,2,15,13\}. Since 55 is not in this set, 55 is a nonresidue, so (5/17)=−1(5/17) = -1. Hence

(4517)=1⋅(−1)=−1,\left(\frac{45}{17}\right) = 1 \cdot (-1) = -1,

so 4545 is a quadratic nonresidue mod 1717. As a check: we can verify directly that 1111 (to which 4545 is congruent) is also absent from {1,2,4,8,9,13,15,16}\{1,2,4,8,9,13,15,16\}, consistent with (11/17)=(45/17)=−1(11/17) = (45/17) = -1.

Example 2: a product of three factors, including a factor divisible by pp, showing the 00 case interacting with multiplicativity. Take p=13p = 13 and consider a=6a = 6, b=26b = 26, c=7c = 7, so abc=6⋅26⋅7=1092abc = 6 \cdot 26 \cdot 7 = 1092. Note 26=2⋅1326 = 2\cdot 13, so 13∣2613 \mid 26, hence (26/13)=0(26/13) = 0 by definition. By the product formula,

(109213)=(613)(2613)(713)=(613)⋅0⋅(713)=0.\left(\frac{1092}{13}\right) = \left(\frac{6}{13}\right)\left(\frac{26}{13}\right)\left(\frac{7}{13}\right) = \left(\frac{6}{13}\right)\cdot 0 \cdot \left(\frac{7}{13}\right) = 0.

This matches direct computation: 1092=84⋅13+01092 = 84\cdot 13 + 0, so indeed 13∣109213 \mid 1092 and (1092/13)=0(1092/13) = 0 by definition, confirming the formula without needing to know (6/13)(6/13) or (7/13)(7/13) individually. For completeness, since 6≡66\equiv 6 and 66 is not among the quadratic residues mod 1313 found in the earlier figure ({1,3,4,9,10,12}\{1,3,4,9,10,12\}), we get (6/13)=−1(6/13) = -1; and 7∉{1,3,4,9,10,12}7 \notin \{1,3,4,9,10,12\} either, so (7/13)=−1(7/13) = -1 too — giving (6/13)(7/13)=(−1)(−1)=1=(42/13)(6/13)(7/13) = (-1)(-1) = 1 = (42/13), a separate check that 42≡3(mod13)42 \equiv 3 \pmod{13} is indeed a residue (it is, since 3=42  133 = 4^2 \bmod 13: 16≡316 \equiv 3). This illustrates how a single zero factor collapses the whole product to 00 regardless of the other factors' signs.

CounterexampleWhy "pp odd prime" cannot be weakened to "pp odd" alone

The multiplicativity theorem is false if pp is merely an odd composite number, with the symbol extended naively by the same defining rule (quadratic residue mod pp means ∃x, x2≡a(modp)\exists x,\ x^2\equiv a \pmod p). Let p=9p = 9 (odd, but not prime), and define (a/9)=1(a/9) = 1 if aa is a nonzero square mod 99 coprime to 99, −1-1 if aa is coprime to 99 but not a square, and 00 if gcd⁡(a,9)>1\gcd(a,9) > 1. The units mod 99 are {1,2,4,5,7,8}\{1,2,4,5,7,8\}, and squaring gives 12=1,22=4,42=16≡7,52=25≡7,72=49≡4,82=64≡11^2=1, 2^2=4, 4^2=16\equiv7, 5^2=25\equiv7, 7^2=49\equiv4, 8^2=64\equiv1; so the squares among the units are {1,4,7}\{1,4,7\}, meaning (1/9)=(4/9)=(7/9)=1(1/9)=(4/9)=(7/9)=1 and (2/9)=(5/9)=(8/9)=−1(2/9)=(5/9)=(8/9)=-1. Now test multiplicativity on a=2a = 2, b=4b = 4: ab=8ab = 8. We compute

(29)(49)=(−1)(1)=−1,(89)=−1.\left(\frac{2}{9}\right)\left(\frac{4}{9}\right) = (-1)(1) = -1, \qquad \left(\frac{8}{9}\right) = -1.

That case happens to agree — so try a=2, b=5a=2,\ b=5: ab=10≡1(mod9)ab=10\equiv1\pmod 9, so (10/9)=(1/9)=1(10/9)=(1/9)=1, while (2/9)(5/9)=(−1)(−1)=1(2/9)(5/9) = (-1)(-1)=1; still consistent. The real failure appears with a non-unit: take a=3a = 3, b=3b = 3, so ab=9≡0(mod9)ab = 9 \equiv 0 \pmod 9, giving (9/9)=0(9/9) = 0 and correctly (3/9)(3/9)(3/9)(3/9) should also vanish since gcd⁡(3,9)=3>1\gcd(3,9)=3>1 forces (3/9)=0(3/9)=0 — again consistent by the zero rule. The genuine breakdown is structural rather than a single numerical clash: the proof of the theorem used that QQ has index exactly 22 in (Z/pZ)×(\mathbb{Z}/p\mathbb{Z})^\times, which relied on part (2) of the Lemma — every nonzero aa has at most two square roots, which used that pp is prime (via p∣(x−y)(x+y)  ⟹  p∣x−y or p∣x+yp \mid (x-y)(x+y) \implies p\mid x-y \text{ or } p \mid x+y). For p=9p=9 this fails: the equation x2≡1(mod9)x^2 \equiv 1 \pmod 9 has four solutions among units, x∈{1,8}x \in \{1, 8\} only actually — recompute: solving x2≡1(mod9)x^2\equiv1\pmod9 for x∈{1,2,4,5,7,8}x\in\{1,2,4,5,7,8\} gives only x=1,8x=1,8 (checking: 22=4≠12^2=4\ne1, 42=7≠14^2=7\ne1, 52=7≠15^2=7\ne1, 72=4≠17^2=4\ne1), so this particular case has exactly two roots. But the group of units mod 99 is cyclic of order 66 (generated by 22), and its subgroup of squares is {1,4,7}\{1,4,7\} of order 33 — an index-22 subgroup indeed, since 66 is even. The real obstruction to a literal Legendre-style multiplicative symbol for composite odd moduli is different: for prime powers like 9=329 = 3^2 the unit group is still cyclic and an analogous symbol can be built (this is the Jacobi-symbol phenomenon for prime factors), but for a general odd composite p=p1p2p = p_1 p_2 with two distinct prime factors, (Z/pZ)×≅(Z/p1Z)××(Z/p2Z)×(\mathbb{Z}/p\mathbb{Z})^\times \cong (\mathbb{Z}/p_1\mathbb{Z})^\times \times (\mathbb{Z}/p_2\mathbb{Z})^\times is not cyclic, so squaring need not be 22-to-11 onto its image and the naive "residue/nonresidue" indicator is not a homomorphism. Concretely with p=15=3⋅5p = 15 = 3\cdot 5: the units mod 1515 are {1,2,4,7,8,11,13,14}\{1,2,4,7,8,11,13,14\}, of order 88. Squares: 12=1, 22=4, 42=16≡1, 72=49≡4, 82=64≡4, 112=121≡1, 132=169≡4, 142=196≡11^2=1,\,2^2=4,\,4^2=16\equiv1,\,7^2=49\equiv4,\,8^2=64\equiv4,\,11^2=121\equiv1,\,13^2=169\equiv4,\,14^2=196\equiv1. So the set of squares is only {1,4}\{1,4\}, of size 22, not index 22 (index is 8/2=48/2=4, not the required "kernel of a ±1\pm1-valued homomorphism onto an index-2 subgroup" structure needed for a clean multiplicative sign). Define naively (a/15)=1(a/15)=1 if a∈{1,4}a\in\{1,4\}, else −1-1 for units. Test a=2, b=8a = 2,\ b = 8: ab=16≡1(mod15)ab = 16 \equiv 1 \pmod{15}, so (1/15)=1(1/15) = 1. But (2/15)=−1(2/15) = -1 (since 2∉{1,4}2 \notin\{1,4\}) and (8/15)=−1(8/15) = -1 (since 8∉{1,4}8\notin\{1,4\}), giving (2/15)(8/15)=1(2/15)(8/15) = 1 — consistent here; try a=2, b=7a=2,\ b=7: ab=14ab = 14, so (14/15)=−1(14/15) = -1 since 14∉{1,4}14\notin\{1,4\}. But (2/15)(7/15)=(−1)(−1)=1≠−1(2/15)(7/15) = (-1)(-1) = 1 \ne -1. This is the failure: multiplicativity breaks for composite odd modulus 1515, precisely because dropping primality destroys the index-22 subgroup structure the proof relied on.

Scope, edge cases & common traps

SituationWhat happensWhy
p∣ap \mid a(a/p)=0(a/p) = 0by definition, not a residue/nonresidue question
pp odd prime, gcd⁡(a,p)=1\gcd(a,p)=1(a/p)=±1(a/p) = \pm1 exactly, multiplicativeLemma: QQ has index 22 in cyclic-order-(p−1)(p-1) group
p=2p = 2Legendre symbol undefined / not standardsquares mod 22 trivial (0,10,1 both squares); definition requires pp odd
pp compositenaive extension fails multiplicativity in generalunit group need not be cyclic; see counterexample
aa replaced by a+kpa + kpvalue unchangedsymbol depends only on a  pa \bmod p

The mathematician behind it

Origins · 1 minAdrien-Marie Legendre and how this was discovered
AL
Adrien-Marie Legendre
1752–1833 · Paris, France; the era of Euler, Lagrange, and Gauss in classical number theory

Legendre was a French mathematician working across number theory, celestial mechanics, elliptic integrals, and statistics (he introduced the method of least squares independently around the same time as Gauss). In number theory, his 1798 treatise Essai sur la théorie des nombres introduced the symbol that now bears his name, and he stated (though did not give a complete proof of) the Law of Quadratic Reciprocity in the form used today. His notation for (a/p)(a/p) proved to be exactly the right bookkeeping device: it converted a delicate arithmetic question about solvability of x2≡a(modp)x^2 \equiv a \pmod p into a multiplicative function amenable to systematic manipulation, setting the stage for Gauss's first rigorous proof of reciprocity and for the entire subsequent development of quadratic and higher reciprocity laws.

History
- 1785: Legendre works on conditions for representability of integers by quadratic forms, encountering residue/nonresidue patterns.
- 1798: Legendre's Essai sur la théorie des nombres introduces the symbol (a/p)(a/p) and states a version of quadratic reciprocity.
- 1801: Gauss's Disquisitiones Arithmeticae gives the first complete proof of quadratic reciprocity, using different (non-Legendre-symbol) methods initially.
- 1808 onward: Gauss and others reformulate reciprocity proofs explicitly in terms of the Legendre symbol, cementing the notation.
- 1837 onward: Jacobi generalizes the symbol to composite odd moduli, yielding the Jacobi symbol used in primality testing.
Why does the Legendre symbol require pp to be an odd prime rather than any prime?

The definition itself makes sense verbatim for p=2p = 2: one could ask whether aa is a square mod 22. But the interesting structure collapses because (Z/2Z)×(\mathbb{Z}/2\mathbb{Z})^\times has order 11, so every unit (a≡1a\equiv1) is trivially a square, and there is no nontrivial residue/nonresidue distinction to encode. The proof of multiplicativity here crucially used that p−1p-1 is even (so that squares form a genuine index-2 subgroup with two square roots per element); this requires pp odd. By convention the Legendre symbol is simply defined only for odd primes pp, and the prime 22 is treated separately (often via a special supplementary formula in reciprocity theory) rather than folded into this symbol.

Is (a/p)=1(a/p) = 1 enough to conclude aa is a genuine square modulo pp, not just modulo some other number?

Yes, precisely: for an odd prime pp and p∤ap \nmid a, the Legendre symbol (a/p)(a/p) equals 11 if and only if there exists an integer xx with x2≡a(modp)x^2 \equiv a \pmod p, by the very definition of quadratic residue used to define the symbol. This is a genuinely biconditional fact for prime moduli. It is worth stressing that this equivalence can fail for the superficially similar Jacobi symbol with composite modulus: a Jacobi symbol value of 11 does not by itself certify that aa is a square modulo that composite number, which is a frequent source of error for students moving from Legendre to Jacobi symbols.

How is the Legendre symbol actually computed efficiently for large primes, without listing all squares?

Listing all (p−1)/2(p-1)/2 squares mod pp and checking membership is computationally expensive for large pp. In practice one uses Euler's Criterion, which states (a/p)≡a(p−1)/2(modp)(a/p) \equiv a^{(p-1)/2} \pmod p, reducing the computation to a single modular exponentiation, doable in O(log⁡p)O(\log p) multiplications via repeated squaring. Alternatively, The Law of Quadratic Reciprocity together with the multiplicativity proved here lets one recursively flip and reduce the symbol the way the Euclidean algorithm reduces gcd computations, giving another efficient algorithm without ever computing a full list of quadratic residues.

Does the Legendre symbol distinguish quadratic residues from nonresidues among all integers, or only those coprime to pp?

The symbol is defined for all integers aa, but its interesting information — the ±1\pm 1 distinction between residue and nonresidue — is only meaningful when gcd⁡(a,p)=1\gcd(a,p)=1. Whenever p∣ap \mid a, the symbol simply returns 00, flagging that aa is congruent to 00 mod pp and so the residue/nonresidue dichotomy does not apply (as 00 is a degenerate square, 0=020 = 0^2, but it is conventionally excluded from the residue/nonresidue classification precisely so the symbol can cleanly signal this case with its own value).

Is the Legendre symbol symmetric, i.e. does (a/p)=(p/a)(a/p) = (p/a) hold in general?

No — and this asymmetry is exactly what makes the Law of Quadratic Reciprocity a nontrivial and celebrated theorem rather than a triviality. The Legendre symbol (a/p)(a/p) requires pp to be an odd prime, while aa can be an arbitrary integer, so "(p/a)(p/a)" is not even defined unless aa is itself an odd prime. When both pp and qq are odd primes, reciprocity relates (p/q)(p/q) and (q/p)(q/p) via the precise formula (p/q)(q/p)=(−1)p−12⋅q−12(p/q)(q/p) = (-1)^{\frac{p-1}{2}\cdot\frac{q-1}{2}}, which is a highly nontrivial identity proved separately from the basic multiplicativity established in this article.

Why is it true that exactly half the nonzero residues mod an odd prime are quadratic residues?

This falls directly out of the Lemma proved above: the squaring map on the cyclic group (Z/pZ)×(\mathbb{Z}/p\mathbb{Z})^\times of order p−1p-1 is exactly two-to-one onto its image, because each square has precisely two square roots (xx and −x-x, distinct since pp is odd). Counting elements via these size-two fibers forces the image (the quadratic residues) to have size exactly (p−1)/2(p-1)/2, which is exactly half of the p−1p-1 nonzero residues. This is a purely group-theoretic argument, requiring no knowledge of Euler's criterion or quadratic reciprocity.

What role does the Legendre symbol play in eventually proving quadratic reciprocity?

The Legendre symbol is the language in which reciprocity is stated: without it, one would have to phrase reciprocity awkwardly as a relation between two solvability questions ("x2≡p(modq)x^2\equiv p \pmod q is solvable if and only if..."). With the symbol and its proven multiplicativity in hand, one can manipulate expressions like (p/q)(q/p)(p/q)(q/p) algebraically, decompose numbers into prime factors and distribute the symbol over products, and combine it with tools like Gauss's Lemma (a sign-counting formula for (a/p)(a/p)) to build the classical proofs of reciprocity. The multiplicativity proved in this article is a genuine prerequisite lemma used inside essentially every standard proof of reciprocity.

Before this

Where this leads