Part IV · Advantage — 8a

The Circuit Model

Every quantum algorithm — Deutsch, Grover, Shor — is written in one notation: a circuit. Horizontal wires are qubits, time runs left to right, and the boxes are the gates from chapter 05. Learn to read it and the rest of Part IV is just clever arrangements of boxes.

↩ before you start · keep these handy
·From Ch. 5: H, X, Z are unitary 2×2 gates — reversible turns of a qubit.
·From Ch. 6: the tensor product glues qubits; the start state here is |00⟩.
·From Ch. 3: nothing is read out until you measure — then a single outcome appears.
🔑 symbol decoder · every new mark, in plain words
wirea horizontal line — one qubit's timeline, read left to right. gate boxa unitary applied at that point on the wire — a turn of the state. CNOTa two-wire gate: it flips the target qubit whenever the control is 1. H⊗Ia one-wire gate is secretly "gate on one wire, identity on the other." U₂U₁read gates left→right, but their matrices stack right→left. depthhow many gate layers the circuit has, end to end.
feel

Sheet music for qubits

A score has one staff line per instrument and you read the notes left to right. A circuit has one wire per qubit and you read the gates left to right. Each gate is a small unitary — a turn of the state — and a gate touching two wires (like CNOT) lets them talk. Play the score from left to right and the qubits’ joint state evolves, note by note, into the answer.

🏭 everyday picture

Picture an assembly line: each qubit rides its own conveyor belt (the wire), and stations along the belt (the gates) stamp or twist it as it passes. A few stations straddle two belts and link whatever is moving on them — that's a two-qubit gate like CNOT. Read the line left to right and you watch a blank input roll out finished.

recapA circuit is one wire per qubit read left to right; gates are turns, and two-wire gates let qubits talk.
play

Build a circuit, watch the state move

Two qubits start in |00⟩. Add gates left to right and the four amplitudes update live. Try the Bell pair preset — an H on the top wire, then a CNOT — and watch a plain product state turn into pure entanglement.

▸ circuit lab|ψ⟩ = Uₙ···U₂U₁|00⟩
q0 q1 {{ g.label }}
{{ depth }} / 8 gates
output state  |ψ⟩ = {{ ket }}
|{{ a.lbl }}⟩
{{ a.amp }} ({{ a.prob }})
{{ entNote }}
recapStacking H then CNOT on |00⟩ turns a plain product state into an entangled Bell pair.
math

Read left to right, multiply right to left

Each column of the circuit is one unitary acting on the whole register. Applying gate U₁ then U₂ means the state becomes U₂(U₁|ψ⟩) — so the matrices stack up in reverse reading order:

out⟩ = Uₙ ··· U₂ U₁ |00···0⟩
Bell pair:  CNOT · (H⊗I) · |00⟩ = (|00⟩ + |11⟩)/√2

A single-qubit gate on a 2-qubit register is secretly H⊗I — the gate on one wire, identity on the other. Tensor them up and the whole circuit is one big unitary; the diagram just spares you from writing the 4×4 matrices by hand.

✎ worked example · run the Bell-pair circuit by hand
1.start: |00⟩ = [1, 0, 0, 0]
2.H on q0 (= H⊗I): |00⟩ → (|00⟩ + |10⟩)/√2
3.CNOT (control q0): flips q1 when q0 = 1, so |10⟩ → |11⟩
4.result (|00⟩ + |11⟩)/√2 — a Bell pair, fully entangled. ✓
recapRead gates left to right, but multiply their matrices right to left; a one-wire gate is secretly G⊗I.
⚠ common misconception

“More wires means it tries exponentially many inputs at once, so more gates = more brute force.” A circuit only ever holds one evolving state. Yes, that state can be a superposition over 2ⁿ basis labels — but you only get one answer out when you measure.

The whole art of the next three chapters is interference: arranging gates so the wrong answers cancel and the right one is left standing. The power isn’t in evaluating everything — it’s in making almost everything destructively disappear.

✓ you can now
read a circuit: wires as qubits, time left to right, boxes as gates
trace a state through H and CNOT to build a Bell pair
explain why more wires is not free brute force — interference is the trick
← 08 Why It Matters next · 8b Deutsch–Jozsa