# Two diagonal matrices each other's entries rearranged (same eigenvalues and multiplicities), are they similar?

Two diagonal matrices each other's entries rearranged (same eigenvalues and multiplicities), are they similar?

This seems like such a simple question, but I can't quite see a connection. I want to say that the two diagonal matrices can commute with each other, and this gives us the algebraic edge to show their similarity, but I'm generally bad with abstract algebra proofs.

• Yes, the two diagonal matrices $A$ and $B$ are similar. If $a_{11}$ occurs in $B$ as $b_{ii}$, then a change of basis transformation which takes the first basis element to the $i$th basis element would gives the similarity transformation you are looking for. Jun 5, 2016 at 5:21
• If you want explicitly find regular matrix $P$ such that $B=PAP^{-1}$, you might look into permutation matrices Jun 6, 2016 at 10:50

Let $A=\operatorname{diag}(d_1,d_2,\dots,d_n)$ and $B=\operatorname{diag}(d_{\pi(1)},d_{\pi(2)},\dots,d_{\pi(n)})$, where $\pi\colon\{1,2,\dots,n\}\to\{1,2,\dots,n\}$ is some permutation.
If $A$ is the matrix of a linear function $f$ w.r.t. the standard basis $\vec e_1,\vec e_2,\dots,\vec e_n$, then $B$ will be the matrix of the same function w.r.t. the basis $\vec e_{\pi(1)},\vec e_{\pi(2)},\dots,\vec e_{\pi(n)}$. (Just notice that $f(\vec e_{\pi(n)})=d_{\pi(n)}\vec e_{\pi(n)}$.)