# What is the matrix of the iSwap gate?

Mostly I'm confused over whether the common convention is to use +$$i$$ or -$$i$$ along the anti-diagonal of the middle $$2\times 2$$ block.

Mostly I'm confused over whether the common convention is to use +i or -i along the anti-diagonal of the middle 2x2 block.

The former. There are two $+i$'s along the anti-diagonal of the middle $2\times 2$ block of the iSWAP gate. See page 95 here[$\dagger$]. [$\dagger$]: Explorations in Computer Science (Quantum Gates) - Colin P. Williams

Whether you use $+i$ or $-i$ is entirely up to you. After all, your definition of $\pm i$ is merely a convention. On the other hand, I think I've only ever seen it with $+i$.

On a more general footing, you can consider that iSWAP is the gate obtained by time-evolving with an XX interaction ($H=-\sigma_x\otimes\sigma_x - \sigma_y\otimes\sigma_y$), in which case it depends on which sign of $i$ in the Schrödinger equation and for the Hamiltonian you prefer. (You get $+i$ if you evolve with $\exp[-iHt]$, $t=\pi/4$, and chose the minus sign in the Hamiltonian as above, i.e. a ferromagnet).

• You're right that if you globally replace +i by -i in every single gate, that all measurement expectations are identical. But typically you'd be combining the iswap with other existing gates that already have a convention (e.g. $S = \text{diag}(1, i)$), in which case the choice of +i vs -i for the iswap has observable consequences. Here's an example circuit with that property. Jul 4, 2018 at 16:43
• @CraigGidney Sure. But then, again, it depends how you define your other gates, such as $Z^{1/2}$, for which different conventions might be used as well. In practice, for gates which come from a time evolution (such as iSWAP) the 2-qubit gates are likely the ones which fix the choice of $i$, since it is typically easy to reverse the sign of one-qubit Hamiltonians but not of two-qubit Hamiltonians. Jul 4, 2018 at 16:55
• Mathematically, the operation of conjugating all complex numbers is a non-trivial field automorphism of $\mathbb{C}$ that fixes $\mathbb{R}$. In particular, all measurement expectations remain fixed under this symmetry. There do exist other automorphisms of $\mathbb{C}$, but they are wild... Jan 29, 2021 at 3:18