Lean, informalized

Nielsen & Chuang · Chapter 4, Quantum circuits · p. 185

Exercise 4.31 - What a CNOT gate does to a Pauli gate on either qubit, and two rotations that commute with it

Pushing Pauli operators through a CNOT gate.

Hover over a blue or green term in the text, or a node in the graph, to find it in the other. Select it to read its declaration both in Lean and in words.

The Exercise

Two qubits pass through a controlled-NOT (CNOT) gate CC, the first qubit as control and the second as target. Write X1X_1 for the Pauli XX applied to the first qubit with the second left alone, X2X_2 for XX applied to the second, and Y1Y_1, Y2Y_2, Z1Z_1, Z2Z_2 in the same way. The exercise asks what each of these six operators becomes when it is sandwiched between two CNOTs, as in CX1CC X_1 C; in every case the answer is a Pauli on one qubit or a product of Paulis on the two. It also asks for two rotations that commute with the CNOT: the rotation Rz(θ)R_z(\theta) about the zˆ\hat z axis applied to the control, and the rotation Rx(θ)R_x(\theta) about the xˆ\hat x axis applied to the target.

The library states all eight identities as equalities between unitaries of the two qubits.

Two Qubits

A quantum system SS is a physical system whose state space is a finite dimensional complex Hilbert space.✦ For such a space HH there is the quantum system whose state space is HH, and the qubit is the quantum system whose state space is ℂ2\mathbb{C}^2. The composite system S⊗TS \otimes T of two systems SS and TT is the quantum system whose state space is the tensor product of their state spaces; the exercise takes place in qubit⊗qubit\mathrm{qubit} \otimes \mathrm{qubit}.✦

A pure state |ψ⟩\lvert \psi \rangle of SS is a unit vector in the state space of SS, determined physically up to a global phase.✦ The computational basis states |0⟩\lvert 0 \rangle and |1⟩\lvert 1 \rangle of the qubit are the pure states given by the standard basis vectors e0e_0 and e1e_1 of ℂ2\mathbb{C}^2.✦

A unitary UU of SS is an operator on the state space of SS with U†U=UU†=1U^\dagger U = U U^\dagger = 1, the evolution of SS as a closed system.✦ The identity evolution of SS is the unitary 11.✦ For two unitaries UU and VV of SS, the unitary UU after VV is UVUV, first VV and then UU; a product such as CX1CC X_1 C is a composite in this sense.✦ For a unitary UU of SS and a unitary VV of TT, the product unitary U⊗VU \otimes V is the unitary of S⊗TS \otimes T whose operator is the tensor product of the operators of UU and VV.✦

A gate on one factor of a composite system S⊗TS \otimes T is a product unitary of S⊗TS \otimes T that acts as the identity evolution on the other factor. For a unitary UU of SS and a second system TT, the gate UU on the first factor is the unitary U⊗1U \otimes 1 of S⊗TS \otimes T; for a unitary VV of TT, the gate VV on the second factor is 1⊗V1 \otimes V.

The Gates

The Pauli matrices are the complex 2×22 \times 2 matrices X=(0110),Y=(0−ii0),Z=(100−1).X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \qquad Y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}, \qquad Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}.(1) The Pauli gates XX, YY and ZZ of the qubit are the unitaries whose operators have the matrices (1) in the computational basis; XX is the quantum NOT, or bit flip, and ZZ the phase flip.

For a real vector n→\vec n in three dimensions, the matrix n→⋅σ→\vec n \cdot \vec \sigma is nxX+nyY+nzZn_x X + n_y Y + n_z Z, the combination of the Pauli matrices with the components of n→\vec n as coefficients.✦ The rotation Rn→(θ)R_{\vec n}(\theta) about n→\vec n by a real angle θ\theta is the complex 2×22 \times 2 matrix Rn→(θ)=exp⁡(−iθ2n→⋅σ→),R_{\vec n}(\theta) = \exp\!\left(-\frac{i\theta}{2}\, \vec n \cdot \vec \sigma\right),(2)✦ written Rnˆ(θ)R_{\hat n}(\theta) when the axis is a unit vector nˆ\hat n. The rotations about the axes xˆ=(1,0,0)\hat x = (1, 0, 0) and zˆ=(0,0,1)\hat z = (0, 0, 1) are Rx(θ)=e−iθX/2R_x(\theta) = e^{-i\theta X/2} and Rz(θ)=e−iθZ/2R_z(\theta) = e^{-i\theta Z/2}. For a real angle θ\theta, the rotation gates Rx(θ)R_x(\theta) and Rz(θ)R_z(\theta) are the unitaries of the qubit whose operators have these matrices in the computational basis.

For a unitary UU of a system SS, the controlled gate C(U)C(U) is the unitary of qubit⊗S\mathrm{qubit} \otimes S, a control qubit together with the target SS, whose operator is C(U)=|0⟩⟨0|⊗1+|1⟩⟨1|⊗U.C(U) = \lvert 0 \rangle\langle 0 \rvert \otimes 1 + \lvert 1 \rangle\langle 1 \rvert \otimes U.(3) The CNOT gate CC is the controlled gate C(X)C(X) on two qubits, which flips the second qubit exactly when the first is |1⟩\lvert 1 \rangle.✦

The Claim

A subscript names the wire a gate of the qubit acts on: X1=X⊗1X_1 = X \otimes 1 is XX on the control, Y2=1⊗YY_2 = 1 \otimes Y is YY on the target, and in the same way Rz,1(θ)=Rz(θ)⊗1R_{z,1}(\theta) = R_z(\theta) \otimes 1 and Rx,2(θ)=1⊗Rx(θ)R_{x,2}(\theta) = 1 \otimes R_x(\theta).

Theorem 1. Let CC be the CNOT gate on two qubits, the first the control and the second the target. A Pauli gate on either qubit, placed between two CNOTs, becomes CX1C=X1X2,C X_1 C = X_1 X_2,(4)✦ CX2C=X2,C X_2 C = X_2,(5)✦ CY1C=Y1X2,C Y_1 C = Y_1 X_2,(6)✦ CY2C=Z1Y2,C Y_2 C = Z_1 Y_2,(7)✦ CZ1C=Z1,C Z_1 C = Z_1,(8)✦ CZ2C=Z1Z2,C Z_2 C = Z_1 Z_2,(9)✦ and for every real angle θ\theta the rotations Rx,2(θ)R_{x,2}(\theta) and Rz,1(θ)R_{z,1}(\theta) commute with CC: Rx,2(θ)C=CRx,2(θ),R_{x,2}(\theta)\, C = C\, R_{x,2}(\theta),(10)✦ Rz,1(θ)C=CRz,1(θ).R_{z,1}(\theta)\, C = C\, R_{z,1}(\theta).(11)✦

What Is Checked

The identities are stated over the CNOT gate, the controlled gate C(X)C(X), and over the Pauli gates and the rotation gates Rx(θ)R_x(\theta) and Rz(θ)R_z(\theta) on either qubit.

About these constructions the library proves that the controlled gate is unitary: for every unitary UU of a system SS, the operator (3) satisfies C(U)†C(U)=C(U)C(U)†=1C(U)^\dagger C(U) = C(U) C(U)^\dagger = 1.✦ It proves the same of the composite and of the tensor product of two unitaries.