I've been working on a quantum computation problem set at Uni and came across the following problem. I managed to arrive at a proof, but I don't know if I have solved it to its fullest generality.
Consider two Hermitian operators $A$ and $B$ that have the same eigenvalues. Show that they are related by a unitary similarity transformation, $B=UAU^{\dagger}$ with $U^\dagger=U^{-1}$.
My attempt at a proof:
We first write the eigenvalue and eigenvector relations for the operators,
$$ A|a_i\rangle=\lambda_i|a_i\rangle, \\ B|b_i\rangle=\lambda_i|b_i\rangle. $$
Now we define the operator $U=\sum_{i} |b_i\rangle\langle a_i|$ (A basis change).
We write the spectral decompositions of $A$ and $B$ (This is the step that makes me uncomfortable):
$$ A=\sum_i \lambda_i|a_i\rangle\langle a_i|,\\ B=\sum_i \lambda_i|b_j\rangle\langle b_i|. $$
Applying $U$ to the operators on one side each gives us the relations
$$ UA=\sum_i \lambda_i|b_i\rangle\langle a_i|,\\ BU=\sum_i \lambda_i|b_i\rangle\langle a_i|. $$
Or, put simply $UA=BU$, with (very easy to check by applying completeness relations, another step that makes me uncomfortable) $U^\dagger=U^{-1}$. QED?
Okay, the thing about those two uncomfortable steps is that they have to rely on the validity of the spectral theorem. Reading up on Wikipedia, the conditions for it to hold are extremely restrictive, and that's why I got concerned with the generality of my proof. What other ways are there to show this identity?