Lean, informalized

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

Exercise 4.19 - Conjugation by the controlled NOT gate permutes the entries of a two qubit density matrix

The controlled NOT gate rearranges a density matrix.

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, a control and a target, are in a state ρ\rho, pure or mixed. The exercise is to write out explicitly, in the computational basis, the action of the controlled NOT gate (CNOT) on the density matrix of ρ\rho.

Two Qubits

A quantum system SS is a physical system whose state space is a finite dimensional complex Hilbert space.✦ A pure state |ψ⟩\lvert\psi\rangle of SS is a unit vector in the state space of SS.✦ A state ρ\rho of SS is a positive operator of unit trace on the state space of SS.✦

The qubit QQ is the quantum system whose state space is ℂ2\mathbb{C}^2, and its computational basis states |0⟩\lvert 0\rangle and |1⟩\lvert 1\rangle are the pure states whose vectors are the standard basis vectors e0e_0 and e1e_1. 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.✦ The product |ψ⟩⊗|φ⟩\lvert\psi\rangle \otimes \lvert\varphi\rangle of a pure state of SS and a pure state of TT is the pure state of S⊗TS \otimes T whose vector is the tensor product of the two vectors.✦ Two qubits form the composite system Q⊗QQ \otimes Q, with the four product basis states |ab⟩=|a⟩⊗|b⟩\lvert ab\rangle = \lvert a\rangle \otimes \lvert b\rangle for a,b∈{0,1}a, b \in \{0, 1\}.

The density matrix of a state ρ\rho of two qubits is the complex 4×44 \times 4 matrix whose rows and columns are labelled by pairs of bits and whose entries are the matrix elements of ρ\rho between product basis states, ρ(a,b),(c,d)=⟨ab|ρ|cd⟩,a,b,c,d∈{0,1}.\rho_{(a,b),(c,d)} = \langle ab \rvert\, \rho \,\lvert cd \rangle , \qquad a, b, c, d \in \{0, 1\}.(1)✦

The CNOT Gate

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, where 11 is the identity on the state space of SS.✦ The evolution of a state ρ\rho of SS under a unitary UU of SS is the state UρU†U \rho U^\dagger.✦

The Pauli XX gate, the quantum NOT, is the unitary of the qubit given on ℂ2\mathbb{C}^2 by the matrix X=(0110).X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}.(2)✦

For a unitary UU of a system SS, the controlled gate C(U)C(U) is the unitary of the composite system Q⊗SQ \otimes S of a control qubit and a 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 ,(3)✦ where 11 is the identity on the state space of SS.

The CNOT gate is the controlled gate C(X)C(X) of two qubits, the first the control and the second the target: it flips the target exactly when the control is |1⟩\lvert 1\rangle.✦ On the product basis it therefore sends |ab⟩\lvert ab\rangle to |π(a,b)⟩\lvert \pi(a,b)\rangle, where π\pi is the permutation of the four pairs of bits π(a,b)=(a,b⊕a),\pi(a, b) = (a,\, b \oplus a),(4)✦ with ⊕\oplus addition modulo 22.

The Claim

Theorem 1. Let ρ\rho be a state of two qubits. The density matrix of the evolved state CNOTρCNOT†\mathrm{CNOT}\,\rho\,\mathrm{CNOT}^\dagger is the density matrix of ρ\rho with its rows and its columns relabelled by π\pi: (CNOTρCNOT†)(a,b),(c,d)=ρπ(a,b),π(c,d)=ρ(a,b⊕a),(c,d⊕c)\bigl(\mathrm{CNOT}\,\rho\,\mathrm{CNOT}^\dagger\bigr)_{(a,b),(c,d)} = \rho_{\pi(a,b),\,\pi(c,d)} = \rho_{(a,\, b \oplus a),(c,\, d \oplus c)}(5)✦ for all a,b,c,d∈{0,1}a, b, c, d \in \{0, 1\}.

What Is Checked

The claim is stated over an arbitrary state of two qubits, the CNOT gate as the controlled XX acting by conjugation, the density matrix (1) in the product basis and the permutation (4) of its labels.

About these constructions the library proves that the controlled gate (3) is unitary, C(U)†C(U)=C(U)C(U)†=1C(U)^\dagger C(U) = C(U)\, C(U)^\dagger = 1, for every unitary UU of every system, and that the matrix XX is unitary, so that the CNOT gate is a unitary of two qubits. It proves as well that conjugating a density operator by a unitary gives a density operator, so that CNOTρCNOT†\mathrm{CNOT}\,\rho\,\mathrm{CNOT}^\dagger is again a state, and that the tensor product of two unit vectors is a unit vector, so that each |ab⟩\lvert ab\rangle is a pure state of the two qubits.