Polynomials in matrices with integer entries I'm looking for references, if there is any, for this problem:
Characterize all elements $a \in M_n(\mathbb{Z})$ for which we have $\mathbb{Q}[a] \cap M_n(\mathbb{Z})=\mathbb{Z}[a].$ 
Here, by $C[a]$ I mean the ring of polynomials in $a$ with coefficients in a ring $C.$   
Thank you
 A: Let $n\times n$ integer matrix $a \notin \mathbb{Z}[I]$ have (monic) minimal polynomial $f(x) \in \mathbb{Z}[x]$ of degree $d$.
Construct a $d\times n^2$ matrix $P$ containing the entries of $\{I,a,..,a^{d-1}\}$ expressed as consecutive rows.
Claim: $\mathbb{Q}[a] \cap M_n(\mathbb{Z})=\mathbb{Z}[a]$ if and only if the elementary divisors of (the Smith normal form of) $P$ are units.
To motivate this let's look at two examples:
Example 1: Let $a = \begin{pmatrix} 1&2 \\ 4&3 \end{pmatrix}$, whose minimal polynomial is $x^2 - 4x - 5$.  Thus we look at the matrix whose rows represent the powers of $a$ less than the degree of this minimal polynomial:
$$ \begin{pmatrix} 1&0&0&1 \\ 1&2&4&3 \end{pmatrix}$$
and reduce it to Smith normal form:
$$ \begin{pmatrix} 1&0&0&0 \\ 0&2&0&0 \end{pmatrix}$$
The fact that the last elementary divisor is greater than 1 corresponds to a linear combination of $I$ and $a$ with coprime coefficients, say:
$$\begin{pmatrix} 1&0 \\ 0&1 \end{pmatrix} + \begin{pmatrix} 1&2 \\ 4&3 \end{pmatrix}$$
which is twice (and the smallest multiple of) $\begin{pmatrix} 1&1 \\ 2&2 \end{pmatrix}$ in $\mathbb{Z}[a]$.  But that integer matrix does occur in $\mathbb{Q}[a]$ and thus we don't have $\mathbb{Q}[a] \cap M_n(\mathbb{Z})=\mathbb{Z}[a]$.
Example 2:  Consider $a = \begin{pmatrix} 0&1&1 \\ 1&0&1 \\ 1&1&0 \end{pmatrix}$, whose minimal polynomial is $x^2 - x - 2$.  Thus we look at the Smith normal form of:
$$ \begin{pmatrix} 1&0&0&0&1&0&0&0&1 \\ 0&1&1&1&0&1&1&1&0 \end{pmatrix} $$
which reduces to:
$$\begin{pmatrix} 1&0&0&0&0&0&0&0&0 \\ 0&1&0&0&0&0&0&0&0 \end{pmatrix} $$
The fact that all elementary divisors are 1 corresponds to the fact that all the nonzero combinations of $I$ and $a$ we can form in $\mathbb{Z}[a]$ can be chosen to get entries with greatest common divisor 1, and thus no smaller multiple in $\mathbb{Q}[a]$ exists than what we already find in $\mathbb{Z}[a]$.
Proof of Claim:
Let $\mathscr{M} = M_n(\mathbb{Z})$. For matrix $a \in \mathscr{M}$ define $\mathscr{N} = \mathbb{Z}[a]$.  Clearly $\mathscr{M}$ is a free $\mathbb{Z}$-module of rank $n^2$, and thus (since $\mathbb{Z}$ is PID) submodule $\mathscr{N}$ is also free.  By Cayley-Hamilton $a$ is integral over $\mathbb{Z} \cong \mathbb{Z}[I]$, and because $\mathbb{Z}$ is integrally closed (in $\mathbb{Q}$), the (monic) minimal polynomial of $a$ has integer coefficients.  If $d$ is the degree of the minimal polynomial of $a$, then $\mathscr{N}$ has basis $\{1,a,\ldots,a^{d-1}\}$ and so has rank $d$.
The $d \times n^2$ matrix $P$ described in the claim expresses the above basis of $\mathscr{N}$ in terms of the standard basis for $\mathscr{M}$.  Thus the proof of the Stacked Basis Thm. identifies $P$'s elementary divisors $q_1 \mid \ldots \mid q_d$ with the nonzero integer multiples $q_i$ of basis elements such that:
$$\text{(i) } \{\mu_1,\ldots,\mu_{n^2}\} \text{ is a basis for } \mathscr{M}$$
$$\text{(ii) } \{q_1 \mu_1,\ldots,q_d \mu_d\} \text{ is a basis for } \mathscr{N}$$
Let $\overline{\mathscr{N}} = \mathbb{Q}[a] \cap \mathscr{M}$, so our claim is $\mathscr{N} = \overline{\mathscr{N}}$ if and only if elementary divisors $q_i, 1 \leq i \leq d$ are all units.
Lemma: Let $b \in \mathscr{M}$.  Then:
$$b \in \overline{\mathscr{N}} \iff \exists r \in \mathbb{Z}^+ \text{s.t. } rb \in \mathscr{N}.$$
Proof: By clearing denominators in basis coefficients, $b \in \mathbb{Q}[a] \iff \exists r \in \mathbb{Z}^+ \text{s.t. } rb \in \mathbb{Z}[a]$.  Then take intersections with $\mathscr{M}$.
Accordingly the set $\{\mu_1,\ldots,\mu_d\} \subset \overline{\mathscr{N}}$.  This set is also linearly independent by (i) above.  From this we can show one side of the claim:
$$\mathscr{N} = \overline{\mathscr{N}} \implies q_i \text{ is a unit}, 1 \leq i \leq d $$
That is, if $\mathscr{N} = \overline{\mathscr{N}}$, then in particular $\mu_d \in \mathscr{N}$, and we have the integer combination:
$$\mu_d = \sum_{i=1}^d c_i q_i \mu_i$$
By linear independence, $1 = c_d q_d$, and $q_d$ is a unit.  By their divisibility relations, all $q_i$ are units, $1 \leq i \leq d$.
To show the other direction:
$$q_i \text{ is a unit}, 1 \leq i \leq d \implies \mathscr{N} = \overline{\mathscr{N}} $$
We know $\mathscr{N} \subset \overline{\mathscr{N}}$, so it suffices to prove the reverse inclusion.  Given any $b \in \overline{\mathscr{N}}$, express $b$ in terms of the basis for $\mathscr{M}$:
$$b = \sum_{i=1}^{n^2} c_i \mu_i$$
By the Lemma there exists integer $r \gt 0$ s.t. $rb \in \mathscr{N}$:
$$rb = \sum_{i=1}^{n^2} r c_i \mu_i$$
All $q_i$'s are units, so (ii) above says $\{\mu_1,\ldots,\mu_d\}$ is a basis for $\mathscr{N}$.  Then by uniqueness of coefficients, we have $r c_i = 0$ for all $i \gt d$.  As r is nonzero, this implies $c_i = 0$ for all $i \gt d$.  Therefore $b \in \mathscr{N}$, which proves the sought reverse inclusion, $\overline{\mathscr{N}} \subset \mathscr{N}$.
