MathLabs

Arithmetic and number theory

Number fields and rings of integers

Finite extensions of the rational numbers and the arithmetic of their integer elements.

IntuitionFrom integers to number fields: extending Q\mathbb Q

Take Q(2)={a+b2:a,b∈Q}\mathbb Q(\sqrt2)=\{a+b\sqrt2 : a,b\in\mathbb Q\}, the set of numbers built from rationals and 2\sqrt2. Among all these numbers, which ones deserve to be called "integers" — closed under addition, subtraction and multiplication, with no denominators hiding anywhere? The obvious guess, a,b∈Za,b\in\mathbb Z, turns out to be right for some fields and wrong for others: sometimes half-integer combinations like 1+52\tfrac{1+\sqrt5}2 are secretly integral too. Pinning down exactly which elements are integral in each field, and showing they form a ring, is the first step of algebraic number theory — without it, there is no way to talk about "prime factorization" inside KK.

Complex-domain visualization showing lattice points corresponding to the ring of integers of an imaginary quadratic field.
For d<0d<0, the elements of K=Q(d)K=\mathbb Q(\sqrt d) embed as points in the complex plane; the integers OK\mathcal O_K form a lattice, visible here as the tessellating grid of the complex domain.

UndergraduateDefinition: number fields and rings of integers

Definition: Number field, algebraic integer, ring of integers

A number field KK is a finite-degree field extension of Q\mathbb Q. An element α∈K\alpha\in K is an algebraic integer if it is a root of a monic polynomial with integer coefficients. The ring of integers OK\mathcal O_K is the set of all algebraic integers lying in KK; it is a subring of KK containing Z\mathbb Z.

K=Q(α)={a0+a1α+⋯+an−1αn−1:ai∈Q},n=[K:Q]K = \mathbb{Q}(\alpha) = \{a_0+a_1\alpha+\cdots+a_{n-1}\alpha^{n-1} : a_i \in \mathbb{Q}\}, \qquad n = [K:\mathbb Q]

The simplest nontrivial number fields are the quadratic fields K=Q(d)K=\mathbb Q(\sqrt d), where dd squarefree and d≠1d\neq1. For these, OK\mathcal O_K has one of exactly two explicit forms, depending only on d mod 4d\bmod4: either the "obvious" ring Z[d]\mathbb Z[\sqrt d], or the "half-integer" ring Z ⁣[1+d2]\mathbb Z\!\left[\dfrac{1+\sqrt d}{2}\right] with ω=1+d2\omega=\dfrac{1+\sqrt d}{2}. Which case occurs also fixes the field discriminant, which records the primes that ramify in KK.

OK={Z[d]d≡2,3(mod4)Z ⁣[1+d2]d≡1(mod4)\mathcal{O}_K = \begin{cases} \mathbb{Z}[\sqrt{d}] & d \equiv 2,3 \pmod 4 \\ \mathbb{Z}\!\left[\dfrac{1+\sqrt{d}}{2}\right] & d \equiv 1 \pmod 4 \end{cases}
OK\mathcal O_K depending on d mod 4d\bmod4
Propertyd≡2,3(mod4)d\equiv2,3\pmod4d≡1(mod4)d\equiv1\pmod4
Ring of integersZ[d]\mathbb Z[\sqrt d]Z ⁣[1+d2]\mathbb Z\!\left[\dfrac{1+\sqrt d}{2}\right]
Discriminant4d4ddd
Exampled=−1d=-1: Z[i]\mathbb Z[i], the Gaussian integersd=5d=5: Z[φ]\mathbb Z[\varphi], generated by the golden ratio φ=1+52\varphi=\dfrac{1+\sqrt5}{2}

UndergraduateFoundational theorems

Let dd be a squarefree integer, d≠1d\neq1, and K=Q(d)K=\mathbb Q(\sqrt d). Then OK=Z[d]\mathcal O_K=\mathbb Z[\sqrt d] if d≡2,3(mod4)d\equiv2,3\pmod4, and OK=Z ⁣[1+d2]\mathcal O_K=\mathbb Z\!\left[\dfrac{1+\sqrt d}2\right] if d≡1(mod4)d\equiv1\pmod4.

Why is it true?

Knowing exactly what the integers of KK are is the mandatory first step for doing arithmetic in KK: factoring elements or ideals, computing class groups, or deciding which primes ramify all require an honest description of OK\mathcal O_K, not the naive guess Z[d]\mathbb Z[\sqrt d], which is wrong exactly half the time.

Proof

Write α=a+bd\alpha=a+b\sqrt d with a,b∈Qa,b\in\mathbb Q. If b=0b=0, α=a∈Q\alpha=a\in\mathbb Q is an algebraic integer iff a∈Za\in\mathbb Z (rational root theorem), which is the case b=0b=0 of Z[d]\mathbb Z[\sqrt d]. If b≠0b\neq0, the minimal polynomial of α\alpha over Q\mathbb Q is x2−2ax+(a2−db2)x^2-2ax+(a^2-db^2) (its trace is 2a2a, its norm a2−db2a^2-db^2), so α\alpha is integral iff both 2a∈Z2a\in\mathbb Z and a2−db2∈Za^2-db^2\in\mathbb Z.

Write u=2a∈Zu=2a\in\mathbb Z. From a2−db2∈Za^2-db^2\in\mathbb Z, multiplying by 44 gives u2−4db2∈4Z⊂Zu^2-4db^2\in4\mathbb Z\subset\mathbb Z, so 4db2∈Z4db^2\in\mathbb Z. Write b=p/qb=p/q in lowest terms (gcd⁡(p,q)=1\gcd(p,q)=1); then 4db2=4dp2/q2∈Z4db^2=4dp^2/q^2\in\mathbb Z forces q2∣4dp2q^2\mid4dp^2, and since gcd⁡(p,q)=1\gcd(p,q)=1 this forces q2∣4dq^2\mid4d. Because dd is squarefree, the largest perfect square dividing 4d4d is at most 44, so q2∣4q^2\mid4, i.e. q∈{1,2}q\in\{1,2\}; either way v:=2b∈Zv:=2b\in\mathbb Z.

Now substitute u=2au=2a, v=2bv=2b (both integers) into a2−db2∈Za^2-db^2\in\mathbb Z: this becomes u2−dv24∈Z\tfrac{u^2-dv^2}{4}\in\mathbb Z, i.e. u2≡dv2(mod4)u^2\equiv dv^2\pmod4. Squares mod 44 are only 00 (even) or 11 (odd). If vv is even, dv2≡0(mod4)dv^2\equiv0\pmod4 forces uu even too (since u2u^2 odd would give 1≢01\not\equiv0); so u,vu,v both even, meaning a,b∈Za,b\in\mathbb Z — the "trivial" solution, always available, giving Z[d]⊆OK\mathbb Z[\sqrt d]\subseteq\mathcal O_K always.

If vv is odd, dv2≡d(mod4)dv^2\equiv d\pmod4 (since v2≡1v^2\equiv1), so we need u2≡d(mod4)u^2\equiv d\pmod4. If d≡2,3(mod4)d\equiv2,3\pmod4 (i.e. d≡2,3(mod4)d\equiv2,3\pmod4), no square u2∈{0,1}(mod4)u^2\in\{0,1\}\pmod4 can equal 22 or 3(mod4)3\pmod4, so this case is impossible — only the trivial u,vu,v both even survives, giving exactly OK=Z[d]\mathcal O_K=\mathbb Z[\sqrt d]. If instead d≡1(mod4)d\equiv1\pmod4 (d≡1(mod4)d\equiv1\pmod4), we need u2≡1(mod4)u^2\equiv1\pmod4, satisfied whenever uu is odd — and since vv is already odd, u≡v(mod2)u\equiv v\pmod2 is exactly the condition for α=u+vd2\alpha=\tfrac{u+v\sqrt d}2 with u,vu,v both odd, which is precisely Z+Z⋅1+d2\mathbb Z+\mathbb Z\cdot\tfrac{1+\sqrt d}2 (check: 1+d2\tfrac{1+\sqrt d}2 itself has u=v=1u=v=1, both odd), so in this case OK=Z ⁣[1+d2]\mathcal O_K=\mathbb Z\!\left[\tfrac{1+\sqrt d}2\right], strictly larger than Z[d]\mathbb Z[\sqrt d] (index 22).

In each of the two cases of Theorem 1, OK\mathcal O_K (as explicitly described there) is closed under addition and multiplication, so it is genuinely a subring of KK containing Z\mathbb Z.

Why is it true?

This is what justifies calling OK\mathcal O_K a ring of integers at all: without closure under multiplication in particular, one could not multiply two integers of KK and stay inside OK\mathcal O_K, which would make ring-theoretic arithmetic (factorization, ideals) impossible.

Proof

Case d≡2,3(mod4)d\equiv2,3\pmod4 (OK=Z[d]\mathcal O_K=\mathbb Z[\sqrt d], i.e. all elements a+bda+b\sqrt d with a,b∈Za,b\in\mathbb Z): addition is componentwise, (a+bd)+(c+ed)=(a+c)+(b+e)d(a+b\sqrt d)+(c+e\sqrt d)=(a+c)+(b+e)\sqrt d, clearly again of this form. For multiplication, (a+bd)(c+ed)=(ac+bed)+(ae+bc)d(a+b\sqrt d)(c+e\sqrt d)=(ac+bed)+(ae+bc)\sqrt d, and since a,b,c,e,d∈Za,b,c,e,d\in\mathbb Z, both ac+bedac+bed and ae+bcae+bc are integers, so the product stays in Z[d]\mathbb Z[\sqrt d].

Case d≡1(mod4)d\equiv1\pmod4 (OK=Z[ω]\mathcal O_K=\mathbb Z[\omega] with ω=1+d2\omega=\tfrac{1+\sqrt d}2): first compute ω2\omega^2 directly. ω2=(1+d2)2=1+2d+d4=1+d4+d2\omega^2=\left(\tfrac{1+\sqrt d}2\right)^2=\tfrac{1+2\sqrt d+d}4=\tfrac{1+d}4+\tfrac{\sqrt d}2. Since d=2ω−1\sqrt d=2\omega-1, this is 1+d4+ω−12=d−14+ω\tfrac{1+d}4+\omega-\tfrac12=\tfrac{d-1}4+\omega. Because d≡1(mod4)d\equiv1\pmod4, t:=d−14t:=\tfrac{d-1}4 is an integer, so ω2=t+ω\omega^2=t+\omega: a genuine integer relation showing ω\omega satisfies the monic integer polynomial x2−x−tx^2-x-t, confirming ω\omega itself is integral (as it must be, matching Theorem 1), and crucially expressing ω2\omega^2 again as an integer combination of 11 and ω\omega.

Now take general elements a+bωa+b\omega and c+eωc+e\omega with a,b,c,e∈Za,b,c,e\in\mathbb Z; addition is again componentwise and clearly closed. For the product, (a+bω)(c+eω)=ac+(ae+bc)ω+be ω2=ac+(ae+bc)ω+be(t+ω)=(ac+bet)+(ae+bc+be)ω(a+b\omega)(c+e\omega)=ac+(ae+bc)\omega+be\,\omega^2=ac+(ae+bc)\omega+be(t+\omega)=(ac+bet)+(ae+bc+be)\omega. Both coefficients ac+betac+bet and ae+bc+beae+bc+be are integers (products and sums of integers), so the product lies in Z+Zω=Z[ω]\mathbb Z+\mathbb Z\omega=\mathbb Z[\omega].

In both cases, closure under addition and multiplication is verified by direct, elementary computation, confirming OK\mathcal O_K is genuinely a subring of KK containing Z\mathbb Z in every quadratic field, exactly as the name "ring of integers" promises.

UndergraduateReal-World Applications and Worked Examples

The Gaussian integers Z[i]\mathbb Z[i] (d=−1d=-1) underlie fast algorithms for representing integers as sums of two squares and are used in digital signal processing and lattice-based error-correcting codes, where two-dimensional signal points are naturally indexed by Gaussian-integer coordinates. The ring Z[φ]\mathbb Z[\varphi] generated by the golden ratio φ=1+52\varphi=\dfrac{1+\sqrt5}{2} (d=5d=5) appears in materials science: quasicrystals with icosahedral symmetry (such as the Shechtman quasicrystal that won the 2011 Nobel Prize in Chemistry) are naturally modeled using Z[φ]\mathbb Z[\varphi]-module structures underlying Penrose-tiling-type constructions.

Example: Gaussian integers and sums of two squares

Confirm OK=Z[i]\mathcal O_K=\mathbb Z[i] for d=−1d=-1 via Theorem 1, then use the factorization 5=(2+i)(2−i)5=(2+i)(2-i) in Z[i]\mathbb Z[i] to recover the classical identity expressing 55 as a sum of two squares.

Solution

Here d=−1d=-1; since −1≡3(mod4)-1\equiv3\pmod4, this is case d≡2,3(mod4)d\equiv2,3\pmod4 of Theorem 1, so OK=Z[−1]=Z[i]=Z[i]\mathcal O_K=\mathbb Z[\sqrt{-1}]=\mathbb Z[i]=\mathbb Z[i], exactly the familiar Gaussian integers {a+bi:a,b∈Z}\{a+bi:a,b\in\mathbb Z\}.

Compute (2+i)(2−i)=4−i2=4−(−1)=5(2+i)(2-i)=4-i^2=4-(-1)=5, confirming 55 factors as a product of the two Gaussian integers 2+i2+i and 2−i2-i (each of norm N(2±i)=22+12=5N(2\pm i)=2^2+1^2=5, a rational prime, so each factor is itself irreducible in Z[i]\mathbb Z[i]).

Taking norms of both sides of 5=(2+i)(2−i)5=(2+i)(2-i) using N(a+bi)=a2+b2N(a+bi)=a^2+b^2 and multiplicativity N(αβ)=N(α)N(β)N(\alpha\beta)=N(\alpha)N(\beta): N(5)=25=N(2+i)N(2−i)=5×5N(5)=25=N(2+i)N(2-i)=5\times5, consistent. More directly, the factorization 5=(2+i)(2−i)5=(2+i)(2-i) is algebraically equivalent to the two-squares identity 5=22+125=2^2+1^2 — every rational prime p≡1(mod4)p\equiv1\pmod4 splits in Z[i]\mathbb Z[i] exactly because it can be written as a sum of two squares, a fact whose "why" is precisely this norm factorization in the ring of Gaussian integers.

Example: The golden ratio as a fundamental unit

Confirm OK=Z[φ]\mathcal O_K=\mathbb Z[\varphi] for d=5d=5 via Theorem 1, then compute the norm N(φ)N(\varphi) of the golden ratio φ=1+52\varphi=\dfrac{1+\sqrt5}{2} and explain why this makes φ\varphi a unit.

Solution

Here d=5≡1(mod4)d=5\equiv1\pmod4, so this is case d≡1(mod4)d\equiv1\pmod4 of Theorem 1: OK=Z ⁣[1+52]=Z[φ]\mathcal O_K=\mathbb Z\!\left[\tfrac{1+\sqrt5}2\right]=\mathbb Z[\varphi] with φ=1+52\varphi=\tfrac{1+\sqrt5}2, the golden ratio.

The conjugate of φ\varphi (swapping 5→−5\sqrt5\to-\sqrt5) is φ′=1−52\varphi'=\tfrac{1-\sqrt5}2. The norm is N(φ)=φφ′=(1+5)(1−5)4=1−54=−44=−1N(\varphi)=\varphi\varphi'=\tfrac{(1+\sqrt5)(1-\sqrt5)}4=\tfrac{1-5}4=\tfrac{-4}4=-1. So N(φ)=−1N(\varphi)=-1.

An algebraic integer α∈OK\alpha\in\mathcal O_K is a unit (invertible in OK\mathcal O_K, i.e. α−1∈OK\alpha^{-1}\in\mathcal O_K too) exactly when N(α)=±1N(\alpha)=\pm1, because the norm is multiplicative and N(α)N(α−1)=N(1)=1N(\alpha)N(\alpha^{-1})=N(1)=1 forces N(α)N(\alpha) to be a rational integer that divides 11. Since N(φ)=−1N(\varphi)=-1, φ\varphi is indeed a unit, and in fact its inverse is φ−1=−φ′=5−12=φ−1\varphi^{-1}=-\varphi'=\tfrac{\sqrt5-1}2=\varphi-1. Because φ>1\varphi>1, all its powers φn\varphi^n (n∈Zn\in\mathbb Z) are distinct units, so Z[φ]×\mathbb Z[\varphi]^\times is infinite — this single unit generates infinitely many solutions to the Pell-like equation x2−xy−y2=±1x^2-xy-y^2=\pm1, the same recurrence underlying the Fibonacci numbers.

For d=−1d=-1 (so −1≡3(mod4)-1\equiv3\pmod4), what is OK\mathcal O_K?

For d=5d=5 (so 5≡1(mod4)5\equiv1\pmod4), what is OK\mathcal O_K?

What is the norm N(φ)N(\varphi) of the golden ratio φ=1+52\varphi=\dfrac{1+\sqrt5}{2} in Q(5)\mathbb Q(\sqrt5)?

The ring Z[φ]\mathbb Z[\varphi] generated by the golden ratio naturally models which structure in materials science?

References

  1. J. Neukirch (1999). Algebraic Number Theory · DOI:10.1007/978-3-662-03983-0
  2. M. Bhargava (2005). The density of discriminants of quartic rings and fields · DOI:10.4007/annals.2005.162.1031
  3. The LMFDB Collaboration (2026). The L-functions and modular forms database (LMFDB)