Solution (source code)

= Solution

Taking the <conjugate transpose> of $U=A+iB$ and using that both parts are <Hermitian matrices> gives $U^\dagger=A-iB$. Addition and subtraction recover the <Hermitian parts of a unitary matrix>:
$$
\boxed{A=\frac{U+U^\dagger}{2},\qquad
B=\frac{U-U^\dagger}{2i}.}
$$
These depend only on $U$, so any such decomposition has the same $A,B$ and is unique. Conversely the displayed expressions are <Hermitian matrices> and sum to $U$ in the form $A+iB$, establishing existence as well as uniqueness. Their commutation and quadratic relation are proved in the two labelled parts.