# Are two diagonals with equal spectra similar to each other?

Let $$A,B$$ be two diagonal $$n \times n$$ matrices over some field $$R$$. And let $$A$$ and $$B$$ have the same eigenvalues (equal spectra) (in other words, each diagonal entry in $$A$$ is a diagonal entry in $$B$$ and vice-versa).

Then there should exist an invertible matrix $$U$$ that transforms $$A$$ to $$B$$ (i.e., $$A = UBU^{-1}$$), right?

Edit: Each eigenvalue in $$A$$ does not necessarily have the same multiplicity as each eigenvalue of $$B$$. So they don't necessarily have equal diagonals (up to permutation), just equal spectra.

• Similar matrices have equal characteristic polynomials. Characteristic polynomials of diagonal matrices are very easy to calculate. Commented Jan 19 at 16:57
• What is your definition of eigenvalue of a matrix over a (unital and commutative, I presume) ring? Commented Jan 19 at 17:39
• In this case, since they are diagonal, it's exactly just the diagonal entries Commented Jan 19 at 17:45

Diagonal matrices are similar if and only if they have the same diagonal entries, including multiplicity (same entries with the same multiplicities).

One direction follows by considering the characteristic polynomial. The other direction by defining a permutation $$\pi$$ of $$\{1,\ldots,n\}$$ so that $$a_{ii}=b_{\pi(i)\pi(i)}$$ for all $$i$$, and taking $$U$$ to be the corresponding permutation matrix.

The answer depends on whether you regard the spectrum of a matrix as a set (probably the more common definition) or a multiset, that is, whether the spectrum also encodes the (algebraic) multiplicities of the eigenvalues. (Somewhat confusingly, the Wikipedia article Spectrum of a matrix gives both definitions in different places but without further comment about this issue.)

If two diagonal matrices, say, $$\Lambda := \operatorname{diag}(\lambda_i)$$ and $$\operatorname{M} := \operatorname{diag}(\mu_i)$$, have the same eigenvalues (diagonal entries) including multiplicity—that is, if they have the same spectra as multisets—then there is a permutation $$\sigma$$ such that $$\mu_i = \lambda_{\sigma(i)}$$, and so $$\Lambda$$ and $$\operatorname{M}$$ are similar via the permutation matrix corresponding to $$\sigma$$.

On the other hand, if at least some of the eigenvalues have different multiplicities, then the matrices are not similar. For example, the matrices $$\operatorname{diag}(0, 0, 1) \qquad \textrm{and} \qquad \operatorname{diag}(0, 1, 1)$$ have different ranks and so are not similar. As sets the spectra of these matrices are both $$\{0, 1\}$$, but as multisets they are different: $$\{0, 0, 1\}$$, $$\{0, 1, 1\}$$.

It is true, however, that diagonal matrices with the same spectra as sets are necessarily similar if $$n \leq 2$$.

Yes. The idea is the same as diagonalising a matrix. For example, if we wanted to diagonalise $$A$$, (it doesn't matter that it's already diagonal), we find its eigenvalues, which for a diagonal matrix are just the enteries on the diagonal. Call them $$a_{1},...,a_n$$.

For any matrix, we'd now write its eigenvalues on the diagonal of a new matrix $$D$$ in any order we want. Again, because we know $$B$$ is diagonal, we know its eigenvalues and we also know they are $$a_1,...,a_n$$. So we write the eigenvalues in $$D$$ in the same order as they appear in $$B$$ (B.T.W., $$B=D$$, I'm just using $$D$$ to refer to the general case).

Then you write $$U$$ as the matrix whose columns are the eigenvectors that correspond to the eigenvalues of $$D$$ in the same order (this is important).

Then we have the relation that $$A=UDU^{-1}$$ and in this case, $$D=B$$ by construction.

• What if the eigenvalues are equal, but they have different multiplicities (which doesn't change the fact that they have equal spectra)? Commented Jan 19 at 16:46
• @mathlover Then no. Equal diagonal entries with multiplicities. Commented Jan 19 at 16:47
• So then, your answer is "yes (unless they have different multiplicities)"? Commented Jan 19 at 16:51
• @mathlover The answer is that they are similar if and only if they have the same diagonal entries with the same multiplicities. Commented Jan 19 at 16:51

If they have the same eigenvalues with the same multiplicities (i.e., they have equal diagonal entries - up to permutation), then yes the transformation matrix is simply a permutation matrix.

If they have different multiplicities, then no they are not similar.

Used both @Arturo Magidin and @A P's answers.