Source-verifiedLevel 2
SWAP Gate
The SWAP gate exchanges the quantum states of two qubits, implemented as three consecutive CNOT gates.
See it move
A free signup brings you straight back to this concept.
What it means
The SWAP gate exchanges the complete quantum states of two qubits: SWAP|ψ⟩|φ⟩ = |φ⟩|ψ⟩.It can be decomposed into three CNOT gates: CNOT(1,2) * CNOT(2,1) * CNOT(1,2).The SWAP gate preserves entanglement and all quantum properties during the exchange.It is essential in quantum circuits where qubit connectivity is limited -- when two qubits that need to interact are not physically adjacent, SWAP gates route quantum information.The square root of SWAP (√SWAP) is also important as it is a universal entangling gate.Everyday analogy
The SWAP gate is like two people exchanging seats -- each person moves to the other's position, carrying all their belongings (quantum state) with them.
Think of it as swapping two labeled containers without opening them -- the contents are exchanged perfectly.
Common misconceptions
- SWAP does NOT copy states -- it exchanges them, consistent with no-cloning.
- SWAP requires 3 CNOTs -- it is not a primitive gate on most hardware and is expensive.
Key takeaways
- SWAP exchanges the states of two qubits: SWAP|ψ⟩|φ⟩ = |φ⟩|ψ⟩.
- Decomposed into three CNOT gates.
- Essential for qubit routing in limited-connectivity architectures.
Check your understanding
How many CNOT gates are needed to implement a SWAP gate?
- A.1
- B.2
- C.3
- D.4
Show the answer
Answer: C. 3
Why: A SWAP gate requires exactly 3 CNOT gates for its decomposition.
Builds on
Builds toward
Related concepts
Primary source: Barenco et al., Phys. Rev. A 52, 3457 (1995), doi:10.1103/PhysRevA.52.3457
SWAP = 3 CNOT decomposition is an elementary identity.
Learn it hands-on
This concept is part of a 46-level curriculum with an interactive simulator and Lumen, a tutor that checks its answers and labels how sure each one is. Levels 1–5 are free.
