Classical computers compute by pushing bits through logic gates (AND, OR, NOT). Quantum computers work the same way in spirit — you apply quantum gates to qubits, arranged into a circuit — but with two profound differences: the gates are reversible, and they act on superpositions, transforming all the possibilities a qubit holds at once.
A gate is a rotation
Recall the Bloch sphere from the Foundations track: a qubit's state is a point on a sphere. A quantum gate simply rotates that point. Because a rotation can be undone by rotating back, every quantum gate is reversible — quantum computers never "erase" information mid-computation the way classical AND gates do. A few gates recur everywhere:
- X (the quantum NOT) flips |0⟩ ↔ |1⟩.
- Z flips the phase of |1⟩ — invisible to a single measurement, but crucial for interference (next lesson).
- H, the Hadamard — the workhorse — turns a definite |0⟩ into an equal superposition of |0⟩ and |1⟩. It is how you create superposition on demand.
Circuits, read left to right
A circuit draws each qubit as a horizontal wire and each gate as a box on that wire, with time flowing left to right. Multi-qubit gates span wires. The most important two-qubit gate is the CNOT (controlled-NOT): it flips the target qubit only if the control qubit is 1. On a superposed control, CNOT creates entanglement — it links the two qubits into a joint state.
The little circuit above is the whole Foundations story in three gates: H puts q₀ into superposition, CNOT entangles q₁ with it, and then both are measured. The result is a Bell state — 50% "00", 50% "11", never "01" or "10".
Universality
Remarkably, a small set of gates — say H, T (a phase gate) and CNOT — is universal: any quantum computation whatsoever can be built from them, just as NAND alone is universal for classical logic. So the entire art of quantum programming is arranging these few reversible rotations into a circuit whose final measurement is likely to give the answer you want.
And "likely" is the operative word. A circuit that merely spreads amplitude evenly across every possibility is useless — measuring it is random guessing. The trick that makes quantum computers fast is making the right answers' amplitudes reinforce while the wrong ones cancel. That mechanism — interference — is next.