TheoremComplete

Quadratic Residues and Reciprocity - Applications

The theory of quadratic residues has far-reaching applications in solving Diophantine equations, primality testing, and understanding the factorization of primes in algebraic number fields. These applications demonstrate the power of quadratic reciprocity.

TheoremPrimes of the Form $x^2 + ny^2$

Quadratic reciprocity determines which primes can be represented as x2+ny2x^2 + ny^2 for various nn. For example:

  • x2+y2x^2 + y^2: An odd prime pp can be written as x2+y2x^2 + y^2 if and only if p1(mod4)p \equiv 1 \pmod{4}.
  • x2+2y2x^2 + 2y^2: A prime p>2p > 2 can be written as x2+2y2x^2 + 2y^2 if and only if p1,3(mod8)p \equiv 1, 3 \pmod{8}.
  • x2+3y2x^2 + 3y^2: A prime p>3p > 3 can be written as x2+3y2x^2 + 3y^2 if and only if p1(mod3)p \equiv 1 \pmod{3}.

These results connect quadratic forms with prime factorization in quadratic number fields, a central theme in algebraic number theory.

ExamplePrimes as Sums of Two Squares

The theorem predicts:

  • 5=12+225 = 1^2 + 2^2 (since 51(mod4)5 \equiv 1 \pmod{4})
  • 13=22+3213 = 2^2 + 3^2 (since 131(mod4)13 \equiv 1 \pmod{4})
  • 17=12+4217 = 1^2 + 4^2 (since 171(mod4)17 \equiv 1 \pmod{4})

But 77 and 1111 (both 3(mod4)\equiv 3 \pmod{4}) cannot be written as sums of two squares.

This is connected to the factorization in Z[i]\mathbb{Z}[i]: primes p1(mod4)p \equiv 1 \pmod{4} split in Z[i]\mathbb{Z}[i], while primes p3(mod4)p \equiv 3 \pmod{4} remain prime.

TheoremTonelli-Shanks Algorithm

Given a prime pp and a quadratic residue aa modulo pp (i.e., (ap)=1\left(\frac{a}{p}\right) = 1), the Tonelli-Shanks algorithm efficiently computes a solution to x2a(modp)x^2 \equiv a \pmod{p} in expected polynomial time.

The algorithm runs in O(log2ploglogp)O(\log^2 p \cdot \log \log p) time when implemented with fast arithmetic.

This algorithm is crucial for elliptic curve cryptography, where we frequently need to extract square roots modulo large primes.

ExampleSquare Root Extraction

Find xx such that x25(mod11)x^2 \equiv 5 \pmod{11}.

We know (511)=1\left(\frac{5}{11}\right) = 1, so a solution exists. For p3(mod4)p \equiv 3 \pmod{4} (like p=11p = 11), the solution is particularly simple: xa(p+1)/45(11+1)/4=53=1254(mod11)x \equiv a^{(p+1)/4} \equiv 5^{(11+1)/4} = 5^3 = 125 \equiv 4 \pmod{11}

Verification: 42=165(mod11)4^2 = 16 \equiv 5 \pmod{11}. ✓

The other solution is 47(mod11)-4 \equiv 7 \pmod{11}.

TheoremQuadratic Reciprocity and Prime Factorization

Let pp be an odd prime and consider the quadratic field Q(d)\mathbb{Q}(\sqrt{d}) where dd is squarefree. The prime pp splits, remains prime, or ramifies in Z[d]\mathbb{Z}[\sqrt{d}] according to:

  • Splits: pp factors as p=ππˉp = \pi \bar{\pi} if (dp)=1\left(\frac{d}{p}\right) = 1
  • Inert: pp remains prime if (dp)=1\left(\frac{d}{p}\right) = -1
  • Ramifies: pp divides dd if (dp)=0\left(\frac{d}{p}\right) = 0

This connection between quadratic residues and prime factorization in number fields is fundamental to algebraic number theory.

ExampleFactorization in $\mathbb{Z}[\sqrt{-5}]$

In Z[5]\mathbb{Z}[\sqrt{-5}], consider the prime 33:

We check (53)=(13)(53)=(1)(23)=(1)(1)=1\left(\frac{-5}{3}\right) = \left(\frac{-1}{3}\right)\left(\frac{5}{3}\right) = (-1)\left(\frac{2}{3}\right) = (-1)(-1) = 1.

So 33 splits: 3=(2+5)(25)3 = (2 + \sqrt{-5})(2 - \sqrt{-5}) in Z[5]\mathbb{Z}[\sqrt{-5}].

For 77: (57)=(27)=1\left(\frac{-5}{7}\right) = \left(\frac{2}{7}\right) = 1, so 77 also splits.

For 1313: (513)=(813)=(2313)=1\left(\frac{-5}{13}\right) = \left(\frac{8}{13}\right) = \left(\frac{2^3}{13}\right) = 1, so 1313 splits as well.

Remark

The Solovay-Strassen primality test uses the Jacobi symbol: for odd composite nn, at least half of all bases aa with gcd(a,n)=1\gcd(a, n) = 1 satisfy: a(n1)/2≢(an)(modn)a^{(n-1)/2} \not\equiv \left(\frac{a}{n}\right) \pmod{n}

This provides a probabilistic primality test running in polynomial time.

These applications show how quadratic residues connect pure number theory with computational algorithms and algebraic structures.