How to realize SWAP operation using iSWAP gate?

The following are the matrices for SWAP and iSWAP gates.

SWAP = $$\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}$$ iSWAP = $$\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & i & 0 \\ 0 & i & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}$$ Both are similar except iSWAP adds a phase to $$|01\rangle$$ and $$|10\rangle$$ amplitudes.

How can the SWAP operation be realized using the iSWAP gate?

• Sorry, I misread your question earlier. Commented Nov 10, 2020 at 0:01

It can't be done in one or two uses of the iSwap because an iSwap is equivalent (up to single qubit rotations) to a SWAP+CZ. A single SWAP+CZ is not a swap. The two swaps in a pair of SWAP+CZs cancel out, leaving you with two CZs (and arbitry single qubit operations around them), which is also not enough to do a swap.

But you can do it with three:

• Can you also post the iSWAP decomposition using SWAP+CZ+single-qubit-rotation? Commented Nov 10, 2020 at 0:03
• I tried applying the above circuit on $|01\rangle$ and got the following state-vector: [0+0j, 0+0j, 0.707-0.707j, 0+0j ]. If I just apply a SWAP, I get [ 0+0j, 0+0j, 1+0j, 0+0j ]. Can both be treated as equivalent? Commented Nov 10, 2020 at 3:04
• @AbdullahAsh-Saki The circuit should be equal up to an unobservable global phase. The two vectors you gave are equivalent up to global phase and so are equivalent. Commented Nov 10, 2020 at 5:42
• Are [ 0+0j, 0+0j, 1+0j, 0+0j ] (using SWAP) and [ 0+0j, 0+0j, 0+1j, 0+0j ] (using iSWAP) are equivalent up to a global phase? Commented Nov 10, 2020 at 19:42

Using matrix multiplication, $$\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & i & 0 \\ 0 & i & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & -i & 0 & 0 \\ 0 & 0 & -i & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}$$ So the question is which gates does the second matrix in the matrix multiplication on the right represent?

A starting point is that the phase gate is $$\begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}$$ and that the Z-gate is $$\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$$, and $$\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}\begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & -i \end{pmatrix}$$. This gets us the upper left portion of the second matrix.

Once we have $$\begin{pmatrix} 1 & 0 \\ 0 & -i \end{pmatrix}$$, we can use the X-gate $$\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$$ and pre-and post-multiply it:$$\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}\begin{pmatrix} 1 & 0 \\ 0 & -i \end{pmatrix}\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} = \begin{pmatrix} -i & 0 \\ 0 & 1 \end{pmatrix}$$. This gets the lower right portion of the second matrix.

• Does this (imgur.com/a/Ym94h0h) circuit match your description? Commented Nov 10, 2020 at 2:12
• In the linked circuit, it looks like the operations on the two qubits are being done in parallel. In my description, they are done separately (tensored with I, which corresponds to just the "wire", on the other qubit) . Commented Nov 10, 2020 at 4:46
• Looks like two dis-joint single-qubit operations cannot achieve this. One needs 2 different 2-qubit gates two achieve the matrix in right. Commented Nov 11, 2020 at 4:28
• I'm not sure I follow. To leave the other qubit unchanged, you can use the identity for it (which would be combined with the operation on the other qubit using the tensor product in matrix notation), right? Commented Nov 11, 2020 at 5:12
• This does not work. Commented Mar 22, 2022 at 10:28

following the question in the comment, here is a decomposition of SWAP in terms of iSWAP + CZ + single qubit rotations:

      ┌───┐ ┌─────┐┌────────┐
q_0: ─┤ H ├─┤ Sdg ├┤0       ├─■──────
┌┴───┴┐└─────┘│  Iswap │ │ ┌───┐
q_1: ┤ Sdg ├───────┤1       ├─■─┤ H ├
└─────┘       └────────┘   └───┘