The Exercise
The Toffoli gate acts on three qubits and the gate on one. The exercise asks what conjugation by these gates does to the Pauli operators: for , to and to acting on any one of the three qubits with the identity on the other two, six operators in all; for , to and to on its single qubit.
The library gives the eight answers as identities between matrices in the computational basis, where it defines the gates and the Pauli operators.
Gates and Pauli Operators
The identity and the Pauli matrices are the complex matrices (1) with rows and columns labelled by and . The gate is the diagonal matrix (2)✦
The computational basis states of three qubits, with , are numbered from to by reading as a binary number, the first qubit the most significant: (3)✦ The matrix of an operator on the three qubits has in row and column the matrix element of between the corresponding basis states, (4)✦ and an operator on the three qubits is identified with this matrix.
For , the Pauli operator of the three qubits is the operator that acts as on qubit and as the identity on the other two: (5)✦ (6)✦ (7)✦ The Pauli operator acts as on qubit and as the identity on the other two: (8)✦ (9)✦ (10)✦
The Toffoli gate is the permutation matrix that exchanges the basis states numbered and , which are and , and fixes the other six. With denoting addition modulo , it flips the third qubit exactly when the first two are : (11)✦
The Claim
Theorem 1. Conjugation by the Toffoli gate , with its conjugate transpose, acts on the Pauli operators of the three qubits as (12)✦ (13)✦ (14)✦ (15)✦ (16)✦ (17)✦ where is the identity on the three qubits.
Theorem 2. Conjugation by the gate , with its conjugate transpose, acts on the Pauli matrices as (18)✦ (19)✦
What Is Checked
The six identities for are stated over the Toffoli gate (11) and the operators and , tensor products of the matrices (1) written as matrices by (4) in the numbering (3). The two for are stated over the matrices (1) and (2).