Every gate covered so far in this series — Hadamard, X, Y, and Z — has been a single instruction acting on a single qubit. Nothing interesting happens with just one instruction. A quantum circuit is what you get when you wire a sequence of these gates together, across one or more qubits, into something that actually computes: a recipe for transforming an initial state into a final one.
The General Form
Formally, a circuit is just a product of unitary matrices applied in sequence to an initial state:
|ψ_out⟩ = U_n ... U_2 U_1 |ψ_in⟩
Each U_i is a gate (or a gate applied to a specific qubit or pair of qubits). Read left to right in the diagram, but right to left in the matrix product — the gate closest to the input state is applied first. That's the entire abstraction. Everything else in quantum algorithm design is about choosing which gates, in which order, on which qubits.
Beyond Single Qubits: Multi-Qubit Gates
Single-qubit gates rotate one Bloch sphere. To get anything a classical computer can't already do, you need gates that act on two or more qubits at once and can create correlations between them. Three show up constantly:
- CNOT (Controlled-NOT): takes a control qubit and a target qubit. If the control is
|1⟩, it flips the target; if the control is|0⟩, it does nothing. This is the workhorse two-qubit gate in almost every circuit you'll encounter, and it's the gate that turns superposition into entanglement. - SWAP: exchanges the states of two qubits entirely. Useful for routing information between qubits that aren't directly connected on real hardware, where only certain qubit pairs can interact.
- Toffoli (CCNOT): a three-qubit gate with two controls — it flips the target only if both controls are
|1⟩. It's the quantum version of a universal classical logic gate, and it's how you build reversible classical arithmetic inside a quantum circuit.
Worked Example: Building a Bell State
The hero circuit above is the smallest circuit that does something genuinely non-classical, and it's worth walking through gate by gate. Two qubits, both start at |0⟩:
- Apply H to qubit 0. This puts qubit 0 into equal superposition:
(|0⟩+|1⟩)/√2, while qubit 1 is untouched. Combined state:(|00⟩+|10⟩)/√2. - Apply CNOT, with qubit 0 as control and qubit 1 as target. Wherever qubit 0 is
|1⟩, qubit 1 flips from|0⟩to|1⟩. The|10⟩term becomes|11⟩; the|00⟩term is untouched.
Final state:
|ψ⟩ = (|00⟩ + |11⟩) / √2
This is a Bell state — the two qubits are now entangled, meaning neither one has an independent state of its own anymore. Measure qubit 0 and you'll get 0 or 1 with 50/50 probability, exactly like before. But measuring qubit 1 will now always return the same value you got from qubit 0, every single time, no matter how far apart the two qubits are. That correlation, where it comes from, and why it doesn't let you send messages faster than light, is the entire subject of the final post in this series.
The CNOT truth table makes the flip-only-when-control-is-1 behavior explicit:
| Control (q0) in | Target (q1) in | Target (q1) out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Beyond Two Gates: Real Algorithms
Production circuits chain dozens to thousands of gates like these. The quantum Fourier transform — the component that gives Shor's algorithm its speedup against RSA and ECC — is built from layers of Hadamard gates interleaved with controlled phase-rotation gates, applied across every qubit in the register. Grover's search algorithm repeats a "diffusion" circuit built the same way, over and over, to amplify the amplitude on the correct answer. Every one of these is still, underneath the name, just a specific sequence of unitary gates chosen so that interference cancels the wrong answers and reinforces the right one — exactly the mechanism described in the first post in this series.
An Engineering Note: Circuits Are Also a Resource Budget
On paper, a circuit is free to be as deep and as wide as an algorithm needs. On real hardware in 2026, it isn't. Every additional gate is another chance for a physical error to occur before error correction can catch up, and every qubit pair that isn't physically adjacent on the chip needs SWAP gates to route information between them — each of which adds more error-prone operations. This is exactly the kind of resource-constrained thinking a hardware-first mindset already recognizes: an algorithm on paper is a wish list; an algorithm compiled ("transpiled," in quantum tooling) down to a real device's native gate set and physical qubit layout is an engineering artifact with real, measurable overhead. It's also, practically, something you can try yourself — every major cloud quantum provider accepts a circuit described exactly like the one above and runs it on real hardware in a queue you can submit to today.
Key Takeaways
- A circuit is a sequence of unitary gates applied to qubits; the final state is the product of all the gate matrices applied to the initial state.
- CNOT, SWAP, and Toffoli extend single-qubit gates to two- and three-qubit operations, and CNOT specifically is what turns superposition into entanglement.
- The two-gate sequence H then CNOT is the standard recipe for building a Bell state — the smallest circuit exhibiting genuinely non-classical behavior.
- Real algorithms (Shor's, Grover's) are much larger versions of the same idea: gates arranged so interference does the computational work.
- Circuit depth and qubit connectivity are real engineering constraints on today's hardware, not just theoretical footnotes.
The Bell state built above is the destination for this whole series. The final post covers what entanglement actually is, why Einstein found it so unsettling that he called it "spooky," and why a 2022 Nobel Prize was awarded for proving he was — reluctantly — wrong to doubt it.