Lecture 7

Today I first talked about quantum gates in general, and tensor products in particular. In the second part of the lecture I tried to prove the universality of quantum circuits. I believe I didn't present things very well this lecture, and I also presented things in the wrong order, so what I'm going to do is include that part of the lecture in the write-up for Lecture 8, and try to present everything in the proper order.

What I want to do here is talk about what it means to apply a CNOT gate on the first and third qubits of a three-qubit system, and leave the second qubit alone. What we have to do is take the tensor product of CNOT13 with the identity on qubit 2, or I2. I expect very few people have seen tensor products of qubits on the outside with a qubit on the middle before, so I'm going to go through it in some detail. If we just had two qubits, CNOT12 in matrix form would be

 1 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0
and CNOT with the control qubit being qubit 2 and the target qubit 1 would be
 1 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0
We can write CNOT a different way.
CNOT12 = | 0 ⟩1⟨ 0 | ⊗ id2 + | 1 ⟩1⟨ 1 | ⊗ σx2
This says that if the first qubit is | 0 ⟩, then CNOT applies the identity to the second qubit, and if the first qubit is 1, CNOT applies σx to the second qubit. so we can just change the index 2 to the index 3 to get CNOT13
CNOT13 = | 0 ⟩1⟨ 0 | ⊗ id3 + | 1 ⟩1⟨ 1 | ⊗ σx3
and tensoring this with the identity, we get
CNOT13 ⊗ id2 = | 0 ⟩1⟨ 0 | ⊗ id23 + | 1 ⟩1⟨ 1 | ⊗ id2 ⊗ σx3
Writing this out in matrix form gives
 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0
where I have colored the text to show which 1's in the original CNOT12 gave rise to the various 1's in the CNOT13. Here is the CNOT12 with the 1's colored similarly, and some space (which may depend on your browser; it seems to look good in both Explorer and Firefox) inserted between the appropriate blocks so that it's easier to see what's going on.
 1 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0
If you're careful, you can take the 4 × 4 matrix for CNOT12 and just duplicate every entry to obtain the 8 × 8 matrix for CNOT13. However, unless you've had some experience doing this, you should be quite careful. As you can probably guess from looking at the example above, it is fairly easy to make a mistake.

It's also useful to be able to figure out what these circuits do without writing out the matrices. Once the number of qubits gets large, the matrices grow big very fast. Since n qubits give rise to a 2n × 2n matrix, often writing out the matrix is not possible, and you should learn to use other methods of figuring out what quantum gates do.