The Exercise
Two qubits are in a state that is diagonal in the computational basis , , , , with populations , , , .✦ A circuit of two controlled NOT (CNOT) gates acts on them: first a CNOT with the first qubit as control, then a CNOT with the second qubit as control.✦ The exercise is to show that the state after the circuit, and the state after its adjoint , are again diagonal: the population of stays in place, and those of the other three basis states are permuted cyclically, in one sense under and in the other under .
Two Qubits and Two Gates
All matrices below are written in the computational basis, in the order above. The CNOT gate , with control on the first qubit and target on the second, is the matrix that exchanges and and leaves and in place: (1)✦ The CNOT gate , with control on the second qubit and target on the first, is the matrix that exchanges and and leaves and in place: (2)✦
The circuit on the two qubits is the product of the two gates: (3)✦
For any four complex numbers , , , , not only the populations of a state, the diagonal matrix is the matrix with , , , on its diagonal, in the order of the basis, and zeros elsewhere: (4)✦ The permuted matrices and are the diagonal matrices with the same four numbers in two other orders: (5) (6)
The Claim
Theorem 1. Let , , , be complex numbers, and let , , be the diagonal matrices (4), (5) and (6) built from them. Then (7)✦ and (8)✦
What Is Checked
The claim is stated over the circuit of (3), built from the two CNOT matrices (1) and (2), and over the diagonal matrices , , . What the library proves about these constructions is the pair of identities (7) and (8), as equalities of complex matrices.