# How to implement the XY Heisenberg interaction using IBMQ and Qiskit?

A possible way to implement the 2 qubit Heisenberg XYZ model using a Quantum computer is to decompose the Hamiltonian as follows: $$H_{XYZ} = H_{XY} + H_{YZ} + H_{XZ}$$. In this case, these operators commute so we can apply the trotter formula to get the unitary evolution $$U = e^{-iH_{XY}t}e^{-iH_{XZ}t}e^{-iH_{YZ}t}$$

Further, using appropriate rotations on the single qubits, $$H_{XZ}$$ and $$H_{YZ}$$ can be expressed using single qubit gates and $$H_{XY}$$, meaning that the evolution $$U$$ should be able to be simulated using only single qubit rotations and the XY interaction ($$H_{XY} = \sigma_1^X\sigma_2^X + \sigma_1^Y\sigma_2^Y$$)

Given this, how can the XY interaction be implemented in IBMQ/Qiskit? Preferably it would be good to be able to do this without the use of an ancillary qubit.

## 1 Answer

First, let's use the fact that $$\sigma^X_1 \sigma^X_2$$ and $$\sigma^Y_1 \sigma^Y_2$$ commute. This means

$$e^{-i H_{XY} t} = e^{-i ~\sigma^X_1 \sigma^X_2~ t} ~ e^{-i ~\sigma^Y_1 \sigma^Y_2~ t}$$

Using appropriate single qubit rotations, $$e^{-i ~\sigma^Y_1 \sigma^Y_2~ t}$$ can be expressed using $$e^{-i ~\sigma^X_1 \sigma^X_2~ t}$$. So now we've reduced the problem to simply implementing $$e^{-i ~\sigma^X_1 \sigma^X_2~ t}$$.

To do this, the important relation to note is that,

$${CX}_{j,k} ~ e^{-i~\sigma^X_j~t} ~ {CX}_{j,k} = e^{-i ~\sigma^X_j \sigma^X_k~t}$$.

So all you need is a couple of cnots, and an appropriate single qubit rotation $$e^{-i~\sigma^X_j~t}$$ implemented on their control qubit. In Qiskit code, here's a two qubit circuit that would implement this (here I named the qubits as $$0$$ and $$1$$ instead of $$1$$ and $$2$$, to reflect the Python indexing convention)

    qc = QuantumCircuit(2)
qc.cx(0,1)
qc.rx(t,0)
qc.cx(0,1)


Following this method would mean using 12 cnots to implement the whole Hamiltonian, which is quite a lot given the fidelities of current devices. Fancier methods are doubtless possible.