Solution (source code)

= Solution

From $Hv=\mu v$, $v^\dagger Hv=\mu\|v\|^2$ is real, so $\mu\in\mathbb R$. For distinct <eigenvalues>, $\mu_i v_i^\dagger v_j=v_i^\dagger Hv_j=\mu_jv_i^\dagger v_j$, hence orthogonality. Normalising the <eigenvectors> and taking them as the rows of $U$ gives $H=U^\dagger\Lambda U$.