Algebraic integer (source code)

= Algebraic integer
{wiki}

An <algebraic number> $\alpha$ is an algebraic integer if it is a <polynomial root> of a <monic polynomial> with <integer> coefficients:
$$
\alpha^m+c_{m-1}\alpha^{m-1}+\cdots+c_0=0,\qquad m\ge1,\quad c_j\in\mathbb Z.
$$
Equivalently, its <algebraic minimal polynomial> over $\mathbb Q$ has <integer> coefficients. The requirement that the leading coefficient be one matters: $1/2$ satisfies $2X-1=0$ and is an <algebraic number>, but is not an algebraic integer. In fact the <rational numbers> that are algebraic integers are exactly the <integers>.https://www.jmilne.org/math/CourseNotes/ANT.pdf[Milne, Algebraic Number Theory, Chapter 2, integral elements]{ref}

Some useful computed examples are:

* $\sqrt2$ satisfies $X^2-2=0$.
* $1+\sqrt2$ satisfies $X^2-2X-1=0$.
* $\phi=(1+\sqrt5)/2$ satisfies $X^2-X-1=0$, although its displayed coefficients in the <basis> $1,\sqrt5$ are not <integers>.
* $\sqrt2/2$ has <algebraic minimal polynomial> $X^2-1/2$, so it is not an algebraic integer even though it satisfies $2X^2-1=0$.

Algebraic integers are closed under addition, subtraction, and multiplication. Thus they provide an arithmetic <ring>, while division is allowed only when the result is again an algebraic integer. The <algebraic integer module criterion> explains this closure without having to find a new <polynomial> for every sum and product.