I was trying to find the most general way of writing a $4\times 4$ unitary matrix but I got stuck when I obtained a set of equations that did not look very pretty after starting from something like: $$U= \begin{pmatrix} a & b & c & d\\ e & f & g & h\\ i & j & k & l\\ m & n & o & p\\ \end{pmatrix}.$$
I was wondering if there was any clever way to write down such a matrix using a minimal amount of variables, probably under the form of exponentials and cosines/sines. Example of what I am looking for:
$$U=\frac{1}{\sqrt{2}} \begin{pmatrix} {e}^{+i\varphi} & {e}^{+i\varphi} & 0 & 0\\ {e}^{-i\varphi} & -{e}^{-i\varphi} & 0 & 0\\ 0 & 0 & {e}^{+i\psi} & {e}^{+i\psi}\\ 0 & 0 & {e}^{-i\psi} & -{e}^{-i\psi}\\ \end{pmatrix},$$
but without any $0$ unless it is required due to the unitarity of the matrix. I have not found anything on the internet related to this topic, except these threads:
I was hoping for either a systematic method to deal with $n\times n$ unitary matrices or a specific method to the $4 \times 4$ case.
The columns of your matrix form an orthonormal basis of $\mathbb C^4$. You can use the Gram-Schmidt procedure to start with four linearly independent column vectors $x_1, x_2, x_3, x_4$ and produce an orthonormal basis:
$$ \eqalign{u_1 &= x_1/\|x_1\|\cr u_2 &= (x_2 - u_1 u_1^* x_2)/\|(x_2 - u_1 u_1^* x_2)\|\cr u_3 &= (x_3 - u_1 u_1^* x_3 - u_2 u_2^* x_3)/\| (x_3 - u_1 u_1^* x_3 - u_2 u_2^* x_3)\|\cr u_4 &= (x_4 - u_1 u_1^* x_4 - u_2 u_2^* x_4 - u_3 u_3^* x_4)/\|x_4 - u_1 u_1^* x_4 - u_2 u_2^* x_4 - u_3 u_3^* x_4\|\cr}$$