Problem:
Let $A, B \in \mathbb{C}^{n\times n}$ be selfadjoint ,such that $[A,B] := AB − BA = 0$ Show that there is a unitary matrix $U \in \mathbb{C}^{n\times n}$ such that $U^*$A$U$ and $U^*$$B$$U$ are both diagonal.
I am very confused about this problem. Should I first prove that $U$ is unitary and then that $U^*$A$U$ and $U^*$B$U$ are both diagonal? Or I should assume that $U^*$A$U$ and $U^*$B$U$ are diagonal and therefoe I should prove that $U$ is unitary??
Hint: Since $A:\mathbb{C}^n\to\mathbb{C}^n$ is self-adjoint, we can find an orthonormal basis composed of eigenvectors of $A$ by spectral theorem. Thus we can decompose $$ \mathbb{C}^n = \bigoplus_{i=1}^k \ker(A-\lambda_iI). $$ Let $N_i = \ker (A-\lambda_i)$ and show that $B_i =B|_{N_i}:N_i\to N_i$ is a well-defined self-adjoint operator. Find an orthonormal basis $\mathcal{B}_i$ of $N_i$ consisting of eigenvectors of $B_i$ for each $i$. Finally prove that $\mathcal{B}=\bigcup_{i=1}^k \mathcal{B}_i$ forms an orthonormal basis of $\mathbb{C}^n$ consisting of eigenvectors of both $A$ and $B$. And form a desired unitary matrix $U$ using the orthonormal basis $\mathcal{B}$.