When is the trace of an integral element of an algebra integral? Let $R$ be an integral domain, $K$ its field of fractions and $A$ a (unital, associative) $K$-algebra of finite dimension. Call $a \in A$ integral (over $R$) if it is a root of a monic polynomial with coefficients in $R$.

(When) does this imply that the trace of $a$ (trace of the linear map $x \mapsto ax$) lies in $R$?

It is certainly true if $R$ is a PID: take any finitely generated $R$-submodule $M \subset A$ that is stable by $a$ and generates $A$ over $K$. (E.g.: take any free $R$-submodule $N$ that generates $A$ over $K$ and take $M = R[a] N$.) Because $R$ is a PID, it is free, necessarily of rank $\dim_K A$ and one can then compute the trace of $A$ w.r.t. a basis of $M$.
In the general case, it would suffice to find a free $R$-submodule that is stable by $a$ and generates $A$ over $K$. I don't know if that exists.
 A: The trace of $a$ is always integral over $R$.
Indeed, pick any basis $\left(b_1,b_2,\ldots,b_n\right)$ of the finite-dimensional $K$-vector space $A$. Let $L_a : A \to A$ be the $K$-linear map sending each $b \in A$ to $ab$. This map $L_a$ is an endomorphism of the $K$-vector space $A$, and thus can be represented by a square matrix over $K$ (with respect to the basis $\left(b_1,b_2,\ldots,b_n\right)$). Let $M_a$ be this matrix. Of course, the trace of $a$ equals the trace of $L_a$ (by definition), which in turn equals the trace of $M_a$ (by definition).
The matrix $M_a$ is integral over $R$ (since the same monic polynomial over $R$ that annihilates $a$ will annihilate $L_a$ and thus annihilate $M_a$). It thus remains to prove that if a matrix over $K$ is integral over $R$, then so is its trace. But this is a particular case of Corollary 1.26 in


*

*Alberto Dennunzio, Enrico Formenti, Darij Grinberg, Luciano Margara, Integrality of matrices, finiteness of matrix semigroups, and dynamics of linear cellular automata, arXiv:1907.08565v1.

A: That’s not a complete answer, but it is fairly general, so worth writing. 
Let $R$ be a ring satisfying the following property: every monic divisor in $K[X]$ of a monic polynomial in $R[X]$ is in $R[X]$ (in particular, $R$ must be normal, and any UFD works). 
Then, consider, for some integral $x \in A$, the matrix $M$ of $a \in A \longmapsto ax$ in any basis. It is similar to a matrix $B$ diagonal by blocks, with the blocks being Frobenius matrices associated with monic divisors of the minimal polynomial of $x$, ie associated with monic divisors in $K[X]$ of a monic annihilating polynomial of $x$ in $R[X]$. 
As a consequence, by the property of $R$, $B$ has coefficients in $R$, and thus the trace of $x$, which is the trace of $M$, so the trace of $B$, is in $R$. 
