Constructing 5 by 5 Unitary matrices

367 Views Asked by At

I am trying to construct an arbitrary 5 x 5 Unitary matrix. Any example will be appreciated.

2

There are 2 best solutions below

0
On

An example: the identity matrix $$ \pmatrix{ 1&0&0&0&0\\ 0&1&0&0&0\\ 0&0&1&0&0\\ 0&0&0&1&0\\ 0&0&0&0&1\\ } $$ Alternatively, take any permutation matrix, which can be made by rearranging these columns

0
On

As far as I know, the standard way of generating a haar unitary matrix is through the QR decomposition.

For any matrix $A$ with complex coefficients, there exists a unitary matrix $Q$ and an upper triangular matrix $R$ such that $QR=A$ (see the Wikipedia article). Furthermore, under certain conditions on $A$, $Q$ can be Haar distributed.

A simple MATLAB implementation of an algorithm for generating a $5\times 5$ Haar matrix in this way is given by Edelman and Rao in the paper "Random matrix theory" (link) as follows:

 % Generate Haar unitary matrix
 [Q,R]=qr(randn(5)+i*randn(5));
 Q=Q*diag(exp(i*2*pi*rand(5,1)));

which basically translates as

  1. Generate a $5\times 5$ matrix $A_1$ whose entries are i.i.d. copies of $N(0,1)$ random variables;
  2. Generate a $5\times 5$ matrix $A_2$ whose entries are i.i.d. copies of $N(0,1)$ random variables;
  3. Let $A=A_1+iA_2$;
  4. Let $QR=A$ be the QR decomposition of $A$;
  5. Multiply $Q$ by the matrix $$ D=\pmatrix{ e^{i2\pi x_1}&0&0&0&0\\ 0&e^{i2\pi x_2}&0&0&0\\ 0&0&e^{i2\pi x_3}&0&0\\ 0&0&0&e^{i2\pi x_4}&0\\ 0&0&0&0&e^{i2\pi x_5}\\ } $$ where $x_1,\ldots,x_5$ are independent random variables from the uniform distribution on $(0,1)$;
  6. $U=QD$ is a Haar unitary random matrix.

For a detailed explanation of why this algorithm works (especially, why we need step 5), see section "4.6. Haar-distributed orthogonal, unitary and symplectic eigenvectors" in the paper of Edelman and Rao.