The Supplementary Laws: (-1/p) and (2/p)

Fix an odd prime pp. For which primes can you write −1-1 as a perfect square modulo pp? For which can you write 22 as a perfect square modulo pp? These two questions look elementary. They concern only two fixed integers, −1-1 and 22. Yet the answers turn out to be governed by a single elegant rule. Reduce pp modulo 44 in the first case, and modulo 88 in the second. This is the content of the supplementary laws to the Law of Quadratic Reciprocity. They are so named because they complete the reciprocity law. They handle the two cases (the residue −1-1 and the prime 22) that the main reciprocity statement between two odd primes does not directly cover. The stakes are higher than they first appear. Whether −1-1 is a quadratic residue mod pp decides whether pp divides a sum of two squares a2+b2a^2+b^2 with gcd⁡(a,b)=1\gcd(a,b)=1. This is the arithmetic engine behind Fermat's theorem on Sums of Two Squares. Whether 22 is a quadratic residue mod pp governs the factorization of x2−2x^2-2 over Fp\mathbb{F}_p. It also governs the splitting of primes in Z[2]\mathbb{Z}[\sqrt2]. It appears throughout the theory of quadratic forms and continued fractions. Both questions are special cases of the general reciprocity law. But they are proved independently, using Euler's Criterion and Gauss's Lemma. Historically, they were discovered and proved before the general law was fully established by Gauss. The big picture is this: Legendre introduced the symbol (ap)\left(\frac{a}{p}\right) to encode quadratic residuacity. The quadratic reciprocity program asks how (qp)\left(\frac{q}{p}\right) and (pq)\left(\frac{p}{q}\right) relate for two odd primes p,qp,q. The supplementary laws answer the two questions that reciprocity between odd primes leaves open. What happens when one of the two numbers is −1-1 (not itself a prime) or 22 (the one prime reciprocity excludes)? Both laws admit slick, self-contained proofs via Gauss's Lemma. Both are indispensable tools used constantly in later theory. This article proves both supplementary laws completely, from Euler's Criterion and Gauss's Lemma, with full case analysis. It works out two nontrivial numerical examples. It explains exactly why each hypothesis (oddness of pp, primality) is needed. It previews how these laws feed into the full reciprocity law and the two-squares theorem.

Key takeaways
  • The first supplementary law says −1-1 is a QR mod odd prime pp iff p≡1(mod4)p \equiv 1 \pmod 4.
  • The second supplementary law says 22 is a QR mod odd prime pp iff p≡±1(mod8)p \equiv \pm 1 \pmod 8.
  • Both follow cleanly from Euler's Criterion (for −1-1) and Gauss's Lemma (for 22), with no need for the full reciprocity machinery.
  • The formulas can be unified: (−1p)=(−1)(p−1)/2\left(\frac{-1}{p}\right) = (-1)^{(p-1)/2} and (2p)=(−1)(p2−1)/8\left(\frac{2}{p}\right) = (-1)^{(p^2-1)/8}.
  • These laws are the engine behind Fermat's Sums of Two Squares theorem and behind determining which primes split in Z[i]\mathbb{Z}[i] and Z[2]\mathbb{Z}[\sqrt2].
  • They are the two special cases needed to complete the Law of Quadratic Reciprocity into a full algorithm for any Legendre symbol.
  • Key idea: counting sign changes in Gauss's Lemma reduces both questions to simple congruence conditions on pp.

Where this lives today

The first supplementary law is the arithmetic core of Fermat's theorem on <a class="wiki-link" href="/wiki/math-numthy-sums-of-two-squares" data-track="wiki_article.body.wiki_link">Sums of Two Squares</a>: an odd prime pp is expressible as a2+b2a^2+b^2 if and only if p≡1(mod4)p\equiv1\pmod4, and the "only if" direction, plus the key existence step in "if", both hinge on knowing when −1-1 is a QR mod pp. This propagates into the theory of Gaussian integers Z[i]\mathbb{Z}[i], where a prime p≡1(mod4)p\equiv1\pmod4 splits as a product of two conjugate Gaussian primes while p≡3(mod4)p\equiv3\pmod4 remains inert — a basic case of splitting of primes in number fields. The second supplementary law governs splitting in the real quadratic ring Z[2]\mathbb{Z}[\sqrt2] and determines when x2−2x^2-2 factors mod pp, which matters for factoring polynomials over finite fields and for constructing explicit quadratic residue codes in coding theory. Both laws appear as base cases inside the full statement and every proof of the Law of Quadratic Reciprocity, and both are used as elementary building blocks in algorithms that compute Legendre and Jacobi symbols efficiently (used inside primality tests such as the Solovay–Strassen test and inside quadratic sieve / index calculus methods in computational number theory and cryptography). In cryptography specifically, fast Legendre-symbol evaluation via reciprocity (including these supplementary cases) underlies efficient square-root extraction modulo primes, which is a subroutine in some digital signature and key-exchange constructions. In physics and combinatorics, quadratic residues mod pp (whose basic ±1,±2\pm1,\pm2 behavior these laws pin down) appear in constructions of Paley graphs and difference sets with strong pseudorandomness properties.

Ask the tutor: How do the supplementary laws combine with the full reciprocity law to compute (ap)\left(\frac{a}{p}\right) for a completely general integer aa?

DefinitionQuadratic residue and the Legendre symbol

Let pp be an odd prime and let aa be an integer with p∤ap \nmid a. We say aa is a quadratic residue (QR) modulo pp if the congruence

x2≡a(modp)x^2 \equiv a \pmod p

has a solution x∈Zx \in \mathbb{Z}; otherwise aa is a quadratic non-residue (NQR) modulo pp. The Legendre symbol is defined by

(ap)={ 1if a is a QR mod p,−1if a is a NQR mod p, 0if p∣a.\left(\frac{a}{p}\right) = \begin{cases} \ 1 & \text{if } a \text{ is a QR mod } p,\\ -1 & \text{if } a \text{ is a NQR mod } p,\\ \ 0 & \text{if } p \mid a. \end{cases}

The two supplementary laws determine (−1p)\left(\frac{-1}{p}\right) and (2p)\left(\frac{2}{p}\right) for every odd prime pp.

Intuition

Think of the nonzero residues 1,2,…,p−11,2,\dots,p-1 modulo pp as forming a cyclic group (Z/pZ)×(\mathbb{Z}/p\mathbb{Z})^\times of order p−1p-1 under multiplication. Squaring is a group homomorphism from this cyclic group to itself, and its image — the quadratic residues — is exactly the unique subgroup of index 22. So exactly half of the nonzero residues are QRs and half are NQRs. The question "is −1-1 a QR?" becomes: does −1-1, an element of order exactly 22 (since (−1)2=1(-1)^2=1 and −1≠1-1 \ne 1 for pp odd), lie in that index-22 subgroup? Because the group is cyclic of order p−1p-1, the unique element of order 22 lies in the subgroup of squares precisely when the group has an element of order 44 dividing evenly — equivalently when 4∣p−14 \mid p-1. This is the group-theoretic shadow of the first supplementary law; Euler's Criterion makes it computational. The second law, about 22, has no such one-line group-theoretic shortcut — 22 is just some element of the cyclic group, with no special algebraic distinction the way −1-1 has order 22. Instead the proof goes through Gauss's Lemma, which counts how many of the "least positive residues" of 1⋅2,2⋅2,…,p−12⋅21\cdot2, 2\cdot2,\dots,\frac{p-1}{2}\cdot 2 modulo pp exceed p/2p/2; the parity of that count is (2p)\left(\frac{2}{p}\right). This turns a group-theoretic question into an explicit counting problem, whose answer depends on p  8p \bmod 8 because the count of "large" residues among 2,4,6,…,p−12,4,6,\dots,p-1 depends on where p/2p/2 falls relative to multiples of 22, and that pattern repeats with period 88 in pp.

Figure
The Legendre symbol (−1/p)(-1/p) and (2/p)(2/p) plotted against p mod 8p \bmod 8
+1 -1 residue class of p mod 8 (odd values only) 1 3 5 7 (-1/p) (2/p)

Central theorems

TheoremFirst Supplementary Law

Let pp be an odd prime. Then

(−1p)=(−1)(p−1)/2={1if p≡1(mod4),−1if p≡3(mod4).\left(\frac{-1}{p}\right) = (-1)^{(p-1)/2} = \begin{cases} 1 & \text{if } p \equiv 1 \pmod 4,\\ -1 & \text{if } p \equiv 3 \pmod 4. \end{cases}

Equivalently: −1-1 is a quadratic residue mod pp if and only if p≡1(mod4)p \equiv 1 \pmod 4.

Proof

We use Euler's Criterion: for any odd prime pp and any integer aa with p∤ap \nmid a,

a(p−1)/2≡(ap)(modp).a^{(p-1)/2} \equiv \left(\frac{a}{p}\right) \pmod p.

(This is itself proved from Fermat's Little Theorem together with the fact that (Z/pZ)×(\mathbb{Z}/p\mathbb{Z})^\times is cyclic of order p−1p-1, so that x(p−1)/2≡1x^{(p-1)/2}\equiv 1 exactly for the (p−1)/2(p-1)/2 quadratic residues, and x(p−1)/2≡−1x^{(p-1)/2}\equiv -1 for the rest, since x(p−1)/2x^{(p-1)/2} satisfies y2≡1y^2\equiv 1 hence y≡±1y \equiv \pm 1, and the polynomial y−1y-1 has at most one root class dividing residues evenly by Lagrange's theorem on polynomial roots mod pp.) Apply Euler's Criterion with a=−1a = -1:

(−1)(p−1)/2≡(−1p)(modp).(-1)^{(p-1)/2} \equiv \left(\frac{-1}{p}\right) \pmod p.

Both sides of this congruence lie in {1,−1}\{1,-1\}, and pp is odd with p≥3p \geq 3, so p>2p > 2; two elements of {1,−1}\{1,-1\} that are congruent mod pp (with p>2p>2) must be equal as integers, since their difference is 00 or ±2\pm 2, and p∤2p \nmid 2 when pp is odd. Hence

(−1p)=(−1)(p−1)/2.\left(\frac{-1}{p}\right) = (-1)^{(p-1)/2}.

Finally, (p−1)/2(p-1)/2 is even iff p≡1(mod4)p \equiv 1 \pmod 4, and odd iff p≡3(mod4)p \equiv 3 \pmod 4 (write p=4k+1p = 4k+1 or p=4k+3p=4k+3 and compute (p−1)/2=2k(p-1)/2 = 2k or 2k+12k+1 respectively). This gives the stated case formula. ■\blacksquare

∎
LemmaGauss's Lemma

Let pp be an odd prime and let aa be an integer with p∤ap \nmid a. Consider the (p−1)/2(p-1)/2 integers

a, 2a, 3a, …, p−12 a,a,\ 2a,\ 3a,\ \dots,\ \frac{p-1}{2}\,a,

and let r1,…,r(p−1)/2r_1,\dots,r_{(p-1)/2} be their least positive residues mod pp (each ri∈{1,…,p−1}r_i \in \{1,\dots,p-1\}). Let μ\mu be the number of these rir_i that satisfy ri>p/2r_i > p/2. Then

(ap)=(−1)μ.\left(\frac{a}{p}\right) = (-1)^{\mu}.

(Gauss's Lemma is assumed known as a prerequisite; we use it as a black box below, together with a standard counting sublemma proved from it.)

TheoremSecond Supplementary Law

Let pp be an odd prime. Then

(2p)=(−1)(p2−1)/8={1if p≡1 or 7(mod8),−1if p≡3 or 5(mod8).\left(\frac{2}{p}\right) = (-1)^{(p^2-1)/8} = \begin{cases} 1 & \text{if } p \equiv 1 \text{ or } 7 \pmod 8,\\ -1 & \text{if } p \equiv 3 \text{ or } 5 \pmod 8. \end{cases}

Equivalently: 22 is a quadratic residue mod pp if and only if p≡±1(mod8)p \equiv \pm 1 \pmod 8.

Proof

We apply Gauss's Lemma with a=2a = 2. Consider the integers

2⋅1, 2⋅2, …, 2⋅p−12,2\cdot 1,\ 2\cdot 2,\ \dots,\ 2\cdot \frac{p-1}{2},

i.e. the even numbers 2,4,6,…,p−12, 4, 6, \dots, p-1. Since each of these already lies strictly between 00 and pp, each one is its own least positive residue mod pp — no reduction is needed. So in the notation of Gauss's Lemma, the multiset {r1,…,r(p−1)/2}\{r_1,\dots,r_{(p-1)/2}\} is exactly the set of even integers in {1,…,p−1}\{1,\dots,p-1\}, and

μ=#{ e:e even, p/2<e<p }.\mu = \#\{\, e : e \text{ even},\ p/2 < e < p \,\}.

We must count how many even integers lie strictly between p/2p/2 and pp. Write n=(p−1)/2n = (p-1)/2, so the even numbers under consideration are 2,4,…,2n2,4,\dots,2n and we want how many of 2,4,…,2n2,4,\dots,2n exceed p/2p/2.

Case p≡1(mod8)p \equiv 1 \pmod 8. Write p=8k+1p = 8k+1. Then n=(p−1)/2=4kn=(p-1)/2 = 4k, and p/2=4k+1/2p/2 = 4k + 1/2. The even numbers 2,4,…,8k2,4,\dots,8k that exceed 4k+124k+\tfrac12 are 4k+2,4k+4,…,8k4k+2, 4k+4,\dots, 8k, which is 2k2k numbers. So μ=2k\mu = 2k, even, giving (2p)=1\left(\frac{2}{p}\right)=1.

Case p≡3(mod8)p \equiv 3 \pmod 8. Write p=8k+3p = 8k+3. Then n=(p−1)/2=4k+1n = (p-1)/2 = 4k+1, and p/2=4k+32p/2 = 4k+\tfrac32. Even numbers among 2,4,…,8k+22,4,\dots,8k+2 exceeding 4k+324k+\tfrac32 are 4k+2,4k+4,…,8k+24k+2,4k+4,\dots,8k+2, which is 2k+12k+1 numbers. So μ=2k+1\mu = 2k+1, odd, giving (2p)=−1\left(\frac{2}{p}\right) = -1.

Case p≡5(mod8)p \equiv 5 \pmod 8. Write p=8k+5p = 8k+5. Then n=(p−1)/2=4k+2n=(p-1)/2 = 4k+2, and p/2=4k+52p/2 = 4k+\tfrac52. Even numbers among 2,…,8k+42,\dots,8k+4 exceeding 4k+524k+\tfrac52 are 4k+4,4k+6,…,8k+44k+4,4k+6,\dots,8k+4, which is 2k+12k+1 numbers. So μ=2k+1\mu = 2k+1, odd, giving (2p)=−1\left(\frac{2}{p}\right) = -1.

Case p≡7(mod8)p \equiv 7 \pmod 8. Write p=8k+7p = 8k+7. Then n=(p−1)/2=4k+3n = (p-1)/2 = 4k+3, and p/2=4k+72p/2 = 4k + \tfrac72. Even numbers among 2,…,8k+62,\dots,8k+6 exceeding 4k+724k+\tfrac72 are 4k+4,4k+6,…,8k+64k+4,4k+6,\dots,8k+6, which is 2k+22k+2 numbers. So μ=2k+2\mu = 2k+2, even, giving (2p)=1\left(\frac{2}{p}\right) = 1. Combining the four cases: (2p)=1\left(\frac{2}{p}\right)=1 exactly when p≡1,7(mod8)p \equiv 1,7 \pmod 8, and (2p)=−1\left(\frac{2}{p}\right)=-1 exactly when p≡3,5(mod8)p\equiv 3,5\pmod 8. Since every odd prime falls into exactly one of these four residue classes mod 88 (odd numbers mod 88 are 1,3,5,71,3,5,7), this is a complete case analysis and proves the case formula.

The closed formula. It remains to check (2p)=(−1)(p2−1)/8\left(\frac{2}{p}\right) = (-1)^{(p^2-1)/8} matches this in all four cases; note (p2−1)/8(p^2-1)/8 is always an integer here since pp is odd so p2≡1(mod8)p^2 \equiv 1 \pmod 8 (indeed any odd square is 1  81 \bmod 8: (2m+1)2=4m(m+1)+1(2m+1)^2 = 4m(m+1)+1 and m(m+1)m(m+1) is even). Compute (p2−1)/8  2(p^2-1)/8 \bmod 2 in each class:

  • p=8k+1p=8k+1: p2−1=64k2+16k=16k(4k+1)p^2-1 = 64k^2+16k = 16k(4k+1), so (p2−1)/8=2k(4k+1)(p^2-1)/8 = 2k(4k+1), even. Matches +1+1.
  • p=8k+3p=8k+3: p2−1=64k2+48k+8=8(8k2+6k+1)p^2-1 = 64k^2+48k+8 = 8(8k^2+6k+1), so (p2−1)/8=8k2+6k+1(p^2-1)/8 = 8k^2+6k+1, odd (since 8k2+6k8k^2+6k is even). Matches −1-1.
  • p=8k+5p=8k+5: p2−1=64k2+80k+24=8(8k2+10k+3)p^2-1 = 64k^2+80k+24 = 8(8k^2+10k+3), so quotient =8k2+10k+3=8k^2+10k+3, odd. Matches −1-1.
  • p=8k+7p=8k+7: p2−1=64k2+112k+48=8(8k2+14k+6)p^2-1 = 64k^2+112k+48 = 8(8k^2+14k+6), so quotient =8k2+14k+6= 8k^2+14k+6, even. Matches +1+1.

All four cases agree with the case-by-case result above, so (2p)=(−1)(p2−1)/8\left(\frac{2}{p}\right) = (-1)^{(p^2-1)/8} for every odd prime pp. ■\blacksquare

∎

Worked examples

Example 1: Is −1-1 a QR mod p=1009p=1009? First check 10091009 is prime: it is not divisible by 2,3,5,7,11,13,17,19,23,29,312,3,5,7,11,13,17,19,23,29,31 (indeed 312=961<1009<1024=32231^2 = 961 < 1009 < 1024=32^2, so trial division up to 3131 suffices), and one checks 1009/7=144.1…1009/7 = 144.1\ldots, 1009/11=91.7…1009/11=91.7\ldots, 1009/13=77.6…1009/13=77.6\ldots, 1009/17=59.4…1009/17=59.4\ldots, 1009/19=53.1…1009/19=53.1\ldots, 1009/23=43.9…1009/23=43.9\ldots, 1009/29=34.8…1009/29=34.8\ldots, 1009/31=32.5…1009/31=32.5\ldots, none integral, so 10091009 is prime. Now 1009=4⋅252+11009 = 4\cdot 252 + 1, so 1009≡1(mod4)1009 \equiv 1 \pmod 4. By the First Supplementary Law, (−11009)=1\left(\frac{-1}{1009}\right) = 1: −1-1 is a quadratic residue mod 10091009. Concretely this means there is an xx with x2≡−1(mod1009)x^2 \equiv -1 \pmod{1009}. We can even locate it via Euler's Criterion by trial (or Tonelli–Shanks in practice), but the supplementary law guarantees existence without any search: since 1009≡1(mod4)1009 \equiv 1\pmod 4, Fermat's two-square theorem (whose proof uses exactly this fact) further guarantees 1009=a2+b21009 = a^2+b^2 for some integers a,ba,b; indeed 1009=152+282=225+7841009 = 15^2 + 28^2 = 225+784, matching 225+784=1009225+784=1009. This is a preview of how the first supplementary law feeds directly into Sums of Two Squares.

Example 2: Is 22 a QR mod p=8191p = 8191? First, 8191=213−18191 = 2^{13}-1 is the Mersenne prime M13M_{13} (a known prime, confirmed since 213−1=81912^{13}-1=8191 has no small factors: not divisible by 3,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,893,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89 — checking 892=7921<8191<8281=91289^2=7921<8191<8281=91^2 so trial division to 9090 suffices, and one may directly verify 81918191 is prime via known Mersenne prime tables). Compute 8191  88191 \bmod 8. Since 8191=8⋅1023+78191 = 8\cdot 1023 + 7 (check: 8⋅1023=81848\cdot 1023 = 8184, and 8184+7=81918184+7=8191), we get 8191≡7(mod8)8191 \equiv 7 \pmod 8. By the Second Supplementary Law, since 7≡−1(mod8)7 \equiv -1 \pmod 8, we get (28191)=1\left(\frac{2}{8191}\right) = 1: 22 is a quadratic residue mod 81918191. As a check via the closed formula: (p2−1)/8=(81912−1)/8(p^2-1)/8 = (8191^2-1)/8. Since 8191≡7≡−1(mod8)8191\equiv 7\equiv -1\pmod 8 we showed above this exponent is even, consistent with +1+1. This tells us, for instance, that x2≡2(mod8191)x^2\equiv 2\pmod{8191} is solvable — relevant to factoring x2−2x^2-2 over F8191\mathbb F_{8191} and to the splitting of 81918191 in the ring Z[2]\mathbb Z[\sqrt2]: since 22 is a nonzero square mod 81918191, the prime 81918191 splits into two distinct prime ideals in Z[2]\mathbb{Z}[\sqrt2] rather than remaining inert.

Counterexamplewhy "pp odd prime" cannot be dropped

Both supplementary laws require pp to be an odd prime. Drop oddness and let p=2p=2. The Legendre symbol (ap)\left(\frac{a}{p}\right) is only conventionally defined for odd primes pp in the first place, precisely because the proof machinery (Euler's Criterion, the cyclicity of (Z/pZ)×(\mathbb{Z}/p\mathbb{Z})^\times, Gauss's Lemma) all use that (Z/pZ)×(\mathbb{Z}/p\mathbb{Z})^\times has even order p−1p-1 so that "squares" form an index-22 subgroup and the sign dichotomy makes sense. For p=2p=2, (Z/2Z)×(\mathbb{Z}/2\mathbb{Z})^\times is trivial (order 11), every nonzero residue (just 11) is trivially a square, and there is no even/odd dichotomy: the formula (−1)(p−1)/2(-1)^{(p-1)/2} isn't even defined since (p−1)/2=1/2∉Z(p-1)/2 = 1/2 \notin \mathbb{Z}. Concretely: is −1-1 a "QR" mod 22? We'd need x2≡−1≡1(mod2)x^2 \equiv -1 \equiv 1 \pmod 2, and indeed x=1x=1 works — but this is vacuous, not governed by any p  4p\bmod 4 condition (there's only one class mod 44 among odd residues once you fix p=2p=2, the whole framework collapses). Similarly the Second Law's formula (−1)(p2−1)/8(-1)^{(p^2-1)/8} needs (p2−1)/8=(4−1)/8=3/8∉Z(p^2-1)/8=(4-1)/8=3/8\notin\mathbb Z for p=2p=2, so the exponent isn't even an integer — the statement is simply not meaningful. This shows the hypothesis "pp odd" is not a technical nicety but load-bearing: it is what makes (p−1)/2(p-1)/2 and (p2−1)/8(p^2-1)/8 integers and what makes (Z/pZ)×(\mathbb{Z}/p\mathbb{Z})^\times have the right group structure (even order, hence an index-2 subgroup of squares) for the entire theory to make sense.

Scope, edge cases & common traps

SituationWhat happensCorrect handling
p=2p=2Legendre symbol undefined / laws not applicableTreat 22 separately; ramification of 22 handled by different (discriminant) methods
a≡0(modp)a \equiv 0 \pmod pLegendre symbol is 00 by conventionNot a QR or NQR; excluded from both laws
Composite modulus nnLegendre symbol not directly meaningfulUse the Jacobi symbol generalization instead, with care since Jacobi =1=1 does not imply QR
Confusing "p≡1(mod4)p\equiv 1\pmod4" with "p≡1(mod8)p\equiv1\pmod8"Common mixing of the two laws' moduliFirst law uses mod 44; second law uses mod 88 — they are genuinely different conditions
Assuming (2p)=1  ⟺  (−1p)=1\left(\frac2p\right)=1 \iff \left(\frac{-1}p\right)=1False correlationE.g. p=17≡1(mod8)p=17\equiv1\pmod8 and ≡1(mod4)\equiv1\pmod4 (both +1+1), but p=7≡3(mod4),≡7(mod8)p=7\equiv3\pmod4,\equiv7\pmod8 gives (−1/7)=−1,(2/7)=1(-1/7)=-1,(2/7)=1 — independent conditions

The mathematician behind it

Origins · 1 minCarl Friedrich Gauss and how this was discovered
CF
Carl Friedrich Gauss
1777–1855 · Göttingen, foundational work in number theory

Gauss gave the first fully rigorous proof of the Law of Quadratic Reciprocity in his Disquisitiones Arithmeticae (1801), eventually producing eight distinct proofs over his lifetime. The supplementary laws for −1-1 and 22 were known in special or conjectural form to Fermat and Euler earlier, but Gauss placed them on rigorous footing as part of his broader reciprocity program and introduced the lemma-based counting technique (Gauss's Lemma) used above.

History
- 1640: Fermat states (without full proof) results equivalent to the sum-of-two-squares theorem, implicitly using the first supplementary law.
- 1750s: Euler conjectures general quadratic reciprocity patterns and proves special cases, including versions of both supplementary laws.
- 1785: Legendre introduces the symbol (ap)\left(\frac{a}{p}\right) and states reciprocity, with an incomplete proof.
- 1801: Gauss publishes the Disquisitiones Arithmeticae, giving the first complete proof of reciprocity and the supplementary laws, introducing Gauss's Lemma.
- 1808: Gauss publishes further proofs, refining the Gauss's Lemma technique used to derive the second supplementary law.
Why do we need Euler's Criterion at all if Gauss's Lemma can handle any aa?

Gauss's Lemma works for any aa including a=−1a=-1, but Euler's Criterion gives a one-line proof for a=−1a=-1 specifically, since (−1)(p−1)/2∈{1,−1}(-1)^{(p-1)/2}\in\{1,-1\} is trivial to compute, whereas running Gauss's Lemma's counting argument for a=−1a=-1 requires tracking negative residues and is more cumbersome. Using the shortest correct tool for each case is standard practice: Euler's Criterion is optimal for −1-1, while Gauss's Lemma's residue-counting is the natural tool for 22, where there is no analogous instant algebraic shortcut. Both are legitimate; the choice reflects efficiency, not necessity.

Does knowing (−1p)\left(\frac{-1}{p}\right) and (2p)\left(\frac{2}{p}\right) let me compute (ap)\left(\frac{a}{p}\right) for any aa?

Not by themselves. These two laws only pin down the Legendre symbols of −1-1 and 22. To compute (ap)\left(\frac{a}{p}\right) for a general integer aa, factor aa into primes (and sign, and powers of 22), use multiplicativity of the Legendre symbol, apply the supplementary laws to the −1-1 and 22 parts, and apply the full Law of Quadratic Reciprocity to relate (qp)\left(\frac{q}{p}\right) to (pq)\left(\frac{p}{q}\right) for each odd prime factor qq of aa. The supplementary laws are indispensable pieces of that larger algorithm, not substitutes for it.

Is there a slicker way to remember the second supplementary law's condition p≡±1(mod8)p\equiv\pm1\pmod8?

Yes: note p2≡1(mod16)p^2 \equiv 1 \pmod{16} actually holds whenever p≡±1(mod8)p\equiv\pm1\pmod8 (and p2≡9(mod16)p^2\equiv 9\pmod{16} when p≡±3(mod8)p\equiv\pm3\pmod8), but the cleanest mnemonic is simply that ±1(mod8)\pm1\pmod8 are the two residue classes symmetric about 00 and 88, i.e. "closest to a multiple of 8," while ±3(mod8)\pm3\pmod 8 are "furthest." A common memory aid: 1,7(mod8)→21,7\pmod8 \to 2 is a QR; 3,5(mod8)→23,5\pmod8\to 2 is a NQR. Pairing 1↔71\leftrightarrow7 and 3↔53\leftrightarrow5 (each pair summing to 88) is the fastest way to recall the split.

Can both supplementary laws be derived as corollaries of the full quadratic reciprocity law instead?

The first supplementary law is genuinely independent and is proved directly from Euler's Criterion, as shown above; it is not a corollary of reciprocity between odd primes since reciprocity as usually stated concerns two odd primes, not −1-1. The second law, about the prime 22, is traditionally proved separately (via Gauss's Lemma, as here) precisely because 22 is excluded from the "two odd primes" reciprocity statement. In the "supplemented" formulation of reciprocity, these two laws together with the odd-prime-pair law form a complete package; none is logically downstream of the others.

What happens if p∤ap\nmid a fails, i.e. we ask about aa divisible by pp?

Then by convention (ap)=0\left(\frac{a}{p}\right)=0, and neither supplementary law applies since both are statements about −1-1 and 22 specifically as nonzero residues mod an odd prime pp not dividing them. Since pp is odd, p∤2p\nmid 2 automatically (as p≠2p\ne2), and p∤−1p\nmid -1 always, so this edge case never actually arises for the two specific values a=−1,2a=-1,2 under the hypothesis "pp is an odd prime" — it is only a concern if you try to generalize the laws' proof technique (Gauss's Lemma) to other values of aa that might share a factor with pp.

How do these laws relate to continued fractions and Pell's equation?

Whether 22 is a QR mod pp affects the factorization type of primes in Z[2]\mathbb{Z}[\sqrt2], the ring of integers relevant to the Pell equation x2−2y2=±1x^2-2y^2=\pm1. Primes p≡±1(mod8)p\equiv\pm1\pmod8 split in Z[2]\mathbb Z[\sqrt2], which is tied to the existence of nontrivial solutions and to periodicity phenomena in the continued fraction expansion of 2\sqrt2 modulo such primes. This is a preview connection into algebraic number theory and the theory of Sums of Two Squares and their real quadratic analogues, developed more fully once reciprocity is established in full generality.

Before this

Where this leads