A professor of mine told me that this is true, but he doesn't remember what the proof was or where to find it, and I haven't been able to find a source for it yet. As such I am looking for one here.


In the theorem as stated, $\mathbb{F}$ is any field and $T\_n(\mathbb{F})$ denotes the algebra of upper triangular $n\times n$ matrices over $\mathbb{F}$.



> 
> **Theorem:** Let $A,B\in T\_n(\mathbb{F})$ be such that for all $X\in T\_n(\mathbb{F})$, $$AX=XA\implies BX=XB$$ Then $B=p(A)$ for some $p\in \mathbb{F}[t]$.
> 
> 
> 


Does anyone know of a source for this result? I have searched Google, MSE, MO, and the like to no avail.


If we replace $T\_n(\mathbb{F})$ by $M\_n(\mathbb{F})$, the question is answered in [this paper](http://www.ams.org/journals/bull/1945-51-08/S0002-9904-1945-08386-4/S0002-9904-1945-08386-4.pdf). Unfortunately, the argument doesn't seem to translate directly, as I can't find a way to force the $M\_i$ maps to be upper-triangular.


Also, I have already asked this question [here](https://math.stackexchange.com/questions/2843386/upper-triangular-matrices-b-that-commute-with-every-upper-triangular-matrix-co) on MSE. As the question is for an undergraduate research project, it felt appropriate to ask it here as well.


Thanks for any help!


**Edit on 9 July, 2018:** It's probably worth mentioning that the following theorem is **false**, so an appeal to Jordan form won't work (at least, not as easily as we'd hope it would).



> 
> **Fake Theorem:** If $A\in T\_n(\mathbb{F})$, then there exists an invertible $T\in T\_n(\mathbb{F})$ and a permutation matrix $P$ such that $P^{-1}T^{-1} ATP$ is in Jordan form.
> 
> 
> 


An explicit counterexample is
$$A=\left[\begin{array}{cccc} 0&1&0&0\\ &0&0&1\\ & &0&1\\ & & &0\end{array}\right]$$
and a more detailed demolishing of this theorem is given [here](https://ac.els-cdn.com/0024379578900071/1-s2.0-0024379578900071-main.pdf?_tid=b31f623d-947d-4f47-b356-73a795d33c8c&acdnat=1531167674_17ad5d1f22544fd2fb8168e00e037dce), where the authors prove that if $n\geq 12$ and $\mathbb{F}$ is infinite, then there are infinite sets of nilpotent matrices in $T\_n(\mathbb{F})$, none of which are conjugate (in $T\_n(\mathbb{F})$) to any of the others.


I mention this because I thought it was true for longer than I'd like to admit, and a few other people I've talked to thought it was true as well until told otherwise.



If $A,B$ are upper triangular matrices such that $AX=XA\implies BX=XB$ for upper triangular $X$, is $B$ a polynomial in $A$?
This is false! Let 
$$A = \begin{bmatrix}
0&0&0&1 \\
&0&1&0 \\
&&0&0 \\
&&&0 \\
\end{bmatrix}.$$
Imposing that $XA=AX$ for upper triangular $X$ gives linear equations on the $10$ entries of $X$. Solving them, I get that this occurs precisely for $X$ of the form
$$X=\begin{bmatrix}
a&0&\ast&\ast \\
&b&\ast&\ast \\
&&b&0 \\
&&& a \\
\end{bmatrix}.$$
In turn, an upper triangular matrix commutes with all such $X$ if and only if it is of the form
$$B=\begin{bmatrix}
c&0&0&d \\
&c&e&0 \\
&&c&0 \\
&&&c \\
\end{bmatrix}.$$
But such a $B$ is only a polynomial in $A$ if $d=e$.


