Lean, informalized

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

Exercise 4.23 - The controlled Rx(θ)R_x(\theta) and Ry(θ)R_y(\theta) gates as two qubit circuits with single qubit gates on the target

Controlled rotations from two controlled NOT gates.

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

Take two qubits, a control and a target, and a real angle θ\theta. The exercise asks for a circuit that applies the rotation Rx(θ)R_x(\theta) about the xˆ\hat x axis to the target when the control is |1⟩\lvert 1\rangle and leaves the target alone when the control is |0⟩\lvert 0\rangle, and for the same circuit with the rotation Ry(θ)R_y(\theta) about the yˆ\hat y axis. The circuits are built from controlled NOT (CNOT) gates and single qubit gates.

The library states the answer for every real angle θ\theta as two equalities between unitaries of the two qubits.

Qubits and Unitaries

A quantum system is a physical object whose state space is a finite dimensional complex Hilbert space.✦ The composite system S⊗TS \otimes T of two quantum systems SS and TT is the quantum system whose state space is the tensor product of the state spaces of SS and TT.✦ The qubit is the two level quantum system whose state space is ℂ2\mathbb{C}^2.✦

A pure state ψ\psi of a quantum system SS is a vector of unit norm in the state space of SS.✦ The computational basis states |0⟩\lvert 0\rangle and |1⟩\lvert 1\rangle of the qubit are the pure states whose vectors are the standard basis vectors e0e_0 and e1e_1 of ℂ2\mathbb{C}^2.✦

A unitary UU of a quantum system SS is an operator on the state space of SS with U†U=UU†=1U^\dagger U = U U^\dagger = 1, an evolution of SS as a closed system.✦ The identity evolution of SS is the unitary 11.✦ For unitaries UU and VV of SS, the unitary UU after VV is their composite UVUV: first VV acts, then UU.✦

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.✦ The gate VV on the second factor of S⊗TS \otimes T is the product unitary 1⊗V1 \otimes V, with the identity evolution on SS and VV on TT.✦

Single Qubit Gates

The Pauli matrices are 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) and for a real vector n→=(nx,ny,nz)\vec n = (n_x, n_y, n_z) in three dimensions the matrix n→⋅σ→\vec n \cdot \vec\sigma is nxX+nyY+nzZn_x X + n_y Y + n_z Z. For such a vector and a real angle θ\theta, the rotation matrix Rn→(θ)R_{\vec n}(\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)✦ and for a unit vector nˆ\hat n it is the rotation Rnˆ(θ)R_{\hat n}(\theta) by θ\theta about the axis nˆ\hat n. The rotations about the coordinate axes are the cases nˆ=(1,0,0)\hat n = (1, 0, 0), (0,1,0)(0, 1, 0) and (0,0,1)(0, 0, 1) of (2): Rx(θ)=e−iθX/2,Ry(θ)=e−iθY/2,Rz(θ)=e−iθZ/2.R_x(\theta) = e^{-i\theta X/2}, \qquad R_y(\theta) = e^{-i\theta Y/2}, \qquad R_z(\theta) = e^{-i\theta Z/2}.(3) The Hadamard matrix is H=12(111−1).H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}.(4)✦

The Pauli XX gate, the quantum NOT, is the unitary of the qubit whose matrix in the computational basis is XX of (1), and the Hadamard gate HH is the unitary of the qubit whose matrix is (4). For a real angle θ\theta, the rotation gates Rx(θ)R_x(\theta), Ry(θ)R_y(\theta) and Rz(θ)R_z(\theta) are the unitaries of the qubit whose matrices in the computational basis are those of (3).

Controlled Gates

For a unitary UU of a quantum system SS, the controlled gate C(U)C(U) is the unitary of the composite of a control qubit with the target SS given by 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,(5)✦ with |0⟩⟨0|\lvert 0\rangle\langle 0\rvert and |1⟩⟨1|\lvert 1\rangle\langle 1\rvert the projectors onto the computational basis states of the control. The CNOT gate is the controlled gate C(X)C(X) of two qubits, with the Pauli XX gate acting on the target.✦

The Claim

Theorem 1. Let θ\theta be a real angle. On two qubits, the first the control and the second the target, the controlled rotations about xˆ\hat x and about yˆ\hat y are C(Rx(θ))=(1⊗H)(1⊗Rz(θ/2))CNOT(1⊗Rz(−θ/2))CNOT(1⊗H)C(R_x(\theta)) = (1 \otimes H)\,(1 \otimes R_z(\theta/2))\,\mathrm{CNOT}\, (1 \otimes R_z(-\theta/2))\,\mathrm{CNOT}\,(1 \otimes H)(6)✦ and C(Ry(θ))=(1⊗Ry(θ/2))CNOT(1⊗Ry(−θ/2))CNOT.C(R_y(\theta)) = (1 \otimes R_y(\theta/2))\,\mathrm{CNOT}\, (1 \otimes R_y(-\theta/2))\,\mathrm{CNOT}.(7)✦

What Is Checked

The two equalities are stated over the controlled gate C(U)C(U) of (5), with the rotation gates Rx(θ)R_x(\theta) and Ry(θ)R_y(\theta) as UU and with the Pauli XX gate as UU in the CNOT, and over the gates 1⊗H1 \otimes H, 1⊗Ry1 \otimes R_y and 1⊗Rz1 \otimes R_z on the target, composed one after another as unitaries of two qubits.

The library proves that the controlled gate C(U)C(U) is unitary for every unitary UU of every quantum system, C(U)†C(U)=C(U)C(U)†=1C(U)^\dagger C(U) = C(U) C(U)^\dagger = 1.✦ The product U⊗VU \otimes V and the composite UVUV of two unitaries are again unitary, and so is each single qubit gate, since its matrix is.