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.