SWAP Gate | Quantum State Exchange & Routing
Quick Technical Answer:
The SWAP gate exchanges the quantum states of two qubits: SWAP|a, b⟩ = |b, a⟩. It decomposes into three alternating CNOT gates: CX(a, b) · CX(b, a) · CX(a, b) and is vital for routing circuits on non-all-to-all chip topologies.
Formula / Unitary:
SWAP = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} = CX_{0,1} \cdot CX_{1,0} \cdot CX_{0,1}
Simulate this in Itachi Quantum Studio
Inspect state amplitudes, 3D Bloch sphere vector, and OpenQASM code live.
Frequently Asked Questions
Why does SWAP add significant overhead in quantum circuits?
Because SWAP decomposes into three 2-qubit CNOT gates, excessive SWAP insertion on constrained hardware topologies drastically increases circuit depth and decoherence noise.