Lean, informalized

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

Exercise 4.41 - What measuring the two ancillas of Figure 4.17 leaves on the target qubit, and how often

A rotation by arccos⁡(3/5)\arccos(3/5) with probability 5/85/8.

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

Three qubits enter the circuit of Figure 4.17: two ancillas, each prepared in |0⟩|0\rangle, and a target in an arbitrary pure state |ψ⟩|\psi\rangle. Each ancilla first passes a Hadamard gate. A Toffoli gate controlled by the two ancillas then acts on the target, followed by the phase gate SS on the target and a second Toffoli gate, and a Hadamard on each ancilla closes the circuit. Last, both ancillas are measured in the computational basis.

The exercise is to show that the two outcomes are both 00 with probability 5/85/8, and that the target has then undergone the rotation Rz(θ)R_z(\theta) about the zz axis by the angle θ\theta with cos⁡θ=3/5\cos\theta = 3/5; any other pair of outcomes leaves the Pauli ZZ applied to the target.

Qubits and Gates

A quantum system SS is described by its state space, a finite dimensional complex Hilbert space, and the composite system S⊗TS\otimes T of two systems SS and TT has as its state space the tensor product of theirs. A pure state |ψ⟩|\psi\rangle of SS is a unit vector in the state space of SS; pure states |ψ⟩|\psi\rangle of SS and |φ⟩|\varphi\rangle of TT give the product state |ψ⟩⊗|φ⟩|\psi\rangle\otimes|\varphi\rangle of S⊗TS\otimes T. The qubit is the system with state space ℂ2\mathbb{C}^2, and its basis states |0⟩|0\rangle and |1⟩|1\rangle are the standard basis vectors (1,0)(1,0) and (0,1)(0,1). The circuit acts on three qubits, the first two the ancillas and the third the target, with input |0⟩⊗(|0⟩⊗|ψ⟩)|0\rangle\otimes(|0\rangle\otimes |\psi\rangle), written |0⟩|0⟩|ψ⟩|0\rangle|0\rangle|\psi\rangle.

A unitary UU of SS is an operator on the state space of SS with U†U=UU†=1U^\dagger U = UU^\dagger = 1, and it carries a pure state |ψ⟩|\psi\rangle to the pure state U|ψ⟩U|\psi\rangle. The identity 11 is a unitary of every system.✦ For unitaries UU and VV of SS, the unitary UVUV, UU after VV, applies VV first and then UU.✦ For a unitary UU of SS and a unitary VV of TT, the product unitary U⊗VU\otimes V of S⊗TS\otimes T is the tensor product of the two operators; U⊗1U\otimes 1 is UU acting on the first factor, the first wires of the composite, and 1⊗V1\otimes V is VV acting on the last factor, its last wires.

In the computational basis, the matrices of the Hadamard, of the three Pauli operators and of the phase gate are H=12(111−1),X=(0110),Y=(0−ii0),Z=(100−1),S=(100i).H = \frac{1}{\sqrt2}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}, \quad X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \quad Y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}, \quad Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}, \quad S = \begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}.(1) The Hadamard HH, the Pauli XX and ZZ and the phase gate SS are the unitaries of the qubit whose operators have these matrices.

For a vector n→=(nx,ny,nz)\vec n = (n_x, n_y, n_z) of ℝ3\mathbb{R}^3, the Pauli vector σ→=(X,Y,Z)\vec\sigma = (X, Y, Z) gives the matrix n→⋅σ→=nxX+nyY+nzZ\vec n\cdot\vec\sigma = n_xX + n_yY + n_zZ, and the rotation about n→\vec n by a real angle θ\theta is Rn→(θ)=exp⁡(−iθ2n→⋅σ→),Rz(θ)=Rzˆ(θ)=e−iθZ/2,R_{\vec n}(\theta) = \exp\Bigl(-\frac{i\theta}{2}\,\vec n\cdot\vec\sigma\Bigr), \qquad R_z(\theta) = R_{\hat z}(\theta) = e^{-i\theta Z/2},(2) where zˆ=(0,0,1)\hat z = (0,0,1); about a unit vector nˆ\hat n it is written Rnˆ(θ)R_{\hat n}(\theta). The rotation gate Rz(θ)R_z(\theta) is the unitary of the qubit whose operator has the matrix e−iθZ/2e^{-i\theta Z/2}.✦

For a unitary UU of a system SS, the controlled gate C(U)C(U) is the unitary of the composite of a control qubit with 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) For a unitary UU of a qubit, the doubly controlled gate C2(U)=C(C(U))C^2(U) = C(C(U)) of three qubits applies UU to the third exactly when the first two are both |1⟩|1\rangle; the Toffoli gate is C2(X)C^2(X).

The Circuit

The Hadamard layer WW of the circuit is the unitary of the three qubits W=H⊗H⊗1.W = H\otimes H\otimes 1.(4)✦ The middle gate GG of the circuit is the unitary G=C2(X)(1⊗1⊗S)C2(X),G = C^2(X)\,(1\otimes 1\otimes S)\,C^2(X),(5) and the circuit QQ is WW, then GG, then WW again: Q=WGW.Q = W\,G\,W.(6) The rotation angle θ\theta of the circuit is the real number θ=arccos⁡35.\theta = \arccos\frac35.(7)✦

For ancilla outcomes a′a' and b′b' and a target label tt, all in {0,1}\{0,1\}, the amplitude Aa′b′(t)A_{a'b'}(t) of the outcome a′b′a'b' on the target state |t⟩|t\rangle is the complex number Aa′b′(t)=(12)4∑a,b∈{0,1}it⊕ab(−1)aa′(−1)bb′,A_{a'b'}(t) = \Bigl(\frac{1}{\sqrt2}\Bigr)^4 \sum_{a,b\in\{0,1\}} i^{\,t\oplus ab}\, (-1)^{aa'}(-1)^{bb'},(8)✦ with t⊕abt\oplus ab the sum modulo two. It is the amplitude of |a′⟩|b′⟩|t⟩|a'\rangle|b'\rangle|t\rangle in Q|0⟩|0⟩|t⟩Q|0\rangle|0\rangle|t\rangle.

Measuring the Ancillas

A state ρ\rho of SS is a positive operator of unit trace on the state space of SS; a pure state |ψ⟩|\psi\rangle gives the state |ψ⟩⟨ψ||\psi\rangle\langle\psi|, the projector onto its vector. A measurement on SS with a finite set of outcomes is a family of measurement operators MiM_i on the state space of SS, one for each outcome ii, with ∑iMi†Mi=1\sum_i M_i^\dagger M_i = 1.✦ The positive operator valued measure (POVM) of a measurement on SS with operators MiM_i is the family of effects Ei=Mi†MiE_i = M_i^\dagger M_i; the probability of the outcome ii on a state ρ\rho of SS is given by the Born rule, p(i)=Tr⁡(Eiρ)=Tr⁡(MiρMi†)p(i) = \operatorname{Tr}(E_i\rho) = \operatorname{Tr}(M_i\rho M_i^\dagger).

The projective measurement of SS in an orthonormal basis {|bi⟩}\{|b_i\rangle\} has the operators Mi=|bi⟩⟨bi|M_i = |b_i\rangle\langle b_i|.✦ A measurement with operators MiM_i on SS is made on the first wires of S⊗TS\otimes T with the operators Mi⊗1M_i\otimes 1, and one on TT is made on the last wires with 1⊗Mi1\otimes M_i. The measurement of the control qubit, on a composite of a qubit with SS, is the projective measurement of the qubit in the computational basis, with operators |i⟩⟨i|⊗1|i\rangle\langle i|\otimes 1.✦ Two measurements LL and MM of SS, with operators LlL_l and MmM_m, performed in turn with LL first, form the cascaded measurement of SS with outcomes (l,m)(l,m) and operators N(l,m)=MmLlN_{(l,m)} = M_mL_l.✦

The measurement of both ancillas has, for each outcome a′b′a'b', the measurement operator Na′b′=(1⊗|b′⟩⟨b′|⊗1)(|a′⟩⟨a′|⊗1⊗1)=|a′⟩⟨a′|⊗|b′⟩⟨b′|⊗1.N_{a'b'} = (1\otimes|b'\rangle\langle b'|\otimes 1)\,(|a'\rangle\langle a'|\otimes 1\otimes 1) = |a'\rangle\langle a'|\otimes|b'\rangle\langle b'|\otimes 1.(9)

The Claim

Theorem 1. The angle θ\theta satisfies cos⁡θ=35.\cos\theta = \frac35.(10)✦ For every pure state |ψ⟩|\psi\rangle of the target, measuring both ancillas on the state |Ψ⟩⟨Ψ||\Psi\rangle\langle\Psi| of the output |Ψ⟩=Q|0⟩|0⟩|ψ⟩|\Psi\rangle = Q|0\rangle|0\rangle|\psi\rangle gives the outcome 0000 with probability p(0,0)=58.p(0,0) = \frac58.(11)✦ There is a complex number cc with |c|2=5/8|c|^2 = 5/8 such that the amplitudes of the outcome 0000 are those of the rotation by θ\theta, A00(t)|t⟩=cRz(θ)|t⟩(t=0,1).A_{00}(t)\,|t\rangle = c\,R_z(\theta)\,|t\rangle \qquad (t = 0, 1).(12)✦ For ancilla outcomes a′a' and b′b' not both 00, there is a complex number cc with |c|2=1/8|c|^2 = 1/8 such that Aa′b′(t)|t⟩=cZ|t⟩(t=0,1).A_{a'b'}(t)\,|t\rangle = c\,Z\,|t\rangle \qquad (t = 0, 1).(13)✦

What Is Checked

The claim is stated over the circuit QQ of (6), the measurement (9) of both ancillas with its Born probabilities, the amplitudes (8) and the angle (7), with the gates Rz(θ)R_z(\theta) and ZZ acting on the target.

About these constructions the library proves that the controlled gate (3) is unitary for every unitary UU, and with it the Toffoli gate; that HH, XX, ZZ, SS and Rz(θ)R_z(\theta) are unitary because their matrices are; and that products and tensor products of unitaries are unitary. It proves too that a unitary carries a pure state to a unit vector, that the product of two pure states has unit norm, that |ψ⟩⟨ψ||\psi\rangle\langle\psi| is a state, a positive operator of unit trace, and that every measurement built here, on the first or last wires or as a cascade, has operators MiM_i with ∑iMi†Mi=1\sum_i M_i^\dagger M_i = 1.