Solution (source code)

= Solution

Let $c_1,\ldots,c_d$ be the coefficients of $f$. Each is an <algebraic integer>. The ring $R=\mathbb Z[c_1,\ldots,c_d]$ is a finitely generated $\mathbb Z$-module: reduce powers of each generator by its monic integral equation. As $f$ is monic, $R[\alpha]$ is generated over $R$ by $1,\alpha,\ldots,\alpha^{d-1}$, so is a finite $\mathbb Z$-module. It is torsion-free as a subgroup of a characteristic-zero field, hence free of finite rank. Multiplication by $\alpha$ on it is represented by an integer <matrix>. Its monic <characteristic polynomial>, by <Cayley-Hamilton theorem>, annihilates $\alpha$. Thus \b[$\alpha$ is an <algebraic integer>]. This proves the required transitivity of integrality in this setting.

Every root of the monic $h$ is also a root of the monic <polynomial> $h^n\in\mathcal O_K[x]$, and is therefore an <algebraic integer>. The coefficients of $h$ are elementary symmetric <polynomials> in these roots, hence <algebraic integers> because <algebraic integers> form a ring. They also belong to $K$, so belong to $\mathcal O_K$. Consequently \b[$h\in\mathcal O_K[x]$].