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!