I know that the two qubit gate generated by $H=X\otimes X$ is $\exp\{-\text{i}\theta X\otimes X\}=\cos{\theta} \mathbb1 \otimes \mathbb1 - \text{i} \sin{\theta} X \otimes X$, where $X$ is the $\sigma_x$ Pauli matrix. Now, if we moved to the Hamiltonian $H= X\otimes X + Y \otimes Y + Z \otimes Z$, how can we find the two qubit gate?
2 Answers
TL;DR: The two-qubit gate corresponding to the Hamiltonian is the SWAP gate.
For an operator $A$ that squares to identity $A^2=I$, we have $e^{i\theta A} = I\cos\theta +iA\sin\theta$. In our case the Hamiltonian does not square to identity
$$ (X\otimes X + Y\otimes Y + Z\otimes Z)^2 \ne I\otimes I. $$
However, we can tweak it by adding a constant term since this only affects the unobservable global phase. We note that
$$ \frac{I\otimes I + X\otimes X + Y\otimes Y + Z\otimes Z}{2} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} = \text{SWAP} $$
does square to identity. Thus, we can write
$$ \exp\left(-\frac{i\gamma}{2}(I\otimes I + X\otimes X + Y\otimes Y + Z\otimes Z)\right) = I\cos\gamma -\text{SWAP}\, i\sin\gamma $$
which means that the Hamiltonian generates the fractional SWAP gate
$$ \exp\left(-\frac{i\gamma}{2}(X\otimes X + Y\otimes Y + Z\otimes Z)\right) = e^{\frac{i\gamma}{2}}(I\cos\gamma -\text{SWAP}\, i\sin\gamma). $$
When $\theta=\frac{\gamma}{2}=k\frac{\pi}{4}$ and $k$ is an odd integer then the evolution swaps the two qubits and when $k$ is an even integer then it acts as identity.
If SWAP is unavailable, the evolution generated by the Hamiltonian can also be implemented for example using two CNOTs and a controlled rotation
$$ \exp\left(-\frac{i\gamma}{2}(X\otimes X + Y\otimes Y + Z\otimes Z)\right) \\= C_2NOT_1 \circ C_1R_{2,x}(2\gamma) \circ (R_{1,z}(\gamma) \otimes I_2) \circ C_2NOT_1 $$
where we also use an $R_z$ gate to correct the phase of the central $2\times 2$ block of the matrix.
- 25,260
- 3
- 40
- 95
Perhaps not surprisingly, the gate is $\exp(-i \theta (X \otimes X + Y \otimes Y + Z \otimes Z))$.
More usefully, the terms that are being summed happen to commute so you can decompose the problem into $\exp(-i \theta X \otimes X) \cdot \exp(-i \theta Y \otimes Y) \cdot \exp(-i \theta Z \otimes Z)$.
import cirq
from cirq import X, Y, Z
import math
theta = math.pi / 6
a, b = cirq.LineQubit.range(2)
xx = math.e(-1j * theta * X(a)*X(b))
yy = math.e(-1j * theta * Y(a)Y(b))
zz = math.e(-1j theta * Z(a)*Z(b))
print(cirq.unitary(cirq.Circuit(xx, yy, zz)).round(4))
[[0.866-0.5j 0. +0.j 0. +0.j 0. +0.j ]
[0. +0.j 0.433+0.25j 0.433-0.75j 0. +0.j ]
[0. +0.j 0.433-0.75j 0.433+0.25j 0. +0.j ]
[0. +0.j 0. +0.j 0. +0.j 0.866-0.5j ]]
- 44,299
- 1
- 41
- 116