# QCQI notes: How to decompose unitary matrices and quantum gates?

Any unitary operator $$U$$, can be decomposed into a product of two-level unitary matrices. Here we introduce the universal method of this procedure.

## References

[1] Li CK, Roberts R, Yin X. Decomposition of unitary matrices and quantum gates. International Journal of Quantum Information. 2013 Feb 3;11(01):1350015.

[3] Nielsen MA, Chuang I. Quantum computation and quantum information.

## Concepts

### Two-level unitary matrix

A two-level $d \times d$ unitary matrix is a unitary matrix obtained from the $d \times d$ identity matrix by changing a $2 \times 2$ principal submatrix, and every $d \times d$ unitary matrix can be decomposed into the product of no more than $d(d-1)/2$ two-level unitary matrices.

For a two-qubit system, two-level matrices could be like,

$$\left(\begin{array}{cccc}{v_{11}} & {v_{12}} & {0} & {0} \\ {v_{21}} & {v_{22}} & {0} & {0} \\ {0} & {0} & {1} & {0} \\ {0} & {0} & {0} & {1}\end{array}\right) or \left(\begin{array}{cccc}{1} & {0} & {0} & {0} \\ {0} & {1} & {0} & {0} \\ {0} & {0} & {v_{11}} & {v_{12}} \\ {0} & {0} & {v_{21}} & {v_{22}}\end{array}\right),$$

for the circuits like this,

## Purpose

The main purpose is to decompose an arbitrary unitary quantum gate into a product of several two-level unitary matrices. This step is siginificant, because it is a critical step to realize a complicate quantum gate in physical method. For example, the matrix $U$ we want to decompose is

$$U=\left[\begin{array}{lll}{a} & {d} & {g} \\ {b} & {e} & {h} \\ {c} & {f} & {j}\end{array}\right].$$

The main idea is finding 3 unitary matrices $U_1, U_2, U_3$, producting by $U$ sequentially, finally obtain an identity $U$, hence the inverse matrices of $U_1, U_2, U_3$ is what we need,

$$U_3U_2U_1U=I$$

$$U=U_1^{\dagger}U_2^{\dagger}U_3^{\dagger}$$

here, $U_1, U_2, U_3$ are $3\times3$ two-level matrices.  We need to derive the expression of $U_1, U_2, U_3$ step by step in the next section.

## Method for $3\times3$ matrix

We calculate $U_1, U_2, U_3$ from $U_1$ to $U_3$ sequentially,

### Step #1

In this step, we obtain the expression of $U_1$, however, it is directly given by previous researchs,

$$U_{1} \equiv\left[\begin{array}{ccc}{\frac{a^{*}}{\sqrt{|a|^{2}+|b|^{2}}}} & {\frac{b^{*}}{\sqrt{|a|^{2}+|b|^{2}}}} & {0} \\ {\frac{b}{\sqrt{|a|^{2}+|b|^{2}}}} & {\frac{-a}{\sqrt{|a|^{2}+|b|^{2}}}} & {0} \\ {0} & {0} & {1}\end{array}\right],$$

hence the result of first step is,

if can be seen that the item $U^{\prime}_{(2,1)}$ equals to $0$, this is exactly the purpose of this step. But why we want to do this?

### Step #2

Firstly, we rewrite the items of matrix $U^{\prime}$, add a superscript $\prime$,

It is similar in this step, $U_2$ is directly given by,

$$U_{2} \equiv\left[\begin{array}{ccc}{\frac{a^{\prime *}}{\sqrt{\left|a^{\prime}\right|^{2}+\left|c^{\prime}\right|^{2}}}} & {0} & {\frac{c^{\prime *}}{\sqrt{\left|a^{\prime}\right|^{2}+\left|c^{\prime}\right|^{2}}}} \\ {0} & {1} & {0} \\ {\frac{c^{\prime}}{\sqrt{\left|a^{\prime}\right|^{2}+\left|c^{\prime}\right|^{2}}}} & {0} & {\frac{-a^{\prime}}{\sqrt{\left|a^{\prime}\right|^{2}+\left|c^{\prime}\right|^{2}}}}\end{array}\right]$$

Hence we can obtain $U^{\prime\prime}=U_2U_1U$,

here we obtain a matrix which the items $U_{(2,1)}$ and $U_{(3,1)}$ are both $0$. In addition, notice that $U_{(1,1)}=1$.

### Step #3

Let’s go one step further, we simplified the matrix representation by adding an extra $\prime$ notation on the superscripts.

the key point is about the items $d^{\prime\prime}$ and $g^{\prime\prime}$. Because $U_2U_1U$ is a unitary matrix, hence the inner product of vector $(1, d^{\prime\prime}, g^{\prime\prime})$ should equal to $1$, in this way, $d^{\prime\prime}=g^{\prime\prime}=0$.

The above property is important because we can give the final unitary operator $U_3$ directly,

$$U_{3} \equiv\left[\begin{array}{ccc}{1} & {0} & {0} \ {0} & {e^{\prime \prime *}} & {f^{\prime \prime *}} \ {0} & {h^{\prime \prime *}} & {j^{\prime \prime *}}\end{array}\right].$$

It is easy to see that $U_3U_2U_1U=I$, hence operator $U$ can be decomposed to $U_1^{\dagger}U_2^{\dagger}U_3^{\dagger}$.

### General situation

When the space is $d$-dimensional, the method is just the same. Firstly, we use $d-1$ matrices $U_{d-1}U_{d-2}\cdots U_{1}$ to derive the $U_{d-1}U_{d-2}\cdots U_{1}U$ to

Then, we use the same method to decompose the rest $(d-1)\times(d-1)$ matrix, we need $d-2$ matrices to do perform the next time decomposition, and $d-3, \cdots, 1$ recursively. Finally we obtain a identity, hence $U_{1}^{\dagger}\cdots U_{d(d-1)/2}^{\dagger}$ is the decomposition of U, the total number of matrices is $\Sigma_1^{d-1}=d(d-1)/2$.

The key point is the order of producting the matrices $U_{d-1}U_{d-2}\cdots U_{1}$, which is

In a 4-dimensional situation, the application order for the first iteration is,