Are all similar Hermitian matrices unitarily similar?

I wasn't $$100\%$$ sure in the accuracy of what I obtained, so may I ask for verification?

Let $$A,B\in M_n(\Bbb C)$$ be two similar Hermitian matrices. Then $$A=P^{-1}BP$$.

According to the spectral theorem, every Hermitian matrix is diagonalizable, so $$A=U_1^{-1}DU_1$$ and $$B=U_2^{-1}DU_2$$, where $$U_1,U_2\in M_n(\Bbb C)$$ are unitary and $$D=\left(\delta_{ij}\right)\in M_n(\Bbb C)$$ is diagonal s. t. $$\delta_{ii}\in\sigma(A)=\sigma(B)$$.

Since $$A$$ and $$B$$ are unitarily similar to $$D$$, I wanted to write $$A$$ in the following form: $$A=P^{-1}U_2^{-1}DU_2P$$ Then $$U_2P=U_1\implies P=U_2^{-1}U_1$$. Since both $$U_1$$ and $$U_2^{-1}$$ are unitary, $$P$$, as a product of two unitary matrices, is also unitary.

Question according to this result:

Are all similar Hermitian matrices unitarily similar?

If this is valid, can it be used in the proof that the matrix representation of a Hermitian operator in an orthonormal basis is a Hermitian matrix? The statement is obvious when, given an arbitrary Hermitian matrix, one is asked to diagonalize it. I thought $$P$$ could be the transition matrix from one orthonormal basis to another one.

• I am having a hard time following what you are saying. It is true that every Hermitian matrix is unitarily equivalent to a diagonal matrix. But two diagonal matrices are unitarily equivalent if and only if they have the same diagonal elements, up to writing them in a different order. So the diagonal matrix whose diagonal entries are 1, 1, and 2 is not unitarily similar to the diagonal matrix whose diagonal entries are 2, 2, and 1. Aug 17 '20 at 20:22
• @StephenMontgomery-Smith, I didn't mean unitarily equivalent, but unitarily similar. I'm wondering if Hermitian matrices are similar, are they unitarily similar? Let's say we take your example of a diagonal matrix with entries $\operatorname{diag}\{1,1,2\}$. Then, I mean, $A$ is unitarily similar to $D$ and $B$ is unitarily similar to $D$. Then, my problem boils to the possible transitivity of the relation "being unitarily similar". I hope it sounds less messy. We used the term equivalent only for the matrices of the same type and rank to distinguish the similarity. Aug 17 '20 at 20:31
• Sorry. I thought that similar and equivalent meant the same thing in this context. Aug 17 '20 at 20:34
• Anyway, is your question this? "If two Hermitian matrices are similar, then they are unitarily similar?" If that is the question, then the answer is "yes." Aug 17 '20 at 20:34
• @StephenMontgomery-Smith, thank you for verifying! And more importantly, for the patience! Aug 17 '20 at 20:35

Howerver, $$P$$ doesn't necessarily have to be unitary if, e. g., $$A=B=0$$. Then every invertible $$P$$ would suffice.