# Constructing a circuit for $C^1(U)$ for rotation operators with TWO single qubit gates and CNOT gate

This is the exercise 4.23 from Nielsen and Chuang, asking that if it is possible to construct $$C^1(U)$$ for $$U=R_{x,y}(\theta)$$ with TWO single qubit gates and CNOT gate. My answer is no, and I would like to argue in the following way.

First, we do have such a construction for $$U=R_z(\theta)$$ which is the following (sorry that I have to draw it by hand) where the (reverse) CNOT has the matrix representation

$$\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ \end{bmatrix}$$ such that we have the matrix representation of the circuit as $$\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ \end{bmatrix} \big( \begin{bmatrix} 1 & 0 \\ 0 & e^{-i\theta/2} \end{bmatrix} \otimes \begin{bmatrix} 1 & 0 \\ 0 & e^{i\theta/2} \end{bmatrix} \big) \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & e^{-i\theta/2} & 0 \\ 0 & 0 & 0 & e^{i\theta/2} \\ \end{bmatrix}$$

which is the desired matrix for $$C^1(R_z(\theta))$$. Thus we do a have a circuit with only two single qubit gates and CNOT for $$U=R_z(\theta)$$. Now for the rotation $$U=R_x(\theta) = VR_z(\theta)V^\dagger$$, which differ from $$R_z$$ by a unitary transformation V, we will need to "sandwich" the above circuit by some other gate. However, that is not possible by just one single qubit gate as we need unitary transformation on both sides of the circuit, despite we may merge two gates into one. Thus I feel that it is not possible for $$U=R_{x,y}$$. However, on the other hand, physically there is no difference between various rotation operators, it feels not right that only $$R_z$$ has such circuit construction but not for others. So I may have missed sth here, and any help and clarification is appreciated.

• – glS Jan 24 at 17:05

The question comes in two parts. Firstly, for the top circuit, can you find the gates $$A$$, $$B$$ and $$C$$ such that $$ABC=I$$ and $$CXBXA=R_x(\theta)$$ or $$R_y(\theta)$$. Secondly, can you reduce either of these to the lower circuit with $$AB=I$$ and $$XBXA=R_x(\theta)$$ or $$R_Y(\theta)$$. The first of these is detailed in the bit of Nielsen and Chuang just before the exercise, so I won't go through it here. (Equally, if I can do the second part, that's like the first part but setting $$C=I$$.)

For the second part, I'll do specifically for the $$Y$$ version. We know that we need $$B=A^\dagger$$, which means that $$A^\dagger XA$$ squares to $$I$$. So, we can certainly choose an $$A$$ such that $$A^\dagger XA=\cos\theta X+\sin\theta Z$$. Hence, $$XBXA=\cos\theta I-i\sin\theta Y=R_Y(2\theta)$$.

To identify $$A$$ in this case, note that we can write $$X$$ in the form $$|+\rangle\langle +|-|-\rangle\langle -|$$ and the target unitary $$\cos\theta X+\sin\theta Z$$ as $$|u\rangle\langle u|-|v\rangle\langle v|$$ with $$\langle u|v\rangle=0$$. So, we simply define $$A=|+\rangle\langle u|+|-\rangle\langle v|,$$ and this achieves the desired transformation. Alternatively, I could predict (this comes with experience. The reliable way is the way I just stated.) that $$A$$ would be of the form $$R_Y(\phi)$$. Then we'd see $$A^\dagger XA=XA^2=XR_Y(2\phi)=X\cos\phi-\sin\phi Z,$$ and you just have to choose the correct value of $$\phi$$ to give you the $$\theta$$ that you want.

On the other hand, note that we cannot achieve the controlled-$$X$$ rotation. Here, you would need $$BA=I$$ (i.e. $$B=A^\dagger$$) and $$XBXA=R_x(\theta)$$. Now observe that these two conditions could be rewritten as $$BA=I$$ and $$BXA=R_x(\theta+\pi)$$, so if you could achieve it, you would be able to achieve it with only a single c-not gate. However, the seqeunce with only a single c-NOT gate squares to $$I$$, meaning the $$R_x(\theta+\pi)$$ would have to have eigenvalues $$\pm 1$$, meaning $$\theta=0$$ or $$\pi$$ are the only possible values (which is exactly the do nothing and controlled-not gates up to some possible permutations).

• For $A^\dagger X A = \cos\theta X + \sin\theta Z$, what would be the A? I feel that it necessarily involve $R_Y$ as we need to rotate X to Z, but that is the thing we want to construct in the first place. – fagd Jan 23 at 16:56
• Find the Eigenbasis of the thing you want. A is then the unitary rotation that converts from that basis to the X basis. – DaftWullie Jan 24 at 6:31
• Thanks for the update of the answer. It seems like you are using the gate $R_y(\phi)$ to construct the controlled $R_y(\theta)$ for $\theta\neq\phi$. If we are allowed to involve another $R_y$ gate with different rotation angles, then I agree with your construction. I previously thought that we are not allowed to "use $R_y$ gate to construct $R_y$ gate", but I realize I am using the $R_z$ gate in my construction for $R_z$ gate as well... Thanks for the clarification on the last part. – fagd Jan 24 at 19:26
• You use Ry to construct controlled Ry. They’re two very different things. – DaftWullie Jan 25 at 6:37
• I'm just going to jump in here as I was also doing this question. I found a quicker derivation for $C^1(R_y(\theta)$, using the Z-Y decomposition. $AXBXC=R_z(\beta)R_y(\gamma)R_z(\delta)$, setting $\beta=\delta=0$ gives $A=R_y(\theta/2)$, $B=R_y(-\theta/2)$, $C=I$, and it can obviously be seen that $A^\dagger=B$ – Sam Palmer Apr 21 at 19:28