The three controlled-NOT gates have directions , , and . On computational basis bits they act as
By linearity, the whole quantum circuit is the SWAP gate. Therefore
so and .
After the first Hadamard gate, the joint state is
The controlled SWAP gate then gives
After the second Hadamard gate, it is
Three-CNOT decomposition of the SWAP gate Created 2026-09-24 Updated 2026-09-24
Applying controlled-NOT gates with directions , , and maps
and therefore implements the SWAP gate.