# Phase-Shift Gate in Qiskit

How to implement the phase shift gate in qiskit or ibmq? Phase Shift Gate : $$\begin{pmatrix}e^{ia} && 0 \\ 0 && e^{ia}\end{pmatrix} = e^{ia}I$$

• Why would you want to? Such a phase is a global phase, and therefore irrelevant to further computation. Jun 26 '18 at 17:21
• Maybe it's kind of what would you like to see theoretically. I am working in a problem where a two qubit gate is real (i.e. $\operatorname{SO}(4)$. After applying the decomposition of Kraus and Cirac, the one qubit gates are $\operatorname{SU}(2)$ matrices. Of course these complex phases have to cancel out in order to give $\operatorname{SO}(4)$, but if one wants to implement the gate directly this phase gate is needed. Apr 6 at 12:02

You can implement the phase shift gate $$P_h(\theta) = \begin{pmatrix}e^{i\theta} & 0\\0 & e^{i\theta}\end{pmatrix}$$ with the X and u1 gate from the IBM Q chips: \begin{align} P_h(\theta) &= U_1(\theta)\ X\ U_1(\theta)\ X \\ &= \begin{pmatrix}1 & 0\\0 & e^{i\theta}\end{pmatrix} \begin{pmatrix}0 & 1\\1 & 0\end{pmatrix} \begin{pmatrix}1 & 0\\0 & e^{i\theta}\end{pmatrix} \begin{pmatrix}0 & 1\\1 & 0\end{pmatrix} \\ &= \begin{pmatrix}0 & 1\\e^{i\theta} & 0\end{pmatrix}\begin{pmatrix}0 & 1\\e^{i\theta} & 0\end{pmatrix} \\ &= \begin{pmatrix}e^{i\theta} & 0\\0 & e^{i\theta}\end{pmatrix} \end{align}

So:

def Ph(quantum_circuit, theta, qubit):
quantum_circuit.u1(theta, qubit)
quantum_circuit.x(qubit)
quantum_circuit.u1(theta, qubit)
quantum_circuit.x(qubit)


implements the $$P_h$$ gate on Qiskit.

• I'm wondering if $Ph(\theta)$ would be a better name for this based on "Elementary gates for quantum computation" 1995 paper from Barenco et al. $R_{zz}$ seems to be used for a two-qubit ZZ rotation. Jun 28 '19 at 17:10
• For me, $Ph(\theta)$ stands for $\begin{pmatrix} 1 & 0 \\ 0 & e^{i\theta} \end{pmatrix}$. Moreover, I named this gate $R_{zz}$ because I have already seen this notation somewhere. I don't have references right now though, and you might be right. I'll check when possible. Jun 28 '19 at 17:57
• I see, please link the paper that uses it. $\begin{pmatrix} 1 & 0 \\ 0 & e^{i\theta} \end{pmatrix}$ in my knowledge is $R_z(\theta)$ Jun 29 '19 at 20:27
• My sources are from a closed-source library, which is clearly not the best source I agree. I didn't search extensively in papers yet. After thinking about it, I think you are right, $Ph$ is probably a better name even though it is not the one I am used to. Let me edit, and thank you for the remark! Jul 2 '19 at 12:21