Skip to main content
KetQat

Appearance

Equation · introductory

SWAP from three CNOTs

Three alternating CNOT gates exchange the states of two qubits. A SWAP therefore costs three native CNOTs, the basic price of moving quantum data on hardware with limited connectivity.

Established resultMachine-checkedUpdated 2026-12-01 · last verified 2026-12-01

AI-assisted text, machine-checked, not yet reviewed by a person. Citations resolve and an automated pass compared the statements with the cited sources. That is not peer review; check the sources for anything you depend on.

SWAP  =  CNOT1→2  CNOT2→1  CNOT1→2\mathrm{SWAP} \;=\; \mathrm{CNOT}_{1\to 2}\; \mathrm{CNOT}_{2\to 1}\; \mathrm{CNOT}_{1\to 2}

On a basis state ∣x,y⟩\ket{x, y} the three gates give ∣x,x⊕y⟩\ket{x, x\oplus y}, then ∣x⊕x⊕y, x⊕y⟩=∣y,x⊕y⟩\ket{x \oplus x \oplus y,\, x\oplus y} = \ket{y, x\oplus y}, then ∣y,y⊕x⊕y⟩=∣y,x⟩\ket{y, y \oplus x \oplus y} = \ket{y, x}. Both sides are linear and agree on a basis, so they are equal; identities of this kind are collected in chapter 4 of Nielsen and Chuang. The middle CNOT may be reversed with Hadamards, CNOT2→1=(H⊗H) CNOT1→2 (H⊗H)\mathrm{CNOT}_{2\to1} = (H\otimes H)\,\mathrm{CNOT}_{1\to2}\,(H\otimes H), when the hardware supports only one direction. By the parameter-counting bound three is also the generic minimum for two-qubit gates.

A related bridge identity implements a CNOT between the ends of a three-qubit line 0−1−20 - 1 - 2 without moving data: in time order CNOT0→1, CNOT1→2, CNOT0→1, CNOT1→2\mathrm{CNOT}_{0\to1},\ \mathrm{CNOT}_{1\to2},\ \mathrm{CNOT}_{0\to1},\ \mathrm{CNOT}_{1\to2} maps ∣a,b,c⟩\ket{a, b, c} to ∣a,b,c⊕a⟩\ket{a, b, c \oplus a}, which is CNOT0→2\mathrm{CNOT}_{0\to2}.

Holds when

  • CNOTi→j\mathrm{CNOT}_{i\to j} has control ii and target jj; exact equality, no phase.
Mentioned in
Stated in

Open in the knowledge graph

Contributions about this record

Nobody has published a contribution about it yet.

Publish a result, reproduction or commentPropose a correction to this page

References

  1. Michael A. Nielsen, Isaac L. Chuang (2010). Quantum Computation and Quantum Information (10th Anniversary Edition). Cambridge University Press. doi:10.1017/CBO9780511976667

Contributors

  • KetQat maintainers · @ketqatConceptualization; Supervision (CRediT roles)
  • Claude (AI drafting assistant)Writing, original draft (CRediT roles)

Review history

  1. Automated source check · Pass · 2026-12-01 · Independent automated verification pass (AI, not the drafting session)

    SWAP = CNOT12 CNOT21 CNOT12, the Hadamard-conjugation reversal of CNOT, and the four-CNOT bridge identity (time order 01,12,01,12 equals CNOT 0->2) verified numerically as 4x4/8x8 permutation matrices with numpy; basis-state derivation re-derived by hand. Nielsen and Chuang (2010) is cited only as a collection of such identities (standard textbook material, not openly readable; independent derivation used). Cross-link to the parameter-counting bound checked against Shende-Markov-Bullock 2004 Prop. III.1.

Revision history

  1. 2026-12-01Content release 2.1.0: 35 more topics, an independent source check of every record, intake hardening (#17)80537b7e

Current revision c61a899471e6dfa2. Source file knowledge/records/equation/swap-from-three-cnots.md in the content repository (readable there once it is public).