# How to decompose this two-qubit unitary matrix to the standard gate set?

I have read some of the other decomposition questions here however still don't understand how to do it manually. The matrix I wish to decompose is the following for 2 qubits:

$$M=\frac{1}{\sqrt2}\begin{bmatrix} 1 & 0 & 0& i\\ 0 & 1& i & 0\\ 0 & i & 1 & 0\\ i & 0& 0 & 1 \end{bmatrix}$$

I have used the Qiskit circuit decompose to find that it corresponds to the following image, but I don't understand how that was done. Also Qiskit is only able to decompose for up to 2 qubits. My application for the matrix expands beyond 2 qubits and I would also like to know how to decompose for more.

Any help on the step by step process of decomposition would be appreciated as well as any insight on multiple qubit decomposition :)

## 2 Answers

I found paper Quantum Circuits for Isometries to be a useful reference on the topic. It describes several methods for decomposing multi-qubit unitaries into CNOT gates and qubit unitaries and also gives several references to earlier related works.

There is also a Mathematica package that implements algorithms described in the mentioned paper. If you don't have Mathematica you can still probably run it using Wolfram Engine and Wolfram Language for Jupyter.

For decomposition of two-qubit unitaries with minimal CNOT count quant-ph/0308033 is a good reference.

You can found some interesting approaches to decomposing gates also here: https://arxiv.org/abs/quant-ph/9503016 (Elementary gates for quantum computation).