QUANTUM // FIELD MAP
← field map
PART 01 · WHY QUANTUM12 min read

Fundamentals of Classical Computation

Quantum Computing, Mapped · part 01 of 09 · current to November 2026
TL;DR — What exactly is the model that quantum computing generalises? A classical computer is a circuit of gates acting on bits; with randomness added, its state is a vector of 2ⁿ non-negative probabilities that sum to 1, and every step is a stochastic matrix. Reversible gates are permutation matrices, and that is the doorway to quantum gates, which are unitary matrices with complex entries. The one thing to remember: classical probabilistic computation already has an exponentially large state vector, but you never need to store it, because you can just sample. Quantum mechanics takes that shortcut away.

Every claim later in this map ("exponential speedup", "BQP", "the T gate is the expensive part", "you can't read out the amplitudes") is a statement about how quantum computation differs from classical computation. So this page pins the classical model down precisely enough to be contrasted against: Boolean circuits, reversible computing, probabilistic computing written as linear algebra, and the complexity classes that tell us what is efficient. Page 04 will reuse every piece of notation here and change just two things, the norm and the sign of the numbers.

Bits, gates and universality

A bit is an element of {0,1}. An n-bit register holds one of 2ⁿ strings x ∈ {0,1}ⁿ. A Boolean function is any map f : {0,1}ⁿ → {0,1}ᵐ, and computation is building such maps out of small pieces.

The small pieces are gates: NOT, AND, OR, XOR, NAND. A gate set is universal if circuits over it can express every Boolean function. NAND alone is universal, which you can check in three lines:

NOT a = NAND(a, a) AND a b = NOT(NAND(a, b)) OR a b = NAND(NOT a, NOT b)

AND, OR and NOT give every truth table (write it in disjunctive normal form), so NAND gives every truth table. There is one more ingredient classical circuits use so routinely that nobody lists it: fan-out. A wire can be split and the bit copied for free. Hold on to that; on page 03 the no-cloning theorem says the quantum version of this free copy does not exist.

Universality says nothing about cost. Counting arguments (Shannon, 1949) show that almost every Boolean function on n inputs needs a circuit of size about 2ⁿ/n. The functions we care about are the rare ones with small circuits. Quantum computing has exactly the same story: a small universal gate set can approximate any unitary, but almost every unitary needs exponentially many gates, and the interesting algorithms are the rare structured exceptions.

Circuits: the model you will generalise

A circuit is a directed acyclic graph: inputs at the leaves, gates at the internal nodes, outputs at the roots. Two numbers describe it: size (number of gates, a proxy for time and energy) and depth (longest path, a proxy for parallel time). To talk about algorithms rather than single circuits we use uniform circuit families: one circuit Cₙ per input length n, each produced by an efficient program. Polynomial-size uniform circuit families compute exactly the class P, so nothing is lost by thinking in circuits instead of Turing machines.

The quantum circuit model keeps this picture almost verbatim. Wires become qubits, gates become small unitary matrices acting on one, two or three wires, and size and depth keep their meaning. When a later page quotes a number of error-correction rounds or a T-gate count, it is a circuit-size or circuit-depth statement in this sense.

Reversible computing: the bridge to unitaries

AND is irreversible: from the output 0 you cannot tell whether the inputs were 00, 01 or 10. Information is destroyed. Landauer (1961) argued that destroying information has a physical floor: erasing one bit in an environment at temperature T dissipates at least

E_min = k_B · T · ln 2 ≈ 2.9 × 10⁻²¹ J at T = 300 K

That floor is many orders of magnitude below what real CMOS dissipates per operation, so it is not today's engineering limit, but it was measured directly in 2012 with a single colloidal particle in an optical trap (Bérut et al., linked below). The point for us is conceptual: a computation that never erases anything has no such floor, and a computation that never erases anything is a bijection on bit strings.

Bennett (1973) showed every computation can be made reversible with modest overhead: compute forward keeping all intermediate bits, copy the answer out with CNOTs, then run the computation backwards to uncompute the garbage. That compute–copy–uncompute pattern reappears inside nearly every quantum algorithm, because leftover garbage in a quantum register spoils interference.

The workhorse reversible gate is the Toffoli (controlled-controlled-NOT):

Toffoli(a, b, c) = (a, b, c ⊕ (a·b)) Toffoli(a, b, 1) = (a, b, NAND(a, b))

With an ancilla bit preset to 1 it computes NAND, so Toffoli is universal for reversible classical computation (given ancillas). Fredkin and Toffoli developed this "conservative logic" programme in the early 1980s. The two-bit reversible gate you will meet constantly is CNOT: (a, b) → (a, a ⊕ b). With b = 0 it is fan-out, a copy of a.

Now write a reversible gate as a matrix. Index the 2ⁿ basis strings, and let the gate's matrix have a 1 in row g(x), column x. Because g is a bijection, every row and every column has exactly one 1: it is a permutation matrix. Toffoli is the 8×8 identity with the last two rows swapped (inputs 110 and 111). CNOT on two bits is:

00 01 10 11 CNOT = [ 1 0 0 0 ] 00 [ 0 1 0 0 ] 01 [ 0 0 0 1 ] 10 [ 0 0 1 0 ] 11

A permutation matrix P satisfies PᵀP = I. It is a real orthogonal matrix, and therefore a unitary one, that happens to contain only 0s and 1s. Quantum gates are what you get when you keep U†U = I and allow any complex entries. The classical reversible gates survive unchanged as a subset: X is NOT, and CNOT and Toffoli keep their names and their matrices.

Probabilistic computation as linear algebra

This is the section page 04 is built against, so it is worth being exact.

Let a computer flip coins. After some steps its n-bit register is not in one string but in a distribution over strings. Write that distribution as a vector with one entry per string:

p = (p_x), x ∈ {0,1}ⁿ, 2ⁿ real entries p_x ≥ 0, Σ_x p_x = 1 (L1 norm = 1)

A deterministic start in string 000 is the basis vector with a 1 in position 000. Every step of the computation is a linear map p → M p where M is column-stochastic: non-negative entries, each column summing to 1. Column x is the output distribution when the input is x. Stochastic matrices are exactly the linear maps that send probability vectors to probability vectors, that is, that preserve non-negativity and the L1 norm.

Three examples on a single bit:

NOT = [ 0 1 ] COIN = [ ½ ½ ] RESET = [ 1 1 ] [ 1 0 ] [ ½ ½ ] [ 0 0 ]

NOT is a permutation (reversible). RESET sends everything to 0 (irreversible, erases a bit). COIN replaces the bit with a fair random bit. Gates on separate bits combine by the tensor (Kronecker) product: COIN on bit 1 of a two-bit register is COIN ⊗ I, a 4×4 stochastic matrix. Independent bits have product distributions, p = p⁽¹⁾ ⊗ p⁽²⁾; correlated bits (say, two bits that are always equal, each 50/50) do not factor. That is the classical shadow of entanglement.

Notice what COIN does twice: COIN · COIN = COIN. Once you have randomised a bit, no further stochastic step can make the randomness cancel back into certainty without looking at something. Probabilities only add, all the contributions are non-negative, and nothing ever subtracts. On page 04 the Hadamard gate plays COIN's role, and H · H = I: two randomising steps give back the start. That single difference, negative and complex numbers that can cancel, is called interference, and it is where every quantum speedup comes from.

bit = 0 bit = 1 fair coin (½, ½) (−1/√2, 1/√2) amber: p₀ + p₁ = 1, p ≥ 0 (this page) cyan: a₀² + a₁² = 1, any sign (page 04) x₀ x₁

The exponential vector you never have to store

Here is the subtle part, and the reason quantum computing is not "just" probabilistic computing with a bigger vector. The probability vector of an n-bit randomized program has 2ⁿ entries. A 300-bit randomized algorithm has a distribution over more strings than there are atoms in the observable universe. Yet nobody has ever struggled to run one.

The reason is that the vector is a description of our ignorance, not something the machine has to hold. To simulate a randomized circuit you never multiply 2ⁿ×2ⁿ stochastic matrices. You draw the random bits, follow one trajectory, and output one sample. Each run costs time linear in circuit size, and the runs reproduce the distribution exactly. Sampling works because probabilities of different paths to the same output simply add: you can explore one path at a time and the totals come out right.

Quantum amplitudes for different paths to the same output also add, but they can have opposite signs and cancel. You cannot discover a cancellation by walking one path; you need the paths' amplitudes together. That is why a direct classical simulation of a quantum circuit seems to need the whole 2ⁿ-entry vector (or an equivalent exponential cost in some other currency, such as time or entanglement in a tensor network), and it is the cleanest one-sentence account of where a quantum advantage can come from.

Carry this: classical probabilistic state = a non-negative vector with L1 norm 1, evolved by stochastic matrices, and cheaply simulated by sampling one path at a time. Quantum state = a complex vector with L2 norm 1, evolved by unitary matrices, and paths can cancel, so the one-path-at-a-time shortcut fails. Reversible classical gates (permutation matrices) sit in both worlds.

P, BPP, NP and the extended Church–Turing thesis

Complexity classes are the vocabulary for "efficient". The three classical ones this map leans on:

ClassDefinition, informallyExample
PDecided by a deterministic algorithm in polynomial timeShortest paths, linear programming, primality (AKS, 2002)
BPPDecided by a randomized polynomial-time algorithm that is right with probability ≥ 2/3 on every inputPolynomial identity testing; primality was here (Miller–Rabin) before it was known to be in P
NP"Yes" answers have a polynomial-size certificate checkable in polynomial timeSAT, graph colouring, factoring (as a decision problem)

The 2/3 in BPP is arbitrary: run the algorithm k times and take the majority, and the error falls exponentially in k (a Chernoff bound). P ⊆ BPP trivially, and most complexity theorists believe P = BPP, because good enough pseudorandom generators would let you derandomize everything. BQP, the quantum class on page 02, is defined exactly like BPP with the randomized circuit replaced by a quantum one.

NP is the class of problems with checkable answers. SAT is NP-complete (Cook–Levin, 1971): every NP problem reduces to it. Whether P = NP is open, and the working assumption is no. Factoring is a useful odd case: it is in NP (a factor is the certificate), but it is not believed NP-complete, and the best known classical algorithm, the general number field sieve, runs in sub-exponential time roughly

exp( (64/9)^(1/3) · (ln N)^(1/3) · (ln ln N)^(2/3) )

That gap, between "not NP-complete" and "no known polynomial algorithm", is exactly the space Shor's algorithm (page 05) walks into. It is also why "quantum computers solve NP-complete problems" is the wrong mental model, a point page 02 makes carefully.

The Church–Turing thesis says every effectively computable function is computable by a Turing machine. Quantum computers do not challenge that; a classical machine can simulate a quantum one, just slowly. The extended Church–Turing thesis is the stronger claim that every physically reasonable model of computation can be simulated by a probabilistic Turing machine with only polynomial overhead. In other words, BPP is the ceiling on what physics can compute efficiently. Quantum computing is the serious challenge to the extended thesis: if large quantum computers work and factoring is not in BPP, the extended thesis is false.

Why simulating physics is exponential in general

A classical system of n particles is described by O(n) numbers: positions and momenta. Simulating it costs polynomial time per step. A quantum system of n two-level particles (spins, say) is described by a state vector of 2ⁿ complex amplitudes. Store each as two 64-bit floats and the memory bill is

n = 30 → 2³⁰ × 16 B ≈ 17 GB n = 40 → 2⁴⁰ × 16 B ≈ 17.6 TB n = 50 → 2⁵⁰ × 16 B ≈ 18 PB

Every additional particle doubles it. This is the observation behind Feynman's 1981 lecture "Simulating physics with computers" (published 1982), which page 02 unpacks: if nature does this bookkeeping for free, build computers out of the same stuff.

Two honest caveats. First, "in general" is doing work: chemists and physicists simulate many quantum systems well using structure, through density functional theory, tensor networks for weakly entangled systems, and quantum Monte Carlo. The exponential wall bites on strongly correlated systems, which is where the interesting chemistry and materials problems live. Second, the obvious escape, sampling as in the probabilistic case, runs into the sign problem: amplitudes (or the weights quantum Monte Carlo uses) go negative, samples cancel, and the statistical error blows up exponentially. Troyer and Wiese showed the fermionic sign problem is NP-hard in general: a polynomial-time general fix would put NP-complete problems in BPP, so none is expected. It is the same cancellation story as the previous section, now as a practical obstacle.

Where Moore's law fits. For four decades transistor counts doubled roughly every two years (Moore's law), and until the mid-2000s Dennard scaling let each smaller transistor also run faster at the same power density. Dennard scaling ended around 2005 when leakage current made further voltage reductions impractical, which is why clock speeds plateaued and chips went multi-core. Transistor density kept improving more slowly.

This matters for quantum computing only in a limited way. Quantum computers are not a successor to CMOS for general workloads: they would not run your web server faster, and most problems have no known quantum speedup at all. The relevant claim is narrower: some problems are exponentially expensive for any classical machine, however much Moore's law delivers, and doubling classical hardware buys you one more simulated particle.

Sources and further reading, verified

Check yourself

  1. XOR from NAND — Build XOR using only NAND gates. A good answer uses four gates: let m = NAND(a,b), then XOR = NAND(NAND(a,m), NAND(b,m)). Check all four input rows, and note which wires you had to fan out.
  2. A probabilistic simulator in numpycode — Represent a 3-bit register as a length-8 probability vector. Write on_bit(M, k, n) that builds the 8×8 matrix for a 2×2 stochastic M on bit k using np.kron. Start in 000, apply COIN to bit 0, then CNOT (bit 0 controls bit 1) and confirm you get ½ on 000 and ½ on the string with bits 0 and 1 both set, a correlated distribution that does not factor. Check that every column of every matrix sums to 1 and that the L1 norm stays 1. Then apply COIN twice to a fresh bit and confirm you cannot get back to certainty. Finally build Toffoli as an 8×8 permutation and assert T.T @ T == I. A good answer is about 20 lines, plus a sampling version that flips coins and follows one path, and agrees with the vector after 10⁵ runs.
  3. Landauer's bill — At 300 K, what is the minimum power needed to erase 10¹⁸ bits per second? (About 2.9 mW.) Compare with the tens to hundreds of watts a modern processor draws, and explain why reversible logic has not taken over despite having no such floor.
  4. Where does the shortcut break? — Suppose two paths lead from 0 to output 1, each with weight ½. Under probability rules, the chance of output 1 is ½ + ½ = 1, and a sampler finds this by walking either path. Now let the weights be +½ and −½ and the rule "add the weights, then square". Explain why walking one path at a time cannot tell you the answer is 0, and what a simulator would have to keep in memory instead. This is the whole of page 04 in miniature.
Next: 02 Why Quantum? · Back to the map.