SWAP Gates

Get an overview of SWAP gates in quantum computing.

Before moving on to more quantum algorithms, we want to introduce one more two-qubit gate: the SWAP\text{SWAP} gate. As the name implies, the SWAP\text{SWAP} gate interchanges something between two qubits. That something is their quantum states. Although the algorithms we discuss in the remainder of this book do not require SWAP\text{SWAP} gates, they are found in many other quantum algorithms, so we thought you should be introduced to them. They also provide another nice example of using matrices to represent quantum gates.

Since we are dealing with two qubits, the basis states can be taken to be the four-entry column vectors in this tableTable_9_2 We need a 4×44 × 4 matrix to represent operations on those vectors. The SWAP\text{SWAP} operator that interchanges the states 01|01⟩ and 10|10⟩ has the following matrix representation in that column vector basis:

Get hands-on with 1400+ tech skills courses.