ordering of eigenvalues for simultaneously diagonalizable matrices [closed]

Suppose I have two commuting Hermitian matrices $$A$$ and $$B$$: $$[A,B] = 0$$. I can always find a unitary operator $$U$$ such that simultaneously diagonalize both matrices, i.e.,

$$$$U^* A U = D_A, \quad U^* B U = D_B,$$$$ where $$D_A$$ and $$D_B$$ are corresponding diagonal matrices.

My question is: can we always say that the orderings of eigenvalues of $$D_A$$ and $$D_B$$ are the same, e.g., eigenvalues of both $$D_A$$ and $$D_B$$ are in descending order ($$\lambda_{a_1} \geq \cdots \geq \lambda_{a_n}$$ and $$\lambda_{b_1} \geq \cdots \geq \lambda_{b_n}$$)?

If $$A$$ and $$B$$ have the same eigenvalues, then you are asking for $$U^*AU=U^*BU$$, which implies $$A=B$$. So in general you can't do what you are asking about.
• I don't think that $A$ and $B$ share the same eigenvalues in the question. They share the same eigenvectors.
• @PC1, but if they have the same eigenvalues.... E.g., if $A=\pmatrix{1&0\cr0&-1}$ and $B=\pmatrix{-1&0\cr0&1}$, then.... All it takes is one example to show what OP wants can't be done. At bottom, your answer and mine have much in common. Aug 4, 2023 at 7:03
Take for example $$A$$ and $$B$$ as diagonal matrices. These will always commute but the entries are not in general ordered in the same way. So any change of basis (a permutation matrix in this case) can't sort the entries in descending order for both matrices at the same time.