# How to create an Ising coupling gate with Qiskit?

I'm trying to apply a time evolution algorithm for a physical system I'm trying to simulate on QISkit, however, in order to do that, I need to use the so-called Ising coupling gate:

$$I=\begin{pmatrix} e^{ia} & 0 & 0 &0 \\ 0 & e^{-ia} & 0 & 0 \\ 0 & 0 & e^{-ia} & 0 \\ 0 & 0 & 0 & e^{ia} \end{pmatrix}$$

I've tried performing rotations in the z-axis in both quits with the rz gate, also I've tried combining crz gates, as well as rzz and cu1 gates, but nothing seems to work.

The closest I could get was by implementing a zzz gate followed by a cu1 gate with oposite angle, however $$[I]_{1,1}$$ still remains at 1, no phase detected by the Aer unitary simulator.

How can I implement this gate?

Thank you very much in advance.

AHusain's answer is absolutely correct, but perhaps lacks some detail. The circuit that you want to implement is Basically, the key is to realise that you want to apply phase $$e^{i\alpha}$$ to the basis elements $$|00\rangle$$ and $$|11\rangle$$, and $$e^{-i\alpha}$$ otherwise. In other words, you care about the parity of the two bits. If you can compute that parity of the two bits somewhere, you can perform a phase gate on that output, then undo the computation. Controlled-not computes the parity.

Here, I'm assuming that $$R_z(\alpha)=\left(\begin{array}{cc} e^{i\alpha} & 0 \\ 0 & e^{-i\alpha} \end{array}\right).$$ This might be inconsistent with whatever definition you wish to use by a global phase or by a factor of 2 on the angle.

• I followed the circuit you draw using: circ.cx(q,q) circ.rz(a,q) circ.cx(q,q) with $a$ being a parameter y defined previously. However $[I]_{1,1}$ and $[I]_{4,4}$ still remained at 1, with no phase at all. Jul 15, 2019 at 13:53
• @JorgeRodríguezPeña So you've got what you want up to a global phase. Global phases don't matter. Jul 15, 2019 at 14:22
• Did the others get the right phase or a factor of 2 off? Jul 15, 2019 at 14:40

Conjugate by a CNOT, you'll see a controlled unitary of multiplying by $$e^{\pm 2i a}$$ depending on which CNOT you do and an overall phase of $$e^{\mp i a}$$.

I guess what you may need is the Pauli operators:

https://qiskit.org/documentation/_modules/qiskit/quantum_info/operators/pauli.html

https://www.sciencedirect.com/topics/engineering/pauli-operator

rzz gate works, if you want to apply rzz gate between qubit q0 and q1 for a circuit named as circ, you write

$$\mathrm{circ.rzz}(\theta, q0,q1)$$

This performs $$\theta$$ rotation for the two-qubit state,by applying the following matrix $$\begin{equation} R_{Z Z}(\theta)=\exp \left(-i \frac{\theta}{2} Z \otimes Z\right)=\left(\begin{array}{cccc} e^{-i \frac{\theta}{2}} & 0 & 0 & 0 \\ 0 & e^{i \frac{\theta}{2}} & 0 & 0 \\ 0 & 0 & e^{i \frac{\theta}{2}} & 0 \\ 0 & 0 & 0 & e^{-i \frac{\theta}{2}} \end{array}\right) \end{equation}$$

Of course, not all quantum computers has 'rzz' as a native gate, in that case you need to decompose it in terms of the native gates. But for simulation purpose this works.