Swapping Qubit States
Select the states for two qubits, and . The quantum circuit consisting of three CNOT gates swaps the states as time progresses from left to right to produce the output. The intermediate state after each CNOT gate is also displayed. Quantum wire coloring, unique for each qubit state, illustrates the changing qubit state. The dashed line indicates an entangled state, and the same coloring indicates common qubit state.
The three CNOT (Controlled NOT) gates each have a control input (the solid black circle) that affects the target input (the XOR symbol). If the control input is a , then the target output is the same as the target input. If the control input is a , then the target output is the target input inverted. The control input can also be in an entangled state, so it is both a and at the same time (something that can occur only in quantum, not classical, computing). The three gates, when placed in the serial arrangement shown in the diagram, will swap the states of the two input qubits as time progresses from left to right.
Reference: M. Nielsen and I. Chuang, Quantum Computation and Quantum Information, Cambridge, UK: Cambridge University Press, 2000.