Ring of integers

In mathematics, the ring of integers of an algebraic number field  is the ring of all integral elements contained in . An integral element is a root of a monic polynomial with integer coefficients, . This ring is often denoted by or formula_1. Since any integer belongs to  and is an integral element of , the ring  is always a subring of .
The ring of integers  is the simplest possible ring of integers. Namely, where is the field of rational numbers. And indeed, in algebraic number theory the elements of  are often called the "rational integers" because of this.
The next simplest example is the ring of Gaussian integers , consisting of complex numbers whose real and imaginary parts are integers. It is the ring of integers in the number field of complex numbers whose real and imaginary parts are rational numbers. Like the rational integers, it is a Euclidean domain. 
The ring of integers of an algebraic number field is the unique maximal order in the field. It is always a Dedekind domain.
Properties.
The ring of integers is a finitely-generated -module. Indeed, it is a free -module, and thus has an integral basis, that is a basis of the -vector space  such that each element  in can be uniquely represented as
with . The rank  of as a free -module is equal to the degree of  over .
Examples.
Computational tool.
A useful tool for computing the integral close of the ring of integers in an algebraic field is using the discriminant. If is of degree over , and formula_3 form a basis of over , set formula_4. Then, formula_5 is a submodule of the -module spanned by formula_6 pg. 33. In fact, if is square-free, then this forms an integral basis for formula_5 pg. 35.
Cyclotomic extensions.
If is a prime, is a th root of unity and is the corresponding cyclotomic field, then an integral basis of is given by .
Quadratic extensions.
If formula_8 is a square-free integer and formula_9 is the corresponding quadratic field, then formula_5 is a ring of quadratic integers and its integral basis is given by if and by if . This can be found by computing the minimal polynomial of an arbitrary element formula_11 where formula_12. 
Multiplicative structure.
In a ring of integers, every element has a factorization into irreducible elements, but the ring need not have the property of unique factorization: for example, in the ring of integers , the element 6 has two essentially different factorizations into irreducibles:
A ring of integers is always a Dedekind domain, and so has unique factorization of ideals into prime ideals.
The units of a ring of integers is a finitely generated abelian group by Dirichlet's unit theorem. The torsion subgroup consists of the roots of unity of . A set of torsion-free generators is called a set of "fundamental units".
Generalization.
One defines the ring of integers of a non-archimedean local field as the set of all elements of with absolute value ; this is a ring because of the strong triangle inequality. If is the completion of an algebraic number field, its ring of integers is the completion of the latter's ring of integers. The ring of integers of an algebraic number field may be characterised as the elements which are integers in every non-archimedean completion.
For example, the -adic integers are the ring of integers of the -adic numbers .