The Exercise
Two qubits sit on the two wires of a circuit. A Hadamard gate acts on one wire, and nothing acts on the other. The exercise asks for the unitary matrix of this circuit in the computational basis , once with the Hadamard on the first qubit and once with it on the second. The library states both matrices.
Two Qubits
A quantum system is given by its state space, a finite dimensional complex Hilbert space.✦ The qubit is the system whose state space is .✦ The composite system of two systems and is the system whose state space is the tensor product of the state spaces of and ; the two qubits of the exercise form the composite system .✦
A pure state of 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 state of the qubit, for a bit , is the pure state whose vector is the standard basis vector of .✦ The products are the computational basis states of .
Gates on Two Qubits
A unitary of a system is an operator on the state space of with .✦ The identity evolution of is the unitary whose operator is the identity.✦ For unitaries of and of , the product unitary is the unitary of whose operator is the tensor product of the operators of and .✦ The gate on the first wire of is the product unitary , with the identity evolution on ; the gate on the last wire is .
The Hadamard is the unitary of the qubit whose operator is the matrix (1)✦ acting on .
The matrix of a gate on two qubits, a unitary of , is the complex matrix with rows and columns labelled by pairs of bits and entries (2)✦ The matrix of a matrix labelled in this way relabels both its rows and its columns through , so that they run through in this order.✦
The Claim
Theorem 1. In the computational basis of two qubits, ordered , the matrix of the Hadamard on the first qubit is (3)✦ and the matrix of the Hadamard on the second qubit is (4)✦
What Is Checked
The claim is stated over the Hadamard of the qubit, placed on the first or the last wire of as the product unitary or with the identity evolution, and over the matrix (2) of a gate on two qubits in the basis of product states , relabelled as a matrix.
Of these constructions the library proves that the matrix (1) is unitary, so that its operator on is a unitary of the qubit; that the tensor product of two unitaries is unitary, so that and are unitaries of ; and that each product is a unit vector, since the norm of a product vector is the product of the norms.