Solution (source code)

= Solution

Since $A$ and $B$ are real <symmetric matrices>, $U^\dagger=A-iB$. Expanding the <unitarity> condition gives
$$
I=U^\dagger U=(A-iB)(A+iB)=A^2+B^2+i(AB-BA).
$$
Equality of the entrywise real and imaginary parts yields
$$
\boxed{A^2+B^2=I,\qquad AB=BA.}
$$
These are the identities for the <real and imaginary parts of a symmetric unitary matrix>.