# How can I decompose a gate into $\{\mathrm{CNOT}, \mathrm{H}, \mathrm{P}(\theta)\}$?

I am working with the set $$\{\mathrm{CNOT}, \mathrm{H}, \mathrm{P}(\theta)\}$$

where $$\mathrm{H}$$ is the Hadamard gate, and $$\mathrm{P}(\theta)$$ is the phase gate with angle $$\theta$$.

I want to build other gates with these gates, like $$R_z(\theta)$$, Control-$$R_z(\theta)$$, or Control-$$P(\theta)$$

How can I do this?

• See N&C:Ch4 or Summary. You want to factor $U=e^{i\alpha}AXBXC$ with $ABC=Id$ and you will get an expression for Control-$U$. So do that for whichever $R_{\vec{n}} (\theta)$ you desire. – AHusain Sep 30 '18 at 18:16
• This might be helpful: quantumcomputing.stackexchange.com/questions/4086/… – user1271772 Sep 30 '18 at 20:32

In your question, you don't define $$P(\theta)$$ or $$R_z(\theta)$$. I'm going to assume: $$P(\theta)=\left(\begin{array}{cc} 1 & 0 \\ 0 & e^{i\theta} \end{array}\right)\qquad R_z(\theta)=\left(\begin{array}e^{-i\theta} & 0 \\ 0 & e^{i\theta} \end{array}\right).$$ In this case, you simply have that $$R_z(\theta)=P(2\theta)e^{-i\theta}\equiv P(2\theta),$$ the point being that global phases are irrelevant. However, the difference is important when you look at the controlled-gates. Let's say we can create either controlled-$$P$$ or controlled-$$R_z$$. We can create the other via the identity
The extra $$P(-\theta)$$ is the gate that compensates for the extra phase.
To make controlled-$$R_z$$, the trick is to notice the identities $$R_z(\theta_1)R_z(\theta_2)=R_z(\theta_1+\theta_2)$$ and $$XR_z(\theta)X=R_z(-\theta)$$, where we will replace the Xs by controlled-not so that the change in rotation angle only happens if the control qubit is 1. Hence, we have