6
$\begingroup$

Suppose I have access to a pretty typical gate set, for example $\{\text{CNOT}, \text{SWAP}, \text{R}_{x}, \text{R}_{y}, \text{R}_{z}, \text{CR}_x, \text{CR}_y, \text{CR}_z\}$ where $\text{CR}$ is a controlled single-qubit rotation. I'm curious about decompositions of gates in the following forms: $$ U_1 = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & a & b & 0 \\ 0 & c & d & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} \qquad U_2 = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0& e & f \\ 0 & 0 & g & h \end{pmatrix} $$ where all constants are real. It seems like these decompositions should be straightforward since $U_1$ has a similar form to $\exp{(i\theta \text{SWAP})}$ and $U_2$ has a similar form to $\exp{(i\theta \text{CNOT}})$. However I'm having difficulty getting rid of the imaginary coefficients that are a necessary result of the exponential generator.

Is there a straightforward way to find decompositions when the block form of a desired unitary with real coefficients is the same as an exponentiated member of the desired gateset?

$\endgroup$
3
  • $\begingroup$ Just idea, try to use $Rz(\pi)$ or $Rz(-\pi)$ or its controlled version to get matrices with imaginary units and then multiply the matrix where you want to eliminate $i$. $\endgroup$ Dec 5 '20 at 8:04
  • 1
    $\begingroup$ With your current definitions, $ U_1 $ is a unitary matrix iff $ a \cdot b = 0 $. Together with the constraints $ a^2 + b^2 = 1, a, b \in \mathbb{R} $ you get the identity operator and $SWAP$ gate, right? Similar for $ U_2 $ you get identity and $CNOT$. Maybe you want to twist the definitions a little bit? $\endgroup$
    – tsgeorgios
    Dec 5 '20 at 11:56
  • $\begingroup$ @tsgeorgios great catch; I've edited the problem to a more general form that's hopefully not so trivial $\endgroup$
    – forky40
    Dec 6 '20 at 21:53
4
$\begingroup$

The key idea is to use Y-rotations, because they include the imaginary unit which cancels the imaginary unit present in the exponential formula.

Start with $U_2$. Note that it is an orthogonal matrix, because $e, f, g, h \in \mathbb{R}$. Therefore there exists angle $\theta$ such that

$$ U_2(\theta) = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & \cos \theta/2 & -\sin \theta/2 \\ 0 & 0 & \sin \theta/2 & \cos \theta/2 \end{pmatrix} $$

or

$$ U_2(\theta) = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & \cos \theta/2 & \sin \theta/2 \\ 0 & 0 & \sin \theta/2 & -\cos \theta/2 \end{pmatrix}. $$

These two forms correspond to the two connected components of $O(2)$, i.e. to a rotation and a rotoreflection, respectively. Noting that

$$ R_y(\theta) = \exp(-i\theta Y/2) = I \cos \frac{\theta}{2} - i Y \sin \frac{\theta}{2} = \begin{pmatrix} \cos \theta/2 & -\sin \theta/2 \\ \sin \theta/2 & \cos \theta/2 \end{pmatrix} $$

we see that in the rotation case

$$ U_2(\theta) = C^{(1)}R_y^{(2)}(\theta) $$

and in the rotoreflection case

$$ U_2(\theta) = C^{(1)}R_y^{(2)}(\theta) \, C^{(1)}Z^{(2)} $$

where $C^{(i)}$ indicates that the $i$th qubit is the control and $R_y^{(j)}$ and $Z^{(j)}$ indicate that the $j$th qubit is the target.

We can extend the above result to $U_1$ using the $CNOT$ gate. Specifically, we exploit the fact that the matrix of the $C^{(2)}NOT^{(1)}$ gate is the permutation matrix that swaps the second and fourth basis elements

$$ C^{(2)}NOT^{(1)} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \end{pmatrix}. $$

As before, we notice that $U_1$ is orthogonal due to the requirement that $a, b, c, d \in \mathbb{R}$ and therefore there exists angle $\theta$ such that

$$ U_1(\theta) = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos \theta/2 & -\sin \theta/2 & 0 \\ 0 & \sin \theta/2 & \cos \theta/2 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} $$

or

$$ U_1(\theta) = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos \theta/2 & \sin \theta/2 & 0 \\ 0 & \sin \theta/2 & -\cos \theta/2 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} $$

where once again the two forms correspond to a rotation and a rotoreflection, respectively. We reduce the rotation case of $U_1$ to the rotation case of $U_2$ using

$$ U_1(\theta) = C^{(2)}NOT^{(1)} \, U_2(-\theta) \, C^{(2)}NOT^{(1)} $$

and the rotoreflection case of $U_1$ to the rotoreflection case of $U_2$ using

$$ U_1(\theta) = C^{(2)}NOT^{(1)} \, U_2(-\theta) \, Z^{(1)} \, C^{(2)}NOT^{(1)} $$

where $Z^{(1)}$ is the single-qubit $Z$ gate applied to the first qubit.

$\endgroup$
1
  • $\begingroup$ The choice of $R_y$ to get all real coefficients and the CNOT21 are exactly the building blocks I needed. Thank you. $\endgroup$
    – forky40
    Dec 9 '20 at 23:18
3
$\begingroup$

If we can implement the second unitary $ U^{(2)} $, we immediately have a decomposition for the first since: $$ U^{(1)} = CNOT_{1, 0} \cdot U^{(2)}_{0, 1} \cdot CNOT_{1, 0} $$ if we set $ (e, f, g, h) = (d, c, b, a) $.

$ U^{(2)} $ is a controlled - $ V $ gate where $ V $ is the unitary matrix $ V = \begin{bmatrix} e & f \\ g & h \end{bmatrix} $.

Now since $ e^2 + g^2 = 1, e, g \in \mathbb{R} $, we can write $ e = \text{cos}(\phi) $ and $ g = \text{sin}(\phi) $. Similarly, $ f = \text{sin}(\theta) $ and $ h = \text{cos}(\theta) $. The two vectors must be orthogonal so:

$$ e \cdot f + g \cdot h = 0 \implies \text{cos}(\phi) \cdot \text{sin}(\theta) + \text{sin}(\phi) \cdot \text{cos}(\theta) = 0 \implies \text{sin}(\phi + \theta) = 0 $$

This means that either

  • $ \theta = -\phi \implies V = \begin{bmatrix} \text{cos}(\phi) & -\text{sin}(\phi) \\ \text{sin}(\phi) & \text{cos}(\phi) \end{bmatrix} = R_y(2\phi) \implies U^{(2)} = CR_y(2\phi) $, or

  • $ \theta = \pi -\phi \implies V = \begin{bmatrix} \text{cos}(\phi) & \text{sin}(\phi) \\ \text{sin}(\phi) & -\text{cos}(\phi) \end{bmatrix} = R_y(2\phi) \cdot Z = e^{i \frac{\pi}{2}} \cdot R_y(2\phi) \cdot R_z(\pi) $.

Once we obtain these decompositions of $ V $ it's straight-forward to implement it as a controlled operatiion. (see for example Nielsen and Chuang section on Controlled Operations).

$\endgroup$
3
$\begingroup$

What you're really recognising in the structure here is that your matrix decomposes into two $2\times2$ blocks, one of which is an arbitrary single-qubit unitary, and the other is an identity matrix. Once you know how to make one such matrix, it's easy to work out how to do any other matrix of the same structure because it's just a simple basis permutation. For example, to go from $U_2$ to $U_1$, I need to change $$ 00\rightarrow 00, 01\rightarrow 11, 10\rightarrow 10, 11\rightarrow 01. $$ This is achieved by a controlled-not controlled from the second qubit and targeting the first qubit. In other words, $U_1=CU_2C$, where $C$ is the aforementioned controlled-not. Of course, once you have a circuit representation of $U_2$, there may be some manipulations you can do to reduce the gate count.

To do $U_2$, there's a standard technique. You're familiar with the idea that any single-qubit unitary can be implemented with $$ U=e^{i\theta}R_z(\alpha)R_y(\beta)R_z(\gamma), $$ and hopefully with the identity $XR_Y(\alpha)X=R_Y(-\theta)$ (and similarly for $R_Z$). So, let's assume we've found $\theta,\alpha,\beta,\gamma$ corresponding to the $2\times 2$ block that you want to implement. To gate $U_2$, i.e. controlled-$U$, we start by apply a phase gate $R_Z(\theta)$ on the first qubit. Then we write a decomposition $$ R_z(\alpha)R_y(\beta)R_z(\gamma)=R_z(\alpha)R_Y(\beta/2)XR_y(-\beta/2)R_z(-(\alpha+\gamma)/2)XR_z((\gamma-\alpha)/2), $$ noting that if you remove the $X$ rotations, you get $$ R_z(\alpha)R_Y(\beta/2)R_y(-\beta/2)R_z(-(\alpha+\gamma)/2)R_z((\gamma-\alpha)/2)=I. $$ So, this means that we could perform the sequence $R_z((\gamma-\alpha)/2)$ on qubit 2, controlled-not targeting qubit 2, $R_y(-\beta/2)R_z(-(\alpha+\gamma)/2)$ on qubit 2, controlled-not targeting qubit 2 and finally $R_z(\alpha)$ on qubit 2. Note that if qubit 1, the control qubit, is in state $|0\rangle$, the controlled-nots do nothing and the sequence on qubit 2 is $$ R_z(\alpha)R_Y(\beta/2)R_y(-\beta/2)R_z(-(\alpha+\gamma)/2)R_z((\gamma-\alpha)/2)=I. $$ while if the control qubit is in $|1\rangle$, the sequence on qubit 2 is $$ R_z(\alpha)R_Y(\beta/2)XR_y(-\beta/2)R_z(-(\alpha+\gamma)/2)XR_z((\gamma-\alpha)/2)=R_z(\alpha)R_y(\beta)R_z(\gamma)=Ue^{-i\theta}. $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.