# How to decompose given 4x4 matrix to one and two qubit unitary matrices?

I have matrix $$B=\begin{bmatrix}0&&0&&0&&0\\0&&1&&0&&0\\0&&0&&2&&0\\0&&0&&0&&3\end{bmatrix}$$.

By doing $$A=e^{\pi i B/2}$$, I get $$A=\begin{bmatrix}0&&0&&0&&0\\0&&i&&0&&0\\0&&0&&-1&&0\\0&&0&&0&&-i\end{bmatrix}$$. Now I have to implement this gate to two qubits with controlled operation, Controlled-A. How can I implement this gate? This is the paper from which I got matrices A and B and they have implemented Controlled-A gate. I am curious how they did that. I tried to read the references they provided but couldn't get anything related to this.

Research Paper

Any hints or approaches would be helpful.

• The only matrices that you can decompose in terms of unitary gates are unitary gates. So you cannot decompose this matrix. If you gave more context about what you're trying to do, there may be ways around this such as by embedding $A$ as a sub-matrix of a larger unitary matrix. Jun 22, 2021 at 6:49
• @DaftWullie I have edited the question. Jun 22, 2021 at 7:14
• How is this U(3)? Jun 22, 2021 at 7:23

You have incorrectly calculated $$A=e^{iB/2}=\left(\begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & i & 0 & 0 \\ 0 & 0 & -1 & 0 \\ 0 & 0 & 0& -i \end{array}\right).$$ This is unitary, and can be implemented as $$Z\otimes S$$.
• So, the result given in the research paper is incorrect? On the 7th page matrix $U_1$. Jun 22, 2021 at 7:28
• Yes, both $U_1$ and $U_2$ are stated incorrectly. Jun 22, 2021 at 8:50