Quadratic Fields and the Gaussian Integers

⚡ Key Takeaways

Quadratic fields are degree-2 extensions Q(d)\mathbb{Q}(\sqrt{d}) of the rationals; the Gaussian integers Z[i]\mathbb{Z}[i] are the integers of the simplest imaginary one, Q(i)\mathbb{Q}(i). Key result: Z[i]\mathbb{Z}[i] is a Euclidean domain, hence a unique factorization domain, and its primes classify exactly which integers are sums of two squares. Applies across algebraic number theory, Diophantine equations, and cryptography. Foundational work by Gauss (1801, 1832), Dirichlet, and Dedekind (19th century).

💡 The Core Insight

Number-theoretic questions about Z\mathbb{Z} become transparent when lifted into a larger ring where rational primes can split. The prime 5=(2+i)(2−i)5 = (2+i)(2-i) factors in Z[i]\mathbb{Z}[i] precisely because 5≡1(mod4)5 \equiv 1 \pmod 4 and is a sum of two squares, 5=22+125 = 2^2 + 1^2. The behavior of a rational prime pp in OK\mathcal{O}_K—split, inert, or ramified—is the engine driving the entire theory, governed by quadratic reciprocity through the Legendre/Kronecker symbol.

Formal Statement

DefinitionQuadratic Field

For a squarefree integer d∉{0,1}d \notin \{0,1\}, the quadratic field is

1
K=Q(d)={ x+yd:x,y∈Q }.\quad K = \mathbb{Q}(\sqrt{d}) = \{\, x + y\sqrt{d} : x,y \in \mathbb{Q} \,\}.

Derivation hint: adjoin a root of the irreducible t2−dt^2 - d to Q\mathbb{Q}; the quotient Q[t]/(t2−d)\mathbb{Q}[t]/(t^2-d) is a field of degree 2. KK is real quadratic if d>0d>0 and imaginary quadratic if d<0d<0. The nontrivial Galois automorphism is conjugation σ(x+yd)=x−yd\sigma(x+y\sqrt d) = x - y\sqrt d.

DefinitionNorm and Trace

For α=x+yd∈K\alpha = x + y\sqrt d \in K, define the trace and norm by

2
Tr(α)=α+σ(α)=2x,N(α)=α σ(α)=x2−d y2.\quad \mathrm{Tr}(\alpha) = \alpha + \sigma(\alpha) = 2x, \qquad N(\alpha) = \alpha\,\sigma(\alpha) = x^2 - d\,y^2.

Derivation hint: these are the coefficients of the characteristic polynomial t2−Tr(α) t+N(α)t^2 - \mathrm{Tr}(\alpha)\,t + N(\alpha) of multiplication-by-α\alpha on the Q\mathbb{Q}-vector space KK. The norm is multiplicative: N(αβ)=N(α)N(β)N(\alpha\beta) = N(\alpha)N(\beta). For the Gaussian integers, N(a+bi)=a2+b2N(a+bi) = a^2 + b^2.

DefinitionRing of Integers

The ring of integers OK\mathcal{O}_K is the integral closure of Z\mathbb{Z} in KK—the set of α∈K\alpha\in K satisfying a monic polynomial with Z\mathbb{Z} coefficients. Explicitly,

3
OK={Z[d],d≡2,3(mod4),Z ⁣[1+d2],d≡1(mod4).\quad \mathcal{O}_K = \begin{cases} \mathbb{Z}[\sqrt d], & d \equiv 2,3 \pmod 4,\\[4pt] \mathbb{Z}\!\left[\tfrac{1+\sqrt d}{2}\right], & d \equiv 1 \pmod 4. \end{cases}

Derivation hint: α=x+yd\alpha = x+y\sqrt d is integral iff Tr(α)=2x∈Z\mathrm{Tr}(\alpha)=2x\in\mathbb{Z} and N(α)=x2−dy2∈ZN(\alpha)=x^2-dy^2\in\mathbb{Z}; analyzing parities of 2x,2y2x,2y modulo 4 yields the two cases.

TheoremDiscriminant

The discriminant of K=Q(d)K=\mathbb{Q}(\sqrt d) is

4
DK={d,d≡1(mod4),4d,d≡2,3(mod4).\quad D_K = \begin{cases} d, & d\equiv 1 \pmod 4,\\ 4d, & d\equiv 2,3 \pmod 4. \end{cases}

It satisfies DK≡0D_K \equiv 0 or 1(mod4)1 \pmod 4 and equals det⁡ ⁣(Tr(ωiωj))\det\!\big(\mathrm{Tr}(\omega_i\omega_j)\big) for any integral basis {ω1,ω2}\{\omega_1,\omega_2\}.

Derivation hint: compute the Gram matrix of traces Tr(ωiωj)\mathrm{Tr}(\omega_i\omega_j) for the integral basis from [3]; its determinant gives [4].

TheoremGaussian Integers are Euclidean

The ring Z[i]=OQ(i)\mathbb{Z}[i] = \mathcal{O}_{\mathbb{Q}(i)} is a Euclidean domain with respect to the norm N(a+bi)=a2+b2N(a+bi)=a^2+b^2. Consequently it is a principal ideal domain and a unique factorization domain. Its units are exactly {1,−1,i,−i}\{1,-1,i,-i\}, the elements of norm 1.

:::proof[Euclidean property of Z[i]\mathbb{Z}[i]] Step 1 — Goal. Given α,β∈Z[i]\alpha,\beta \in \mathbb{Z}[i] with β≠0\beta \neq 0, find q,r∈Z[i]q,r \in \mathbb{Z}[i] with α=qβ+r\alpha = q\beta + r and N(r)<N(β)N(r) < N(\beta).

Step 2 — Exact quotient. Compute in the field Q(i)\mathbb{Q}(i):

5
αβ=u+vi,u,v∈Q.\quad \frac{\alpha}{\beta} = u + vi, \qquad u,v \in \mathbb{Q}.

Derivation hint: rationalize αβˉ/(ββˉ)=αβˉ/N(β)\alpha\bar\beta / (\beta\bar\beta) = \alpha\bar\beta/N(\beta), splitting real and imaginary parts.

Step 3 — Round. Choose integers m,nm,n with ∣u−m∣≤12|u-m|\le \tfrac12 and ∣v−n∣≤12|v-n|\le\tfrac12, and set q=m+niq = m+ni, r=α−qβr = \alpha - q\beta.

Step 4 — Bound the remainder. Since r/β=(u−m)+(v−n)ir/\beta = (u-m)+(v-n)i,

6
N(r)=N(β) [(u−m)2+(v−n)2]≤N(β)(14+14)=12 N(β)<N(β).\quad N(r) = N(\beta)\,\big[(u-m)^2 + (v-n)^2\big] \le N(\beta)\left(\tfrac14 + \tfrac14\right) = \tfrac12\,N(\beta) < N(\beta).

Derivation hint: apply multiplicativity N(r)=N(β)N(r/β)N(r)=N(\beta)N(r/\beta) and bound each rounded coordinate by 12\tfrac12.

Step 5 — Conclude. The division algorithm holds, so Z[i]\mathbb{Z}[i] is Euclidean; the standard chain Euclidean ⇒\Rightarrow PID ⇒\Rightarrow UFD finishes the proof. ■\blacksquare

TheoremClassification of Gaussian Primes

Up to units, the primes of Z[i]\mathbb{Z}[i] are exactly:

  • 1+i1+i, the unique ramified prime above 22, with 2=−i(1+i)22 = -i(1+i)^2;
  • For rational primes p≡1(mod4)p \equiv 1 \pmod 4: two conjugate split primes π,πˉ\pi,\bar\pi with p=ππˉ=a2+b2p = \pi\bar\pi = a^2+b^2;
  • For rational primes p≡3(mod4)p \equiv 3 \pmod 4: pp itself remains inert (prime in Z[i]\mathbb{Z}[i]).

Derivation hint: a rational prime pp splits iff −1-1 is a quadratic residue mod pp, i.e. x2≡−1x^2\equiv -1 is solvable; by Euler's criterion this happens iff p≡1(mod4)p\equiv 1\pmod 4.

:::svg[Splitting of rational primes in the Gaussian integer lattice Z[i]\mathbb{Z}[i]] Re Im 2+i 2−i 5 = (2+i)(2−i) splits 1+i ramifies 3 stays inert (no lattice point of norm 3)

Why It Holds / Derivation

ProofSums of Two Squares from Gaussian Arithmetic

Step 1. A rational prime pp is a sum of two squares iff p=N(a+bi)p = N(a+bi) for some a+bi∈Z[i]a+bi\in\mathbb{Z}[i], iff pp is reducible (splits) in Z[i]\mathbb{Z}[i].

Step 2. pp splits iff the equation x2≡−1(modp)x^2 \equiv -1 \pmod p has a solution, since then p∣x2+1=(x+i)(x−i)p \mid x^2+1 = (x+i)(x-i) while p∤(x±i)p\nmid (x\pm i), so pp is not prime.

Step 3. By Euler's criterion,

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

Derivation hint: (−1)(p−1)/2(-1)^{(p-1)/2} records whether the order-2 element −1-1 lies in the squares of the cyclic group (Z/p)×(\mathbb{Z}/p)^\times.

Step 4 — Full count (Jacobi/Gauss). The number r2(n)r_2(n) of representations of nn as an ordered sum of two squares is

8
r2(n)=4∑d∣nχ(d),χ(d)={1d≡1 (4)−1d≡3 (4)0d≡0 (2).\quad r_2(n) = 4\sum_{d\mid n}\chi(d), \qquad \chi(d) = \begin{cases} 1 & d\equiv 1\,(4)\\ -1 & d\equiv 3\,(4)\\ 0 & d\equiv 0\,(2). \end{cases}

Derivation hint: count Gaussian integers of norm nn by factoring nn into Gaussian primes and tracking the four units; the divisor sum tracks split-prime exponents. ■\blacksquare

∎
mathematician · Carl Friedrich Gauss | 1777–1855

Gauss introduced the integers a+bia+bi in his 1832 memoir on biquadratic reciprocity, proving their unique factorization and using them to formulate the biquadratic reciprocity law—a problem he could not state cleanly within Z\mathbb{Z} alone. His 1801 Disquisitiones Arithmeticae had already developed the genus theory of binary quadratic forms, the form-theoretic shadow of quadratic field arithmetic. The "Gaussian integers" bear his name precisely because he recognized that enlarging the number system was the natural setting for reciprocity. Dedekind and Dirichlet later recast this form-language into the modern ideal-and-field framework.

Building Intuition

🧠 Intuition

Think of Z[i]\mathbb{Z}[i] as the square lattice in the complex plane, with the norm measuring squared distance to the origin. Euclidean division "rounds to the nearest lattice point," and the bound N(r)≤12N(β)N(r)\le \tfrac12 N(\beta) holds geometrically because any point in a unit cell is within distance 12\tfrac{1}{\sqrt2} of a corner. A rational prime pp either fragments into two lattice points (split), sits at a doubled lattice point (ramified, only p=2p=2), or remains atomic because no lattice point has norm pp (inert). The whole story of which primes are sums of two squares is just asking: does the circle of radius p\sqrt p pass through a lattice point?

Worked Examples

:::example[Factoring 65 in Z[i]\mathbb{Z}[i]] Given: 65=5⋅1365 = 5 \cdot 13, with 5≡15\equiv 1 and 13≡1(mod4)13\equiv 1 \pmod 4.

Step 1. 5=(2+i)(2−i)5 = (2+i)(2-i), since 22+12=52^2+1^2=5.

Step 2. 13=(3+2i)(3−2i)13 = (3+2i)(3-2i), since 32+22=133^2+2^2=13.

Step 3. Combine: 65=(2+i)(3+2i)⋅(2−i)(3−2i)65 = (2+i)(3+2i)\cdot(2-i)(3-2i). Compute (2+i)(3+2i)=6+4i+3i+2i2=4+7i(2+i)(3+2i) = 6+4i+3i+2i^2 = 4+7i, and (2+i)(3−2i)=6−4i+3i+2=8−i(2+i)(3-2i)=6-4i+3i+2 = 8-i.

Step 4. This yields the two essentially different representations

9
65=N(4+7i)=42+72,65=N(8−i)=82+12.\quad 65 = N(4+7i) = 4^2+7^2, \qquad 65 = N(8-i) = 8^2+1^2.

Derivation hint: distinct pairings of conjugate split primes give distinct norm-form representations. 65=42+72=82+12\boxed{65 = 4^2 + 7^2 = 8^2 + 1^2} (two representations, confirming r2r_2-style multiplicity).

ExampleComputing DKD_K and OK\mathcal{O}_K for Q(5)\mathbb{Q}(\sqrt{5})

Given: d=5d = 5, which is squarefree and 5≡1(mod4)5 \equiv 1 \pmod 4.

Step 1. By [3], OK=Z ⁣[1+52]\mathcal{O}_K = \mathbb{Z}\!\left[\frac{1+\sqrt5}{2}\right]. The generator ω=1+52\omega = \frac{1+\sqrt5}{2} (the golden ratio) is integral, satisfying ω2−ω−1=0\omega^2 - \omega - 1 = 0.

Step 2. By [4], since d≡1(mod4)d\equiv 1\pmod 4, the discriminant is DK=5D_K = 5.

Step 3. Check via the trace form on basis {1,ω}\{1,\omega\}: Tr(1)=2\mathrm{Tr}(1)=2, Tr(ω)=1\mathrm{Tr}(\omega)=1, Tr(ω2)=Tr(ω+1)=3\mathrm{Tr}(\omega^2)=\mathrm{Tr}(\omega+1)=3.

10
DK=det⁡(2113)=6−1=5.\quad D_K = \det\begin{pmatrix} 2 & 1\\ 1 & 3\end{pmatrix} = 6 - 1 = 5.

Derivation hint: the discriminant equals det⁡(Tr(ωiωj))\det(\mathrm{Tr}(\omega_i\omega_j)); entries are Tr(1⋅1),Tr(1⋅ω),Tr(ω⋅ω)\mathrm{Tr}(1\cdot 1),\mathrm{Tr}(1\cdot\omega),\mathrm{Tr}(\omega\cdot\omega). OK=Z[1+52], DK=5\boxed{\mathcal{O}_K = \mathbb{Z}[\tfrac{1+\sqrt5}{2}],\ D_K = 5}.

Common Misconceptions

⚠️ Common mistake

The ring of integers is NOT always Z[d]\mathbb{Z}[\sqrt d]. For d≡1(mod4)d\equiv 1\pmod 4 you must use the half-integer basis 1+d2\frac{1+\sqrt d}{2}. Using Z[5]\mathbb{Z}[\sqrt5] instead of Z[1+52]\mathbb{Z}[\frac{1+\sqrt5}{2}] gives an order of index 2, with wrong discriminant (2020 vs 55) and a non-maximal, badly-behaved ideal theory.

⚠️ Common mistake

Norm being prime is sufficient but not necessary for an element to be prime. If N(α)N(\alpha) is a rational prime then α\alpha is a Gaussian prime; but α=3\alpha=3 is a Gaussian prime with N(3)=9N(3)=9 composite. Inert primes have composite (square) norm.

CounterexampleUnique factorization can fail

In Z[−5]=OQ(−5)\mathbb{Z}[\sqrt{-5}] = \mathcal{O}_{\mathbb{Q}(\sqrt{-5})} (here −5≡3(mod4)-5\equiv 3\pmod 4 so this is the full ring of integers),

11
6=2⋅3=(1+−5)(1−−5),\quad 6 = 2\cdot 3 = (1+\sqrt{-5})(1-\sqrt{-5}),

and all four factors are irreducible and non-associate, with norms 4,9,6,64,9,6,6. Derivation hint: check no element has norm 2 or 3 (i.e. a2+5b2∈{2,3}a^2+5b^2\in\{2,3\} is insoluble), so the factors cannot be split further or matched up. The class number is h(Q(−5))=2>1h(\mathbb{Q}(\sqrt{-5}))=2 > 1, measuring exactly this failure. Unlike Z[i]\mathbb{Z}[i], this ring is a Dedekind domain but not a PID—ideals still factor uniquely even though elements do not.

Connections

connection

Quadratic fields are the degree-2 case of Algebraic Number Fields, and their integers are the simplest Dedekind Domains where Unique Factorization of Ideals replaces element factorization. The split/inert/ramified trichotomy is governed by Quadratic Reciprocity through the Kronecker symbol (DKp)\left(\frac{D_K}{p}\right). The failure of unique factorization is measured by the Ideal Class Group, whose order is the class number hh, and the structure of units in real quadratic fields is the content of Dirichlet's Unit Theorem and the Pell Equation. Imaginary quadratic fields connect to Complex Multiplication and the theory of elliptic curves with CM.

Real-World Applications

🔬 Where this appears

Historical Development

⏳ History
- 1640 — Fermat states (in a letter to Mersenne) that every prime p≡1(mod4)p\equiv 1\pmod 4 is a sum of two squares, without published proof.
- 1749–1770 — Euler proves Fermat's two-square theorem and develops infinite descent and quadratic residue tools.
- 1798 — Legendre formulates quadratic reciprocity (with an incomplete proof) and the Legendre symbol.
- 1801 — Gauss publishes Disquisitiones Arithmeticae, giving the first complete proofs of quadratic reciprocity and the genus theory of binary quadratic forms.
- 1832 — Gauss introduces Z[i]\mathbb{Z}[i] to state biquadratic reciprocity, proving its unique factorization.
- 1840s — Dirichlet proves the unit theorem and the class number formula for quadratic forms; Eisenstein develops Z[ω]\mathbb{Z}[\omega] for cubic reciprocity.
- 1846–1871 — Kummer's ideal numbers (for cyclotomic fields) inspire Dedekind's general theory.
- 1871 — Dedekind defines ideals and integral closure, recasting quadratic-field arithmetic as the theory of Dedekind domains in his supplements to Dirichlet's lectures.
- 1900s — Hilbert's Zahlbericht and class field theory systematize quadratic fields as the genesis of all abelian extension theory.

Subtleties & Limits

open-problem

Class number problems remain partly open. Gauss conjectured (proved by Heilbronn 1934, effectivized by Baker–Stark 1966) that there are exactly nine imaginary quadratic fields with class number 1: d=−1,−2,−3,−7,−11,−19,−43,−67,−163d = -1,-2,-3,-7,-11,-19,-43,-67,-163. By contrast, it is still unknown whether infinitely many real quadratic fields have class number 1—the Gauss class number 1 problem for real fields is open. The Cohen–Lenstra heuristics predict that roughly 75.4%75.4\% of real quadratic fields are principal, but no proof exists. Effective bounds on class numbers and the precise distribution of split versus inert primes (linked to the Generalized Riemann Hypothesis through L(1,χ)L(1,\chi)) remain active frontiers.

See Also

Algebraic Number Fields · Quadratic Reciprocity · Dedekind Domains · Ideal Class Group · Pell Equation · Eisenstein Integers · Binary Quadratic Forms · Sums of Two Squares