TITLE: It is not always possible to express two diagonal matrices as polynomials of some matrix
QUESTION [6 upvotes]: I am looking for an illuminating proof of the following statement:

There are not any polynomials $p,q$ and matrix $X$ over $GF(2)$ such that $p(X)=A:=\operatorname{diag}(1,0,0)$ and $q(X)=B:=\operatorname{diag}(0,1,0)$.

(Note that the underlying field is $GF(2)$, not $\mathbb{R}$ or $\mathbb{C}$.) The statement originated from a remark I made to MSE/562509 and it is also related to MSE/326293 and MO/34314. I have verified by computer that the statement is indeed true. Here is a proof that I find unsatisfactory:

Suppose $p(X)=A$ and $q(X)=B$. As $A,B\neq 0,I$, by Cayley-Hamilton theorem, there are only six possible choices of $p$ or $q$, namely,
  $$
p(x),q(x)\in\{x,\ x+1\}\cup\{x^2,\ x^2+1\}\cup\{x^2+x,\ x^2+x+1\}=S_1\cup S_2\cup S_3 \textrm{ (say)}.
$$
  Since $A$ differs from $B$ and $B+I$, we must have $p\in S_m$ and $q\in S_n$ for some $m\ne n$. Therefore, either $X$ or $X+I$ lies inside $\operatorname{span}\{p(X),q(X)\}=\operatorname{span}\{A,B\}$. So, $X$ must be a diagonal matrix. As some two diagonal entries $x_{ii}$ and $x_{jj}$ of $X$ are equal to each other (because $X$ has three diagonal entries but $GF(2)$ has size two), it follows that $a_{ii}=a_{jj}$ and $b_{ii}=b_{jj}$, which is a contradiction.

While the above proof is not long, my feeling is that it is just a bunch of technical details but not a revealing proof. Does anyone have a better idea?

REPLY [3 votes]: Notice that if $p(X)=\text{diag}(1,0,0)$ and $q(X)=\text{diag}(0,1,0)$ then X commutes with $p(X)$ and $q(X)$, which implies $X=\text{diag}(x_1,x_2,x_3)$.
Notice that $x_1\neq x_2$, because $1=p(x_1)\neq p(x_2)=0$. Notice that $p(x_1)+q(x_1)=1+0=1$ and $p(x_2)+q(x_2)=0+1=1$. Thus, $p(x_3)+q(x_3)=1$, because $x_3=x_1$ or $x_2$, since the field has two elements.
Thus, $p(X)+q(X)=Id_{3\times3}$. This is a contradiction.