Matrices that Differ only in Diagonal of Decomposition
I’ll be dealing with $n\times n$ matrices over a field $F$. I’ll try to make you partially pretty happy, because I expect following results which are partial, but concerning most common and simplest cases. I shall call matrices $A_1$ and $A_2$ simultaneously diagonalizable provided there exist diagonal matrices $D_1$, $D_2$ and invertible matrices $U$, $V$ such that $A_1=UD_1V$ and $A_2=UD_2V$. Consider a polynomial matrix $A(x)=xA_1+A_2$ with elements from $F[x]$. Let $r$ is rank of the matrix $A(x)$ and $d_r(A(x))\ne 0$ is its $r$-th determinant divisor. Let
$$d_r(A(x))=(x-x_1)^{r_1}\cdots (x-x_k)^{r_k},$$
where $x_i$ are distinct elements of the field $F$.
I hope to prove the following two propositions and present my ideas.
Proposition 1. If matrices $A_1$ and $A_2$ are simultaneously diagonalizable then no elementary divisor of the matrix $A(x)$ has multiple roots.
Proof idea. Let $D_1$, $D_2$ be diagonal and $U$, $V$ be invertible matrices such that $A_1=UD_1V$ and $A_1=UD_2V$. Then $UA(x)V=D_1x+D_2\equiv D(x)$. Therefore matrices $A(x)$ and $D(x)$ have the same Smith normal form. Then for each $i\le r$, $i$-th determinant divisor $d_i(D(x))$ of the matrix $D(x)$ satisfies the equality
$$d_i(D(x))= (x-x_1)^{\max\{r_1+i-r,0\}}\cdots (x-x_k)^{\max\{r_k+i-r,0\}}.$$
Thus an elementary divisor $\alpha_i(A(x))= \alpha_i(D(x))=\frac{d_i(D(x))}{d_{i-1}(D(x))}$ divides a product $$(x-x_1) \cdots (x-x_k).\square$$
Proposition 2. If $|A_1|\ne 0$ and no elementary divisor of the matrix $A(x)$ has multiple roots then matrices $A_1$ and $A_2$ are simultaneously diagonalizable.
Proof idea. Let $D(x)\equiv D_1x+D_2$ be a diagonal matrix which has an entry $x-x_k$ exactly $r_k$ times for each $k$. Since $\alpha_i| \alpha_{i+1}$ for each $1\le i<r$ and no elementary divisor $\alpha_i(A(x))$ of the matrix $A(x)$ has multiple roots, we can easily see that the matrix $D(x)$ has the same elementary divisors as the matrix $A(x)$, that is $\alpha_i(A(x))=\alpha_i(D(x))$ for each $i$. Thus matrices $A(x)$ and $D(x)$ have the same Smith normal form. Therefore there exist invertible matrices $U(x), V(x)$ with elements from $F(x)$ such that $U(x)A(x)V(x)=D(x)$. Similarly to the proof of Theorem 6 from [Gan, Ch. VI, $\S 4$] we can show (and only here we use that $|A_1|$ is non-zero) that there exist invertible matrices $U, V\in F$ with elements from $F$ such that $UA(x)V=D(x)$. Then $A_1=UD_1V$ and $A_1=UD_2V$. $\square$
I stop now, because I already called to my colleague who is a matrix theorist and got interested in the problem. At Monday he is going to return to Lviv and next I hope to visit for a long talk with tea about this and other matrix related MSE questions. (But it may be hard to reach complete happiness in this imperfect world, so his answer to your question for $\Bbb R[x]$ may be: “Since $\Bbb R[x][y]$ is even not a principal ideal domain, this is a very hard problem (and much more hard when we are dealing with singular matrices) and some results are only in very particular cases”.)
I hope to improve both propositions a bit by using the matrix $A(x,y)=|A_1x+A_2y|$ instead of the matrix $A(x)$, similarly to the beginning of [Gan, Ch. XII]. Unfortunately, these results are not directly applicable to our problem because the author is dealing with number fields.
References
[Gan] Feliks Ruvimovich Gantmakher, The theory of Matrices. (Russian, English editions)