# Difference between $Rz$ and $R1$ gate [closed]

You are given an operation that implements a single-qubit unitary transformation: either the Rz gate or the R1 gate. The operation will have Adjoint and Controlled variants defined.

Your task is to perform necessary operations and measurements to figure out which unitary it was and to return 0 if it was the Rz gate or 1 if it was the R1 gate.

• I’m voting to close this question because this is a problem from an ongoing competition (codeforces.com/contest/1357). Please wait until the competition is over – Mariia Mykhailova Jun 19 at 20:07
• As this relates to an ongoing competition, as done previously, I'm going to lock this question so that no-one can answer or comment so as to not violate the spirit of the competition. This will automatically unlock after a week – Mithrandir24601 Jun 19 at 20:35
• Even as the competition has ended, I'm voting to close as the question as-is is just a lazy copy from the competition as is not a proper question per se. – JSdJ Jun 24 at 12:44

## 1 Answer

Disclaimer: I am answering this question because the competition the question come from ended. Otherwise, I would consider to answer the question unfair.

A $$R1$$ gate is given by matrix $$R1(\theta) = \begin{pmatrix} 1 & 0 \\ 0 & \mathrm{e}^{i\theta} \end{pmatrix},$$ while $$Rz$$ gate by matrix $$Rz(\theta)= \begin{pmatrix} \mathrm{e}^{-i\theta/2} & 0 \\ 0 & \mathrm{e}^{i\theta/2} \end{pmatrix}$$

Easily you can see that $$R1(\theta) = \mathrm{e^{i\theta/2}}Rz(\theta)$$. So, the gates differ only by global phase $$\theta/2$$. If you use these gates as single qubit only, there is no difference between them as resulting quantum states differ again only in global phase. Such states are physically undistinguishable.

However, controlled versions of these gates are different. For $$R1(\theta)$$, its controlled version is described by matrix

$$C-R1(\theta) = \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & \mathrm{e}^{i\theta} \end{pmatrix},$$ while controled version of $$Rz$$ is given by matrix

$$C-RZ(\theta) = \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & \mathrm{e}^{-i\theta/2} & 0 \\ 0 & 0 & 0 & \mathrm{e}^{i\theta/2} \end{pmatrix}.$$ Clearly, these gates do not differ by the phase.

• Note that you can get from the controlled $R1$ gate to the controlled $R_{z}$ gate by applying a $R_{z}(-\frac{\theta}{2})$-gate to the first qubit after the controlled gate. – JSdJ Jun 24 at 12:28