Lean, informalized

Nielsen & Chuang · Chapter 10, Quantum error-correction · p. 474

Exercise 10.58 - A controlled unitary between two Hadamard gates, in general and for the Pauli ZZ and XX

Measuring an observable through a control qubit.

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

A unitary UU acts on a quantum system SS. An extra qubit, the control, is prepared in |0⟩|0\rangle beside a state |ψ⟩|\psi\rangle of SS. A Hadamard gate acts on the control, then a controlled gate applies UU to SS when the control is |1⟩|1\rangle and leaves SS alone when it is |0⟩|0\rangle, and a second Hadamard acts on the control before the control is measured in the computational basis. Find the joint state just before that measurement. Then take SS to be a qubit and UU the Pauli ZZ or XX: write the circuit as a controlled-NOT gate (CNOT), with Hadamard gates around it in the case of XX, and evaluate it on the eigenstates of UU.

Systems and States

A quantum system SS comes with a state space, a finite dimensional complex Hilbert space.✦ A pure state |ψ⟩|\psi\rangle of SS is a vector of unit norm in the state space of SS.✦

The composite system S⊗TS \otimes T of two systems SS and TT is the system whose state space is the tensor product of their state spaces.✦ For pure states |ψ⟩|\psi\rangle of SS and |φ⟩|\varphi\rangle of TT, the product |ψ⟩⊗|φ⟩|\psi\rangle \otimes |\varphi\rangle is the pure state of S⊗TS \otimes T whose vector is the tensor product of the two vectors.✦

The qubit is the quantum system whose state space is ℂ2\mathbb{C}^2.✦ Its basis states |0⟩|0\rangle and |1⟩|1\rangle are the pure states whose vectors are the standard basis vectors e0e_0 and e1e_1 of ℂ2\mathbb{C}^2.✦

Unitaries and Gates

A unitary UU of a system SS is an operator on the state space of SS with U†U=UU†=1U^\dagger U = U U^\dagger = 1✦; it carries a pure state |ψ⟩|\psi\rangle of SS to the pure state U|ψ⟩U|\psi\rangle.✦ Two unitaries UU and VV of SS compose to the unitary UVUV, which applies VV first and then UU✦, and the identity 11 of SS is itself a unitary.✦ Given a unitary UU of SS and a unitary VV of TT, their product unitary U⊗VU \otimes V is the unitary of S⊗TS \otimes T whose operator is the tensor product of the two operators.✦ A gate UU on the first factor alone is U⊗1U \otimes 1✦, and a gate VV on the last factor alone is 1⊗V1 \otimes V.✦

The Hadamard gate HH and the Pauli gates XX and ZZ are the unitaries of the qubit whose matrices in the computational basis are H=12(111−1),X=(0110),Z=(100−1).H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}, \qquad X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \qquad Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}.(1) The states |+⟩|+\rangle and |−⟩|-\rangle are the pure states of the qubit |±⟩=12(|0⟩±|1⟩),|\pm\rangle = \frac{1}{\sqrt{2}} \bigl( |0\rangle \pm |1\rangle \bigr),(2) the eigenvectors of XX with eigenvalues +1+1 and −1-1.

For a unitary UU of a system SS, the controlled gate C(U)C(U) is the unitary of the composite qubit⊗S\mathrm{qubit} \otimes S of a control qubit and a target SS given by C(U)=|0⟩⟨0|⊗1+|1⟩⟨1|⊗U.C(U) = |0\rangle\langle 0| \otimes 1 + |1\rangle\langle 1| \otimes U .(3)✦ The CNOT gate is the controlled gate C(X)C(X) on two qubits.✦

The SWAP of two copies of a system SS is the unitary of S⊗SS \otimes S that exchanges the factors, SWAP(|a⟩⊗|b⟩)=|b⟩⊗|a⟩\mathrm{SWAP}\,(|a\rangle \otimes |b\rangle) = |b\rangle \otimes |a\rangle.✦ The reversed CNOT CNOTrev\mathrm{CNOT}^{\mathrm{rev}}, the CNOT with control below, is the unitary of two qubits that takes the second qubit as control and the first as target; in terms of the swap it is CNOTrev=SWAPCNOTSWAP.\mathrm{CNOT}^{\mathrm{rev}} = \mathrm{SWAP}\;\mathrm{CNOT}\;\mathrm{SWAP}.(4)✦

The Circuit

For a unitary UU of a system SS, the circuit MUM_U measuring UU is the unitary of qubit⊗S\mathrm{qubit} \otimes S that places C(U)C(U) between two Hadamard gates on the control: MU=(H⊗1)C(U)(H⊗1).M_U = (H \otimes 1)\, C(U)\, (H \otimes 1).(5)✦

The Claim

Theorem 1. Let UU be a unitary of a system SS and |ψ⟩|\psi\rangle a vector in the state space of SS. Then MU(|0⟩⊗|ψ⟩)=|0⟩⊗12(|ψ⟩+U|ψ⟩)+|1⟩⊗12(|ψ⟩−U|ψ⟩).M_U \bigl( |0\rangle \otimes |\psi\rangle \bigr) = |0\rangle \otimes \tfrac{1}{2} \bigl( |\psi\rangle + U|\psi\rangle \bigr) + |1\rangle \otimes \tfrac{1}{2} \bigl( |\psi\rangle - U|\psi\rangle \bigr).(6)✦

When UU is Hermitian as well, its eigenvalues are ±1\pm 1 and P±=12(1±U)P_\pm = \tfrac{1}{2}(1 \pm U) are the projectors onto its two eigenspaces. For a state |ψ⟩|\psi\rangle of SS, the control then reads 00 with probability ⟨ψ|P+|ψ⟩\langle \psi | P_+ | \psi \rangle and 11 with probability ⟨ψ|P−|ψ⟩\langle \psi | P_- | \psi \rangle, and SS is left in the normalised projection of |ψ⟩|\psi\rangle: the circuit followed by a measurement of the control measures UU. On an eigenstate of UU one branch of (6) vanishes, and the control ends in a basis state with SS unchanged. The Pauli gates ZZ and XX are Hermitian. With a second qubit as target the circuit becomes a controlled-NOT gate.

Theorem 2. Let the target be a qubit and U=ZU = Z. The circuit is the CNOT with control below, MZ=CNOTrev,M_Z = \mathrm{CNOT}^{\mathrm{rev}},(7)✦ and on the basis states of the target MZ(|0⟩⊗|0⟩)=|0⟩⊗|0⟩,M_Z \bigl( |0\rangle \otimes |0\rangle \bigr) = |0\rangle \otimes |0\rangle,(8)✦ MZ(|0⟩⊗|1⟩)=|1⟩⊗|1⟩.M_Z \bigl( |0\rangle \otimes |1\rangle \bigr) = |1\rangle \otimes |1\rangle.(9)✦

Theorem 3. Let the target be a qubit and U=XU = X. The circuit is the CNOT with control below between two Hadamard gates on the target, MX=(1⊗H)CNOTrev(1⊗H),M_X = (1 \otimes H)\, \mathrm{CNOT}^{\mathrm{rev}}\, (1 \otimes H),(10)✦ and on the eigenstates of XX MX(|0⟩⊗|+⟩)=|0⟩⊗|+⟩,M_X \bigl( |0\rangle \otimes |+\rangle \bigr) = |0\rangle \otimes |+\rangle,(11)✦ MX(|0⟩⊗|−⟩)=|1⟩⊗|−⟩.M_X \bigl( |0\rangle \otimes |-\rangle \bigr) = |1\rangle \otimes |-\rangle.(12)✦

What Is Checked

The claims are stated over the circuit MUM_U of (5), built from the Hadamard gate and the controlled gate of (3), for an arbitrary unitary UU and for the Pauli gates of (1); over the CNOT with control below of (4); and over product states of |0⟩|0\rangle, |1⟩|1\rangle and the states |±⟩|\pm\rangle of (2).

About these constructions the library proves that C(U)C(U) is unitary for every unitary UU, C(U)†C(U)=C(U)C(U)†=1C(U)^\dagger C(U) = C(U)\, C(U)^\dagger = 1✦, and that the matrices of HH, XX and ZZ are unitary. It proves that composites and tensor products of unitaries are unitary, which makes MUM_U a unitary of qubit⊗S\mathrm{qubit} \otimes S, and that SWAP, an isometry of the state space of S⊗SS \otimes S onto itself, is a unitary. It proves as well that a unitary carries a unit vector to a unit vector, and that the tensor product of two unit vectors has unit norm.