Keyboard: / notation search · ? shortcuts on practice pages. Settings are saved in this browser.
Lecture 6 · Dr Ittoop Puthoor · about 60 min
Multiple-qubit systems and two-qubit gates
Gates that act on more than one qubit. CNOT, its matrix and linearity, building a Bell pair from scratch, SWAP from three CNOTs, the Toffoli gate, and applying gates to one qubit of many.
How much help?
How well do you know this?
By the end you can
Apply CNOT to basis states and, by linearity, to superpositions
Write the 4×4 matrices for CNOT and SWAP
Build ∣Φ+⟩ with H and CNOT and track the state at each step
Explain the Toffoli gate and why it matters
Apply a single-qubit gate to one qubit of a register using U⊗I
Single qubits: ∣ψ⟩=α∣0⟩+β∣1⟩. Two qubits: tensor product, four amplitudes in the order ∣00⟩,∣01⟩,∣10⟩,∣11⟩; the vector for ∣01⟩ is (0,1,0,0)T. Some states (like 21(∣01⟩+∣10⟩)) are entangled. Single-qubit gates (X, H, …) are 2×2 unitaries. Now we need gates that act on two qubits at once; without them we could never create entanglement.
From logic gates to quantum gates
Classical NOT maps 0↔1 and is reversible (you can tell the input from the output). Classical NAND maps two bits to one, so it loses information: output 1 could come from 00, 01 or 10. Quantum gates are unitary, so they are always reversible: same number of qubits in and out, and nothing forgotten.
CNOT: controlled-NOT
CNOT has a control qubit and a target qubit. It flips the target if and only if the control is 1:
CNOT∣q0,q1⟩=∣q0,q0⊕q1⟩.
Input
Output
∣00⟩
∣00⟩
∣01⟩
∣01⟩
∣10⟩
∣11⟩
∣11⟩
∣10⟩
In a circuit it is drawn as a dot (●) on the control wire joined to a ⊕ on the target. As a matrix (columns = images of ∣00⟩,∣01⟩,∣10⟩,∣11⟩):
CNOT=1000010000010010=(I00X).
The block form says it all: if the first qubit is 0 do I, if it is 1 do X. Equivalently CNOT=∣0⟩⟨0∣⊗I+∣1⟩⟨1∣⊗X.
Linearity: CNOT on superpositions
CNOT is linear, so apply it to each term:
CNOT(21(∣00⟩+∣01⟩))=21(∣00⟩+∣01⟩)(control is 0 in both terms: nothing happens)CNOT(21(∣0⟩+∣1⟩)⊗∣0⟩)=21(CNOT∣00⟩+CNOT∣10⟩)=21(∣00⟩+∣11⟩).
A product state went in; an entangled state came out. That is CNOT’s superpower.
Lock it in · answer in your head, then reveal
CNOT action
CNOT∣a,b⟩=∣a,a⊕b⟩: flip the target if the control is 1.
CNOT matrix (control first)
1000010000010010
Building an EPR (Bell) pair
Start with ∣00⟩, apply H to the first qubit, then CNOT. Track the state at each stage:
Explore · two qubits, tensor products and entanglement
Reproduce the Bell-pair circuit: H on q0, then CNOT q0→q1. Then Reset, press X on q1 first, and repeat: you get a different Bell state. Try all four starting points |00⟩, |01⟩, |10⟩, |11⟩.
Gates (applied left to right in time):
Circuit so far: (none)
Amplitudes and probabilities (order |q0 q1⟩)
Different inputs give the four Bell states, an orthonormal basis of two-qubit space made entirely of maximally entangled states:
Input
Output
∣00⟩
∣Φ+⟩=21(∣00⟩+∣11⟩)
∣01⟩
∣Ψ+⟩=21(∣01⟩+∣10⟩)
∣10⟩
∣Φ−⟩=21(∣00⟩−∣11⟩)
∣11⟩
∣Ψ−⟩=21(∣01⟩−∣10⟩)
Entanglement has been demonstrated over more than 1000 km (the Micius satellite, 2017), and its foundations won the 2022 Nobel Prize in Physics (Aspect, Clauser, Zeilinger).
Lock it in · answer in your head, then reveal
Circuit that makes ∣Φ+⟩ from ∣00⟩
H on qubit 0, then CNOT (control 0, target 1): 21(∣00⟩+∣11⟩).
The four Bell states
∣Φ±⟩=21(∣00⟩±∣11⟩), ∣Ψ±⟩=21(∣01⟩±∣10⟩).
SWAP
SWAP exchanges two qubits: ∣ab⟩→∣ba⟩. So ∣01⟩↔∣10⟩ and ∣00⟩,∣11⟩ are unchanged:
SWAP=1000001001000001.
It can be built from three CNOTs, alternating direction: CNOT(0→1), CNOT(1→0), CNOT(0→1). Trace ∣10⟩: → ∣11⟩ → ∣01⟩ → ∣01⟩ ✓.
Toffoli (CCNOT)
Three qubits: two controls and a target. The target flips only when both controls are 1: ∣P,Q,R⟩→∣P,Q,R⊕(P⋅Q)⟩. Its 8×8 matrix is the identity except that the last two rows are swapped (∣110⟩↔∣111⟩).
Toffoli is reversible and universal for classical reversible logic: with R=1 it computes NAND, and any classical circuit can be made from NANDs. So a quantum computer can run any classical computation. Toffolis appear in Shor’s arithmetic, Grover’s oracles and error-correction syndrome checks.
Lock it in · answer in your head, then reveal
How many CNOTs make a SWAP?
Three: CNOT(a→b), CNOT(b→a), CNOT(a→b).
What does the Toffoli (CCNOT) gate do?
Flips the target only when both controls are 1. It is reversible and universal for classical reversible logic.
∣0⟩⊗∣1⟩ as a column vector
(0,1,0,0)T=∣01⟩
Gates on one qubit of many
To apply U to the first qubit and nothing to the second, use the tensor product of operators:
Each top entry times the whole second vector: (1⋅(1,1)1⋅(1,1))=(1,1,1,1)T.
Answer:21(1,1,1,1)T=21(∣00⟩+∣01⟩+∣10⟩+∣11⟩): a superposition of all 2-bit strings, built from two independent qubits.
6.2 · CNOT on the uniform superposition
Lecture 6: try it out
Compute CNOT(21(∣00⟩+∣01⟩+∣10⟩+∣11⟩)).
Worked solution
By linearity, apply CNOT to each term: ∣00⟩→∣00⟩, ∣01⟩→∣01⟩, ∣10⟩→∣11⟩, ∣11⟩→∣10⟩.
Sum: 21(∣00⟩+∣01⟩+∣11⟩+∣10⟩).
That is the same set of terms as before.
Answer: Unchanged: 21(∣00⟩+∣01⟩+∣10⟩+∣11⟩). CNOT only permutes the terms, and here they all have equal amplitude. (In other words ∣++⟩ is an eigenstate of CNOT.)
Answer:∣Ψ−⟩, the singlet: the state used in Lecture 8’s Bell test.
6.5 · A circuit, step by step
Problem set style
Start in ∣00⟩. Apply X to qubit 1 (the second), then H to qubit 0, then CNOT (0 → 1), then H to qubit 0. Find the final state and the probabilities of each outcome.
H on qubit 0: ∣01⟩→21(∣01⟩+∣11⟩) and ∣10⟩→21(∣00⟩−∣10⟩).
Total: 21(∣00⟩+∣01⟩−∣10⟩+∣11⟩).
Answer:21(∣00⟩+∣01⟩−∣10⟩+∣11⟩); each outcome has probability 41. Is it entangled? α00α11=41 but α01α10=−41, so yes.
Check yourself
Which matrix acts as H on the second qubit only?
The slot in the tensor product is the qubit. Second qubit → second slot: I⊗H.
↧ Go deeper: Controlled-U and phase kickback MSc
Any gate can be controlled: C-U=∣0⟩⟨0∣⊗I+∣1⟩⟨1∣⊗U. If the target is an eigenstate U∣u⟩=eiϕ∣u⟩, then C-U(∣+⟩∣u⟩)=21(∣0⟩+eiϕ∣1⟩)∣u⟩: the phase has “kicked back” onto the control. This trick drives the Deutsch–Jozsa, Bernstein–Vazirani and phase-estimation algorithms (and hence Shor’s). Simplest example: CNOT on ∣+⟩∣−⟩ gives ∣−⟩∣−⟩, so the control flipped even though the “target” was the one being NOT-ed.
↧ Go deeper: CNOT is symmetric in the ± basis MSc
(H⊗H)CNOT0→1(H⊗H)=CNOT1→0: in the +/− basis, control and target swap roles. And CZ is symmetric: CZ=(I⊗H)CNOT(I⊗H) treats both qubits equally. This is why “which one is the control” is a basis-dependent statement.
↧ Go deeper: Entangling power and the Cartan (KAK) decomposition PhD
Every two-qubit unitary can be written (A1⊗B1)ei(c1XX+c2YY+c3ZZ)(A2⊗B2). The three numbers (c1,c2,c3) capture all its non-local power, and any two-qubit gate needs at most 3 CNOTs (Vidal & Dawson 2004; Kraus & Cirac 2001). SWAP needs all 3; CNOT is “half” of it in this geometry.