The Exercise
The Hadamard gate acts on one qubit as the matrix (1) in the computational basis ; its entries are written , for bits and . Applied to each of qubits at once it gives the Hadamard transform . The exercise asks for its matrix elements between computational basis states, labelled by strings and of bits, in closed form for every , and for the matrix of written out in full.
The Hadamard Transform
The Hadamard transform on qubits is the real matrix with rows and columns labelled by the strings of bits, defined by recursion on : (2)✦ where and are and with their first bits removed. On no qubits there is a single string, the empty one. The recursion is the tensor product written entry by entry, with the first qubit split off. The entry in row and column is the matrix element .
The basis order for two qubits is the list of the four strings of two bits in the order of the computational basis : (3)✦ In this order is the matrix whose entry in row and column is .
The Claim
For strings and of bits, counts the places where both carry a , and is exactly when that count is odd.
Theorem 1. Let be a number of qubits and let and be strings of bits. The matrix element of the Hadamard transform between them is (4)✦ On two qubits, in the order (3), the Hadamard transform is the matrix (5)✦
What Is Checked
The claim is stated over the Hadamard transform built from the gate (1) by the recursion (2), and, on two qubits, over the basis order (3). The library proves that every matrix element of , for every number of qubits, has the closed form (4), and that the transform on two qubits, read in that order, is the matrix (5).