The Exercise
Three qubits have the computational basis states , with . Let be a unitary of a single qubit, with matrix (1) in the basis . The exercise asks for a circuit of one qubit gates and controlled NOT gates (CNOTs) that implements the two level unitary of three qubits built from on the states and . On their span it acts as , with in the place of and in the place of ; the other six basis states stay fixed.
The library builds one such circuit: the doubly controlled gate between two copies of a routing unitary made of three CNOTs.
Three Qubits
A quantum system is a physical system whose state space is a finite dimensional complex Hilbert space.✦ The composite system of two systems and is the system whose state space is the tensor product of their state spaces.✦ A pure state of is a unit vector in the state space of , and for pure states of and of the product is the pure state of whose vector is the tensor product of the two vectors.
The qubit is the two level system with state space .✦ Its basis states and are the pure states whose vectors are the standard basis vectors and .✦ Three qubits form the composite system , and its basis state (2) is a product of three basis states of the qubit. In a circuit the three qubits sit on wires , and , from the top.
A unitary of a system is an operator on the state space of with ; it carries a pure state of to the pure state . For two unitaries and of , after is the unitary of , first and then , and the identity evolution of is the unitary . For unitaries of and of , the product unitary is the unitary of whose operator is the tensor product of theirs.✦ Placed on the first wires of , a unitary of becomes ; placed on the last wires, a unitary of becomes . The SWAP of two copies of is the unitary of that exchanges the factors, .✦
The Gates
For a unitary of a system , the controlled gate is the unitary of , a control qubit and the target , with operator (3)✦ The Pauli is the unitary of the qubit with matrix , and the CNOT gate is on two qubits: it flips the second qubit when the first is . With the control below, (4)✦ is the CNOT controlled by the second qubit with the first as target. On three qubits the doubly controlled gate of a unitary of the qubit applies to the qubit on wire exactly when the qubits on wires and are both .✦
A gate of a three qubit circuit is either a one qubit gate, a unitary of the qubit on a chosen wire, or a CNOT with a chosen control wire and target wire; its evolution is a unitary of the three qubits.✦ A one qubit gate on wire , or has the evolution , or .✦ A CNOT with control wire and target wire or is or , conditioned on wire with on the target wire; with control wire and target wire it is , and every other pair of wires gives the identity.✦ The evolution of a list of gates is the product of their evolutions in the order given, (5)✦
The Circuit
The routing is a product of three CNOTs, each with its control below its target: the outer two are and the middle one is the CNOT with its control on wire and its target on wire , (6)✦ The outer two act as , where is addition modulo , and the middle one as .
To define the middle CNOT one regroups the three qubits, since acts on . An identification of a system with a system is a linear isometric bijection from the state space of onto that of , and its inverse identifies with . Along a unitary of becomes the unitary of .✦ The regrouping of three systems , and identifies with by .✦ The middle CNOT is , a unitary of , carried along the inverse of the regrouping to .✦
The two level unitary circuit is .✦
The Claim
Theorem 1. Let be a unitary of the qubit with matrix (1). There is a list of one qubit gates and CNOTs of a three qubit circuit whose evolution is the two level unitary circuit, (7)✦ This circuit sends and to (8)✦ (9)✦ and fixes every other basis state: for neither nor , (10)✦
What Is Checked
The claim is stated over the evolution (5) of a list of gates of a three qubit circuit and over the two level unitary circuit , built from the controlled gate (3), the reversed CNOT (4) and the routing (6), acting on the product basis states (2).
The library proves that the controlled gate is unitary: for every unitary of a system , the operator (3) satisfies . It proves too that products and tensor products of unitaries are unitary, as is a unitary carried along an identification, so that the gates and the circuit are unitaries of the three qubits.