# Ring of integers

In algebraic number theory, the **ring of integers** of a number field \( K \) is the subring \( \mathcal{O}_K \) consisting of the elements of \( K \) that are roots of monic polynomials with integer coefficients; equivalently, after fixing an embedding of \( K \) into an algebraic closure \( \overline{\mathbb{Q}} \), it is the intersection \( K \cap \overline{\mathbb{Z}} \), where \( \overline{\mathbb{Z}} \) is the ring of all algebraic integers.<sup>[1](https://wstein.org/books/ant/ant/node13.html)</sup> A number field is a field containing \( \mathbb{Q} \) of finite degree over \( \mathbb{Q} \).<sup>[1](https://wstein.org/books/ant/ant/node13.html)</sup> The ring of integers generalizes the ordinary integers \( \mathbb{Z} \) inside \( \mathbb{Q} \) and is the central object in which the arithmetic of \( K \) is studied.

| Key fact | Detail |
|---|---|
| Definition | \( \mathcal{O}_K = \{ x \in K : x \text{ satisfies a monic polynomial with integer coefficients} \} \), equal to \( K \cap \overline{\mathbb{Z}} \)<sup>[1](https://wstein.org/books/ant/ant/node13.html)</sup> |
| Basic examples | \( \mathcal{O}_{\mathbb{Q}} = \mathbb{Z} \); \( \mathcal{O}_{\mathbb{Q}(i)} = \mathbb{Z}[i] \); \( \mathcal{O}_{\mathbb{Q}(\sqrt{5})} = \mathbb{Z}[(1+\sqrt{5})/2] \)<sup>[1](https://wstein.org/books/ant/ant/node13.html)</sup> |
| Quadratic case | For squarefree \( d \ne 1 \), \( \mathcal{O}_{\mathbb{Q}(\sqrt{d})} = \mathbb{Z}[(1+\sqrt{d})/2] \) if \( d \equiv 1 \bmod 4 \), and \( \mathbb{Z}[\sqrt{d}] \) if \( d \equiv 2, 3 \bmod 4 \)<sup>[2](https://www.math.ucla.edu/~sharifi/notes/algnum-ch01.html)</sup> |
| Structural theorem | \( \mathcal{O}_K \) is a Dedekind domain: Noetherian, integrally closed, and every nonzero prime ideal is maximal<sup>[3](https://www.maths.tcd.ie/~mascotn/teaching/2022/MAU34109/Poly.pdf)</sup> |
| Factorization | Elements need not factor uniquely, but every ideal of \( \mathcal{O}_K \) factors uniquely into prime ideals<sup>[4](https://crypto.stanford.edu/pbc/notes/numberfield/unique.html)</sup><sup> • </sup><sup>[3](https://www.maths.tcd.ie/~mascotn/teaching/2022/MAU34109/Poly.pdf)</sup> |
| Orders | Any subring \( R \subset \mathcal{O}_K \) of finite index is an order; \( \mathcal{O}_K \) itself is called the maximal order<sup>[1](https://wstein.org/books/ant/ant/node13.html)</sup><sup> • </sup><sup>[5](https://www.math.ucla.edu/~sharifi/notes/algnum-ch02.html)</sup> |
| Computation | Computing \( \mathcal{O}_K \) is one of the main tasks of computational algebraic number theory; PARI/GP uses the round 4 algorithm, and Lean 4 formalizations now certify integral bases from the LMFDB database<sup>[6](https://arxiv.org/abs/2409.18030)</sup> |

## Algebraic integers

An **algebraic integer** is an element \( \alpha \in \overline{\mathbb{Q}} \) that is a root of some monic polynomial with coefficients in \( \mathbb{Z} \); one says \( \alpha \) is integral over \( \mathbb{Z} \).<sup>[7](https://wstein.org/books/ant/ant/Ch2.html)</sup> For example, \( \sqrt{2} \) is an algebraic integer because it is a root of \( x^2 - 2 \), while \( 1/2 \) is not.<sup>[7](https://wstein.org/books/ant/ant/Ch2.html)</sup> An element is an algebraic integer if and only if \( \mathbb{Z}[\alpha] \) is finitely generated as a \( \mathbb{Z} \)-module, and if and only if its minimal polynomial over \( \mathbb{Q} \) has integer coefficients.<sup>[7](https://wstein.org/books/ant/ant/Ch2.html)</sup>

The algebraic integers form a ring: if \( \alpha \) and \( \beta \) are algebraic integers, so are \( \alpha + \beta \) and \( \alpha\beta \), because \( \mathbb{Z}[\alpha, \beta] \) is spanned as a \( \mathbb{Z} \)-module by the products \( \alpha^i \beta^j \) for \( 0 \le i < m \) and \( 0 \le j < n \), where \( m \) and \( n \) are the degrees of monic integer polynomials vanishing at \( \alpha \) and \( \beta \).<sup>[7](https://wstein.org/books/ant/ant/Ch2.html)</sup> This ring \( \overline{\mathbb{Z}} \) is the integral closure of \( \mathbb{Z} \) inside \( \mathbb{C} \), and its field of fractions is \( \overline{\mathbb{Q}} \): every algebraic number can be written as a fraction of two algebraic integers.<sup>[2](https://www.math.ucla.edu/~sharifi/notes/algnum-ch01.html)</sup>

The definition is subtler than it looks. The golden ratio \( (1+\sqrt{5})/2 \) is an algebraic integer, since it satisfies \( x^2 - x - 1 \), even though it is written with a denominator.<sup>[7](https://wstein.org/books/ant/ant/Ch2.html)</sup> Within \( \mathbb{Q} \) itself, the only algebraic integers are the ordinary integers \( \mathbb{Z} \).<sup>[7](https://wstein.org/books/ant/ant/Ch2.html)</sup>

## The ring of integers of a number field

For a number field \( K \), the ring of integers \( \mathcal{O}_K \) is the integral closure of \( \mathbb{Z} \) in \( K \).<sup>[2](https://www.math.ucla.edu/~sharifi/notes/algnum-ch01.html)</sup> It satisfies \( \mathcal{O}_K \cap \mathbb{Q} = \mathbb{Z} \) and \( \mathbb{Q}\mathcal{O}_K = K \), so every element of \( K \) is a rational multiple of an algebraic integer.<sup>[1](https://wstein.org/books/ant/ant/node13.html)</sup>

**Quadratic fields.** The prototypical examples are quadratic fields \( \mathbb{Q}(\sqrt{d}) \) for squarefree integers \( d \ne 1 \). The ring of integers is \( \mathbb{Z}[(1+\sqrt{d})/2] \) when \( d \equiv 1 \bmod 4 \) and \( \mathbb{Z}[\sqrt{d}] \) when \( d \equiv 2, 3 \bmod 4 \).<sup>[2](https://www.math.ucla.edu/~sharifi/notes/algnum-ch01.html)</sup> Thus \( \mathbb{Q}(\sqrt{2}) \) has ring of integers \( \mathbb{Z}[\sqrt{2}] \) with discriminant 8, while \( \mathbb{Q}(\sqrt{5}) \) has ring of integers \( \mathbb{Z}[(1+\sqrt{5})/2] \) with discriminant 5.<sup>[3](https://www.maths.tcd.ie/~mascotn/teaching/2022/MAU34109/Poly.pdf)</sup>

**Cyclotomic fields.** If \( \zeta \) is a primitive \( n \)th root of unity, the cyclotomic field \( \mathbb{Q}(\zeta) \) has ring of integers \( \mathbb{Z}[\zeta] \).<sup>[3](https://www.maths.tcd.ie/~mascotn/teaching/2022/MAU34109/Poly.pdf)</sup>

**Non-monogenic examples.** The ring of integers is not always generated by a single element over \( \mathbb{Z} \). The field \( \mathbb{Q}(\sqrt[3]{9}) \) has ring of integers \( \mathbb{Z}[\sqrt[3]{3}] \), where \( \sqrt[3]{3} = \frac{1}{3}(\sqrt[3]{9})^2 \), so the obvious generator does not suffice.<sup>[1](https://wstein.org/books/ant/ant/node13.html)</sup> SageMath's documentation computes a cubic field, defined by \( x^3 + x^2 - 2x + 8 \), in which 2 is an "essential discriminant divisor" and the ring of integers has integral basis \( [1, \tfrac{1}{2}a^2 + \tfrac{1}{2}a, a^2] \), not generated by one element.<sup>[8](https://doc.sagemath.org/html/en/reference/number_fields/sage/rings/number_field/number_field.html)</sup>

## Dedekind domains and unique factorization of ideals

The ring \( \mathcal{O}_K \) is a **Dedekind domain**: it is Noetherian, integrally closed, and every nonzero prime ideal is maximal.<sup>[3](https://www.maths.tcd.ie/~mascotn/teaching/2022/MAU34109/Poly.pdf)</sup> The Noetherian property follows because the norms of an increasing chain of ideals form a nondecreasing sequence of positive integers, which must stabilize; the maximality of nonzero primes follows because the quotient \( \mathcal{O}_K/\mathfrak{p} \) is a finite domain, hence a field.<sup>[3](https://www.maths.tcd.ie/~mascotn/teaching/2022/MAU34109/Poly.pdf)</sup>

Unique factorization of elements can fail. In \( \mathbb{Z}[\sqrt{-5}] \), the ring of integers of \( \mathbb{Q}(\sqrt{-5}) \), the number 6 has two genuinely distinct factorizations into irreducibles, \( 6 = 2 \cdot 3 = (1+\sqrt{-5})(1-\sqrt{-5}) \).<sup>[3](https://www.maths.tcd.ie/~mascotn/teaching/2022/MAU34109/Poly.pdf)</sup> The failure is repaired at the level of ideals: every ideal in a [Dedekind domain](https://www.edgepedia.org/dedekind-domain) is uniquely representable as a product of prime ideals, and since every number ring is a Dedekind domain, ideals in \( \mathcal{O}_K \) factor uniquely into prime ideals.<sup>[4](https://crypto.stanford.edu/pbc/notes/numberfield/unique.html)</sup> The extent of the failure is measured by the ideal class group, the quotient of the group of fractional ideals by the principal fractional ideals.<sup>[9](https://wstein.org/books/ant/ant/Ch3.html)</sup>

## Orders and the maximal order

An **order** in \( \mathcal{O}_K \) is any subring \( R \) of \( \mathcal{O}_K \) such that the quotient \( \mathcal{O}_K/R \) of abelian groups is finite.<sup>[1](https://wstein.org/books/ant/ant/node13.html)</sup> For example, \( \mathbb{Z} + ni\mathbb{Z} \) is an order in \( \mathbb{Z}[i] \) for every nonzero integer \( n \), while \( \mathbb{Z} \) itself is not, because it has infinite index in \( \mathbb{Z}[i] \).<sup>[1](https://wstein.org/books/ant/ant/node13.html)</sup> If \( K = \mathbb{Q}(\alpha) \) with \( \alpha \) an algebraic integer, then \( \mathbb{Z}[\alpha] \) is an order, but frequently \( \mathbb{Z}[\alpha] \ne \mathcal{O}_K \); in one worked example the index \( [\mathcal{O}_K : \mathbb{Z}[a]] \) equals \( 2197 = 13^3 \).<sup>[1](https://wstein.org/books/ant/ant/node13.html)</sup>

Because \( \mathcal{O}_K \) contains every order, it is often called the **maximal order** of \( K \).<sup>[5](https://www.math.ucla.edu/~sharifi/notes/algnum-ch02.html)</sup> Orders are Noetherian and have all nonzero prime ideals maximal, but they are not integrally closed, so they are not Dedekind domains.<sup>[3](https://www.maths.tcd.ie/~mascotn/teaching/2022/MAU34109/Poly.pdf)</sup> The discriminants of an order \( R \) and the maximal order are related by \( \mathrm{disc}(R) = [\mathcal{O}_K : R]^2 \, \mathrm{disc}(\mathcal{O}_K) \); consequently, if \( \mathrm{disc}(R) \) is squarefree, then \( R = \mathcal{O}_K \).<sup>[5](https://www.math.ucla.edu/~sharifi/notes/algnum-ch02.html)</sup>

## History

The theory of rings of integers grew out of attempts to rescue unique factorization. Ernst Kummer, studying \( \mathbb{Z}[\zeta] \) for roots of unity \( \zeta \) in his work on [Fermat's Last Theorem](https://www.edgepedia.org/fermats-last-theorem), introduced "ideal numbers" to restore a form of unique factorization, and proved the theorem for what are now called regular primes.<sup>[10](https://www.math.utoronto.ca/~ila/ANTBook.pdf)</sup><sup> • </sup><sup>[11](https://www.math.mcgill.ca/darmon/courses/history/katz.pdf)</sup> [Richard Dedekind](https://www.edgepedia.org/richard-dedekind), mathematician at [Braunschweig](https://www.edgepedia.org/braunschweig) and editor of Dirichlet's *Vorlesungen über Zahlentheorie*, replaced Kummer's ideal numbers by set-theoretic ideals, first presented in his 1871 supplement to that work, and formulated his theory in the ring of integers of a number field.<sup>[12](https://plato.stanford.edu/entries/dedekind-foundations/)</sup><sup> • </sup><sup>[13](https://mathshistory.st-andrews.ac.uk/Biographies/Dedekind/)</sup> Dedekind's notion of ideal was taken up by Hilbert and Emmy Noether, generalizing unique factorization of integers into primes to ideals in other rings.<sup>[13](https://mathshistory.st-andrews.ac.uk/Biographies/Dedekind/)</sup>

## Computation

Computing \( \mathcal{O}_K \) for an explicitly given field is one of the main tasks of [computational algebraic number theory](https://www.edgepedia.org/computational-algebraic-number-theory).<sup>[6](https://arxiv.org/abs/2409.18030)</sup> Given a defining polynomial \( T \), the subring \( \mathbb{Z}[X]/(T) \) is an order, and the task is to enlarge it to the maximal order; PARI/GP's `nfbasis` function does this with a modified version of the round 4 algorithm due to David Ford, Sebastian Pauli, and Xavier Roblot, and obtaining the maximal order is hard in general because it requires factoring the discriminant of \( T \).<sup>[14](https://pari.math.u-bordeaux.fr/pub/pari/manuals/2.13.3/users.pdf)</sup> Databases such as the [LMFDB](https://www.edgepedia.org/lmfdb) record an integral basis, a \( \mathbb{Z} \)-basis of \( \mathcal{O}_K \), for each stored number field, together with the discriminant.<sup>[15](https://www.lmfdb.org/NumberField/3.3.1573.1)</sup> Recent work by Anne Baanen, Alain Chavarri Villarello, and Sander R. Dahmen formalizes these computations in the Lean 4 proof assistant: SageMath produces a certificate that Lean checks, verifying integral bases for number fields of degree up to 8 and hundreds of LMFDB entries for discriminants, class numbers, and class groups.<sup>[6](https://arxiv.org/abs/2409.18030)</sup><sup> • </sup><sup>[16](https://arxiv.org/abs/2607.26230)</sup>

## References

1. [William Stein, *Algebraic Number Theory, a Computational Approach*, Chapter 2, Rings of Algebraic Integers](https://wstein.org/books/ant/ant/node13.html)
2. [Romyar Sharifi, *Algebraic Number Theory*, Chapter 1, Abstract algebra](https://www.math.ucla.edu/~sharifi/notes/algnum-ch01.html)
3. [Nicolás Mascot, Math 345 Algebraic Number Theory lecture notes, Trinity College Dublin](https://www.maths.tcd.ie/~mascotn/teaching/2022/MAU34109/Poly.pdf)
4. [Unique Factorization of Ideals, Stanford lecture notes](https://crypto.stanford.edu/pbc/notes/numberfield/unique.html)
5. [Romyar Sharifi, *Algebraic Number Theory*, Chapter 2, Dedekind domains](https://www.math.ucla.edu/~sharifi/notes/algnum-ch02.html)
6. [Anne Baanen, Alain Chavarri Villarello, Sander R. Dahmen (2024). Certifying rings of integers in number fields. arXiv:2409.18030](https://arxiv.org/abs/2409.18030)
7. [William Stein, *Algebraic Number Theory, a Computational Approach*, Chapter 2, Basic Commutative Algebra](https://wstein.org/books/ant/ant/Ch2.html)
8. [SageMath documentation, Number fields: integral_basis](https://doc.sagemath.org/html/en/reference/number_fields/sage/rings/number_field/number_field.html)
9. [William Stein, *Algebraic Number Theory, a Computational Approach*, Chapter 3, Unique Factorization of Ideals](https://wstein.org/books/ant/ant/Ch3.html)
10. [Ila Varma et al., *Algebraic Number Theory* course notes, University of Toronto](https://www.math.utoronto.ca/~ila/ANTBook.pdf)
11. [Katz, *A history of mathematics* (course notes, McGill University)](https://www.math.mcgill.ca/darmon/courses/history/katz.pdf)
12. [Dedekind's Contributions to the Foundations of Mathematics, Stanford Encyclopedia of Philosophy](https://plato.stanford.edu/entries/dedekind-foundations/)
13. [Richard Dedekind (1831–1916), MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk/Biographies/Dedekind/)
14. [PARI/GP User's Guide, version 2.13.3, section on nfbasis](https://pari.math.u-bordeaux.fr/pub/pari/manuals/2.13.3/users.pdf)
15. [LMFDB, Number field 3.3.1573.1](https://www.lmfdb.org/NumberField/3.3.1573.1)
16. [Alain Chavarri Villarello, Sander R. Dahmen. Formally certifying number field invariants. arXiv:2607.26230](https://arxiv.org/abs/2607.26230)

---
*Topic: Encyclopedia › Physical world and mathematics › Mathematics and statistics › Numbers and algebra › Algebraic structures › Ring theory › Factorization and orders › Orders in rings and rings of integers*

*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license
