# Why is a different convention used for the $Rz$ implementation on IBM Q?

A $$z$$ rotation gate is defined as $$Rz(\theta)=\mathrm{e}^{-i\frac{\theta}{2}Z}= \begin{pmatrix} \mathrm{e}^{-i\frac{\theta}{2}} & 0 \\ 0 & \mathrm{e}^{i\frac{\theta}{2}} \end{pmatrix},$$

however, when one uses $$Rz$$ gate on IBM Q, the results are these (tested in Visualization of state vector):

• $$Rz(\theta)|0\rangle = |0\rangle$$
• $$Rz(\theta)|1\rangle = \mathrm{e}^{i\theta}|1\rangle$$

This means that a matrix representation of such gate is

$$Rz^{\text{IBM}}(\theta)= \begin{pmatrix} 1 & 0 \\ 0 & \mathrm{e}^{i\theta} \end{pmatrix}.$$

So, it seems that $$Rz(\theta)$$ is on IBM Q implemented with $$U1(\theta)$$ gate.

Since gates $$Rz(\theta)$$ and $$Rz(\theta)^\text{IBM}$$ differs only by global phase $$\theta/2$$ ($$Rz^\text{IBM} = \mathrm{e}^{i\frac{\theta}{2}}Rz(\theta))$$, this difference can be neglected. However, in case of controlled version of $$z$$ rotation the global phase matters.

Controlled version of $$Rz$$ is described by matrix

$$CRz(\theta)= \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & \mathrm{e}^{-i\frac{\theta}{2}} & 0 \\ 0 & 0 & 0 & \mathrm{e}^{i\frac{\theta}{2}} \end{pmatrix}$$

On IBM Q, controlled version of $$Rz$$ behaves according to this matrix which is right.

Despite the global phase can be neglected in case of single qubit gates, one would expect that relation between a single qubit gate $$U$$ and its contolled version, i.e.

$$CU= \begin{pmatrix} I & O \\ O & U \end{pmatrix},$$

will be preserved. In some cases the convention used by IBM for $$Rz$$ can be confusing (discussed for example here).

So far, I have counted with this fact but I am curious: Why does IBM use its own convention and does not follow definitions used in quantum physics?

(I would appreciate if somebody from IBM Q development team could give an insight to this).

• It might have something to do with how the IBM Q experience physically implements the $R_{z}$ gate, which is actually not at all, but via frame changes of the $X$ and $Y$ operation: they perform rotations along any axis in the $X-Y$ plane, and keep track through software what the actual $X-$ and $Y-$axis are.
– JSdJ
May 7 '20 at 12:50

I'm not from IBM Q development team, but here is how I understand the problem:

Qiskit's definition of $$R_z$$ gate coincides with the conventional definition used, for example, in M. Nielsen and I. Chuang's textbook (page 174):

$$R_z(\theta) = \begin{pmatrix} e^{-i \theta/2} &0 \\ 0&e^{i \theta/2} \end{pmatrix}$$

The "problem" is not in the definitions, the "problem" is in the implementations.

Although Qiskit's implementation of rz gate coincides with the u1 gate, the implementations of crz and cu1 are different and coincide with the conventional definitions. Nevertheless, I think this still can cause some problems. For example, after creating a circuit with rz gate in it, one may want to create a controlled version of the circuit with Qiskit's get_controlled_circuit method that will not give crz gate, but cu1, as a result, there will be some logical errors.

Here are the codes and corresponding circuits in qasm format for all mentioned 4 gates

$$R_z$$ gate:

circuit_rz = QuantumCircuit(1)
circuit_rz.rz(1.4, 0)
circuit_rz = transpile(circuit_rz, basis_gates=['u1', 'u2', 'u3', 'cx'], optimization_level=0)
---------------------------------------------------------------------------------------------
u1(1.4) q[0];


$$cR_z$$ gate:

circuit_crz = QuantumCircuit(2)
circuit_crz.crz(1.4, 0, 1)
circuit_crz = transpile(circuit_crz, basis_gates=['u1', 'u2', 'u3', 'cx'], optimization_level=0)
---------------------------------------------------------------------------------------------
u1(0.7) q[1];
cx q[0],q[1];
u1(-0.7) q[1];
cx q[0],q[1];


$$u1$$ gate:

circuit_u1 = QuantumCircuit(1)
circuit_u1.u1(1.4, 0)
---------------------------------------------------------------------------------------------
u1(1.4) q[0];


$$cu1$$ gate:

circuit_cu1 = QuantumCircuit(2)
circuit_cu1.cu1(1.4, 0, 1)
circuit_cu1 = transpile(circuit_cu1, basis_gates=['u1', 'u2', 'u3', 'cx'], optimization_level=0)
---------------------------------------------------------------------------------------------
u1(0.7) q[0];
cx q[0],q[1];
u1(-0.7) q[1];
cx q[0],q[1];
u1(0.7) q[1];