Table of Contents

SWAP Gate

SWAP exchanges the states of two qubits. If qubit 1 is in state $|a\rangle$ and qubit 2 is in state $|b\rangle$, after SWAP they exchange.

Matrix:

$$\text{SWAP} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}$$

Action: $|ab\rangle \to |ba\rangle$ (swap basis state labels).

Properties

Decomposition

SWAP can be built from three CNOT gates:

$$\text{SWAP} = \text{CX}_{01} \text{CX}_{10} \text{CX}_{01}$$

This decomposition is commonly used since CNOT is more readily available.

Uses

Trade-offs

Implementation