Original title: when animals attack.

2016: The short version is that matrices that commute with a fixed matrix $A$ must all be polynomials in $A,$ if and only if the characteristic polynomial of $A$ and the minimal polynomial coincide. Put another way, if and only if each eigenvalue occurs in just one Jordan block. Worth recording the fact that the minimal polynomial of a square matrix does not change when the field of definition is extended.

Inspired by $$ $$ https://mathoverflow.net/questions/65738/when-matrix-multiplication-commutes $$ $$ and $$ $$ http://www.imdb.com/title/tt0293702/ $$ $$ is it true that, when $$ A \in SL_n(\mathbf Z),$$ then all integral matrices that commute with $A$ are an integral (or at least rational) polynomial in $A$? I dimly recall proving this for a specific 3 by 3 $A$ that was all 0's and 1's, so calculations were easy. The use of the unit determinant is that $A^{-1}$ is an integral polynomial in $A$ by Cayley-Hamilton. The degree of the polynomial need be no larger than $n-1,$ also by Cayley-Hamilton.

EDIT: as both David Speyer and Tommaso Centeleghe point out in comments below, the statement is true if all eigenvalues are distinct, probably false otherwise. People are smart. And quick. The point being to diagonalize $A$ over $\mathbb C$ and continue.

EDIT TOOO: it seems reasonable to conjecture that the full set of $A$ for which the statement is true is $ A \in SL_n(\mathbf Z)$ such that, should there be any eigenvalue(s) of multiplicity larger than one, all occurrences of that eigenvalue must fit into a single Jordan block. Richard would know.

With or without commutativity, I once made a "multiplicative" function out of $$ f(x_0, x_1, \ldots, x_{n-1}) = \det (x_0 I + x_1 A + x_2 A^2 + \cdots + x_{n-1} A^{n-1}), $$ amounting to a kind of fake norm form. The guy I asked about it laughed at me but said that's what I had.

I asked Manjul Bhargava about this: take the matrix $A,$ 3 by 3, to have rows <0,1,0; 0,0,1; 1,1,1> which I think may actually have had determinant -1, never mind. Then the prime values I got from my fake norm form were all nonresidues mod 11 and all $x^2 + 11 y^2.$ I'm not sure about 2 itself. No proof but presumably a known sort of problem.

`$A=\begin{pmatrix} 2 & 0 \\ 0 & 4 \end{pmatrix}$`

. These are precisely the diagonal matrices. But`$\begin{pmatrix} a & 0 \\ 0 & b \end{pmatrix}$`

is an integer polynomial in $A$ iff $a \equiv b \mod 2$. $\endgroup$ – David E Speyer May 23 '11 at 20:31`$B = \begin{pmatrix} 0 & 1 \\ 2 & 0 \end{pmatrix}$`

, so $B$ has eigenvalues $\pm \sqrt{2}$. Let $A = 3+2 B$. Then the eigenvalues of $A$ are $3 \pm 2 \sqrt{2}$, so $\det(A) = (3+2\sqrt{2})(3-2\sqrt{2})=1$. Then $C$ commutes with $A$ if and only if it commutes with $B$. The integral matrices commuting with $C$ are $\mathbb{Z}[B]$, whereas $\mathbb{Z}[C] = \mathbb{Z}[2B]$. $\endgroup$ – David E Speyer May 23 '11 at 20:43