The Exercise
The exercise asks for a quantum circuit on three qubits that leaves the basis state alone and moves each of the other seven computational basis states one step along a single cycle. On the labels this is the partial cyclic permutation of triples of bits: (1)✦ The library’s answer is a circuit of eight gates, each a controlled NOT (CNOT) gate or a Toffoli gate on some of the three qubits.
Three Qubits
A quantum system is described by its state space, a finite dimensional complex Hilbert space.✦ The composite system of two systems and has for its state space the tensor product of their state spaces.✦ The qubit is the system whose state space is , and three qubits form the composite system .
A pure state of a system is a unit vector in the state space of .✦ For pure states of and of , the product is the pure state of whose vector is the tensor product of the two vectors.✦ The basis states and of the qubit are the pure states given by the standard basis vectors and of , and for bits , , the basis state of three qubits is the product (2)
Gates
A unitary of a system is an operator on the state space of with ; it carries a pure state of to the pure state . The composite of two unitaries and of applies first , then , and the identity evolution of is the unitary . For unitaries of and of , the product unitary of is the tensor product of the two operators.✦ A gate on a system of qubits is a unitary of that system; on a composite system, a gate acting on the first factor alone is , and one acting on the last factor alone is .
The Pauli , the quantum NOT, is the unitary of the qubit with matrix (3)✦ For a unitary of a system , the controlled gate is the unitary of , with the qubit as control and as target, given by (4)✦ The CNOT gate of two qubits is .✦ For a unitary of the qubit, controlling once more gives the doubly controlled gate of three qubits, which applies to the third qubit when the first two are both ; the Toffoli gate is .
A unitary of a system is the same thing as a linear isometric bijection of the state space of onto itself.✦ The SWAP of two copies of is the unitary of given by the isometry that exchanges the factors, .✦ The reversed CNOT of two qubits, the CNOT with its control on the second qubit and its target on the first, is the unitary of obtained by conjugating the CNOT with the SWAP of two qubits: (5)✦
The Circuit
Write for a CNOT on three qubits with control on qubit and target on qubit , and for a Toffoli gate with controls on qubits and and target on qubit . On , is the Toffoli gate itself; and are controlled by the first qubit; and act on the last two.
An identification of a system with a system is a linear isometric bijection of the state space of onto that of ; its inverse identifies with , and a unitary of is carried along to the unitary of . The regrouping of three systems , , is the identification of with that sends to .✦ The gate is on carried along to three qubits: (6)✦
The circuit for the partial cyclic permutation is the unitary of three qubits that applies these gates in turn, the rightmost first: (7)✦
The Claim
Theorem 1. Let , , be bits, and let be their image under the partial cyclic permutation (1). Then the circuit of (7) satisfies (8)✦
What Is Checked
The claim is stated over the circuit of (7), the basis states (2) and the permutation of (1).
About these constructions the library proves that the controlled gate of (4) is unitary for every unitary of every system , .✦ With it, and with the unitarity of , of composites and tensor products of unitaries and of a unitary carried along an identification, every gate of (7) and the circuit itself are unitaries of three qubits.