Could someone check if the solution of the problem is right?
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.
Solution:
Let $D$1 =$U^*$A$U$ and $D$2 =$U^*$$B$$U$ .
As $A$ and $B$ are selfadjoint follows that $D^*$=$(U^*$$A$$U)^*$= $U^*$$A$$U$=$D$1, so $D$1 is hermitian, which also means that $D$1 must be diagonal ?
No, it is not right. You started your solution by saying “Let $D_1=U^*AU$”, without saying what $U$ is.