Part I · The Machinery of Quantum Information · Chapter 5
The Stabilizer Formalism
A huge and useful family of quantum states can be written down not as a list of amplitudes but as a short list of the operators that leave them fixed. That change of bookkeeping turns an exponential object into a small binary table — and hands us the first hard limit on where quantum advantage can come from.
Sources: Nielsen & Chuang 10.5 · Gottesman (1997) · Aaronson–Gottesman (2004)
We have spent four chapters describing quantum states by their amplitudes — complex numbers for qubits — and simulating them by pushing those numbers through gate matrices. It works, and it is honest, but it is exponentially expensive, and it hides something. Many of the states we actually care about — Bell pairs, GHZ states, the code states of quantum error correction — are not generic vectors at all. They have enormous structure, and there is a language built precisely to name that structure: not “which amplitudes,” but “which operators fix this state.” This chapter builds that language, proves (by a working simulator) that it costs only polynomial effort, and confronts the sharp edge that follows: if a whole class of quantum circuits is this easy to simulate classically, then quantum advantage cannot live there. Something more is needed — and naming what is missing is how Part I ends and Part II begins.
What this chapter covers
- 5.1The Pauli group. Tensor products of I, X, Y, Z with a phase; the one fact that runs the whole chapter — any two Paulis either commute or anticommute.
- 5.2Stabilizer states. A state named by the operators that fix it: the +1 eigenspace of n commuting Paulis. Bell and GHZ, worked out.
- 5.3The Clifford group. The unitaries that map Paulis to Paulis — generated by just H, S, and CNOT — so they move stabilizer states to stabilizer states.
- 5.4Gottesman–Knill. Track the generators as a binary tableau — n stabilizer rows, n destabilizer rows and one scratch row, each 2n bits wide; update rules for H, S, CNOT, and measurement. Efficient classical simulation.
- 5.5The Lab. The Aaronson–Gottesman CHP simulator in Rust, refereed against a state vector and pushed to 1000 qubits.
5.1The Pauli group
F · FormalismChapter 2 introduced the single-qubit Pauli matrices , , alongside the identity . Their multiplication is closed up to phases — , , , and so on around the cycle. To make a genuine group we must carry those phases along. The single-qubit Pauli group is
sixteen elements in all. The -qubit Pauli group is built from tensor products of these — one factor per qubit — again with an overall phase :
We write such an element compactly by dropping the tensor signs: becomes XX, and becomes ZIZ. Every element squares to , and every element is either Hermitian (phase ) or anti-Hermitian (phase ); the Hermitian ones with eigenvalues are the observables we will measure.
One structural fact powers everything that follows. Take any two elements of . On each qubit their single-qubit factors either commute (if either is , or they are equal) or anticommute (two distinct non-identity Paulis). Multiplying the qubits together, the total sign is the parity of the number of anticommuting positions. Hence:
There is no middle ground — two Paulis commute or anticommute, never anything else. That clean dichotomy is exactly what lets us replace a state by a set of commuting operators and track it with single bits.
5.2Stabilizer states
F · FormalismC · ConceptsHere is the move. Instead of describing a state by its amplitudes, describe it by the operators that hold it still. We say a Pauli stabilizes when
that is, when is a eigenstate of . The set of all Paulis that stabilize a given state forms a group, its stabilizer . A stabilizer state on qubits is one pinned down completely by independent, commuting Pauli stabilizers: their common eigenspace is a single ray. They must commute (a state cannot be a eigenstate of two anticommuting operators, since would force ), and of them cut the -dimensional space down by a factor of to dimension one.
The canonical example is the Bell state. Take . Check directly: swaps and leaves the sum fixed, while gives on both and . So is stabilized by — two commuting Paulis on two qubits, and that pair is the state. No amplitudes appear.
The three-qubit GHZ state works the same way. It is fixed by (which swaps the two terms) and by the parity checks and (which read off that all three bits agree). So generates its stabilizer. Note the generating set is not unique — any product of generators is again a stabilizer, so names the same group. What matters is the group, not the particular handles we grab it by.
A generating set of Paulis is a wonderfully compact description. Each generator is two-bit symbols (one of ) plus a sign — about bits — so generators fit in bits, against complex amplitudes. Section 5.4 turns that observation into an algorithm; the lab pushes it to a thousand qubits.
5.3The Clifford group
F · FormalismA description is only useful if we can compute with it. We need to know which gates keep a stabilizer state a stabilizer state — that is, which unitaries send Paulis to Paulis under conjugation. If stabilizes , then stabilizes , because
So the whole stabilizer transforms by . If that map keeps us inside the Pauli group — if for every Pauli — then carries stabilizer states to stabilizer states, and we can track its effect on the generators alone. The unitaries with this property form the Clifford group .
Remarkably, the entire Clifford group is generated by just three gates from Chapter 2 — the Hadamard , the phase gate , and the two-qubit . Their conjugation actions are exactly the Pauli-to-Pauli maps you can verify by hand:
Read (5.6) as the rulebook for updating a tableau: to apply to qubit , swap the roles of and there; to apply , fold into ; and copies from control to target and from target to control. Each is a handful of bit operations on every generator. What (5.6) does not contain is any gate that leaves the Pauli group — the gate of Chapter 2, for instance, sends to , which is not a Pauli at all. Hold onto that omission; §5.4 shows why it is the whole story.
5.4Gottesman–Knill and the tableau
F · FormalismC · ConceptsPut the pieces together. A stabilizer input is generators; a Clifford gate is a fixed bit-rule on those generators; so a Clifford circuit of any length is just a sequence of cheap updates to a binary table of order rows, each bits wide plus a sign bit — the lab uses such rows, for reasons the next paragraph gives. This is the Gottesman–Knill theorem: any circuit built from , , , and computational-basis measurement, run on a stabilizer input, can be simulated on a classical computer in polynomial time.
The Aaronson–Gottesman representation makes this concrete. Store rows: stabilizer generators, partner destabilizer generators (which make measurement updates efficient), and one scratch row the deterministic branch of a measurement accumulates into. Each row is a bit vector of -parts and -parts plus a sign bit . A single-qubit Pauli on qubit is read off the pair : , , , . Play with it — apply gates and watch the generator rows update:
single-qubit gates
CNOT (control → target)
Applied: (nothing yet — state is |000⟩)
stabilizer generators
The state is the simultaneous +1 eigenstate of these three commuting Paulis.
binary tableau — stabilizer block
| gen | x0 | x1 | x2 | z0 | z1 | z2 | r |
|---|---|---|---|---|---|---|---|
| +ZII | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| +IZI | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
| +IIZ | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
Each generator is one row of X-bits and Z-bits plus a sign bit r. Every Clifford gate is a fixed rule that flips these bits — no amplitudes, no exponential blow-up.
Measurement is the subtle part, and it splits cleanly in two. To measure qubit in the basis, ask whether any stabilizer generator anticommutes with — equivalently, whether any stabilizer row has its -bit on qubit set. If none does, the outcome is deterministic: (or its negative) is already implied by the stabilizer, and we read the sign off by combining the relevant generators — no randomness, the correlation was fixed the moment the state was prepared. If some generator does anticommute, the outcome is a genuine fair coin: we record or with equal probability and update the tableau so that becomes a new generator. This is exactly the structure a stabilizer state always has — never any other probability.
That moral is the sharp edge promised at the start. A circuit of Cliffords on a stabilizer input, however deep and however entangled, is something your classical laptop keeps up with stride for stride. So whatever gives a quantum computer its power, it cannot be Clifford gates alone — you need at least one non-Clifford gate, the of Chapter 2 being the usual choice, to escape the tableau and reach states no binary table can name. Where that escape buys real speed, and where it only seems to, is the question of Part II.
5.5The Lab — a tableau simulator
P · PracticeThe formalism becomes a small, sharp Rust program: the Aaronson–Gottesman CHP simulator. A stabilizer state is a table of bools; each Clifford gate is a loop of XORs over the rows. Here is the core — the tableau and all three Clifford generators of §5.3, , and , each a direct transcription of its line in equation (5.6). The ops counter accumulates the elementary row-updates that the scaling chart below plots:
1/// A stabilizer state on `n` qubits, stored as a binary tableau over GF(2).2///3/// Rows 0..n are the DESTABILIZER generators, rows n..2n the STABILIZER4/// generators, and row 2n is a scratch row used during measurement. Each row5/// is a Pauli operator encoded by its X part `x[row][q]`, its Z part6/// `z[row][q]`, and a phase bit `r[row]` (false = +1, true = −1).7struct Tableau {8 n: usize,9 x: Vec<Vec<bool>>, // (2n+1) x n10 z: Vec<Vec<bool>>, // (2n+1) x n11 r: Vec<bool>, // 2n+112 ops: u64, // elementary GF(2) row-updates, a work proxy13}1415// …1617impl Tableau {18 // …1920 /// Hadamard on qubit a.21 fn h(&mut self, a: usize) {22 for i in 0..2 * self.n {23 self.r[i] ^= self.x[i][a] & self.z[i][a];24 let t = self.x[i][a];25 self.x[i][a] = self.z[i][a];26 self.z[i][a] = t;27 }28 self.ops += 2 * self.n as u64;29 }3031 /// Phase gate S on qubit a.32 fn s(&mut self, a: usize) {33 for i in 0..2 * self.n {34 self.r[i] ^= self.x[i][a] & self.z[i][a];35 self.z[i][a] ^= self.x[i][a];36 }37 self.ops += 2 * self.n as u64;38 }3940 /// CNOT with control a, target b.41 fn cnot(&mut self, a: usize, b: usize) {42 for i in 0..2 * self.n {43 self.r[i] ^= self.x[i][a] & self.z[i][b] & (self.x[i][b] ^ self.z[i][a] ^ true);44 let xb = self.x[i][b] ^ self.x[i][a];45 let za = self.z[i][a] ^ self.z[i][b];46 self.x[i][b] = xb;47 self.z[i][a] = za;48 }49 self.ops += 2 * self.n as u64;50 }5152 // …53}
Measurement is the one place with real branching — the deterministic and random cases of §5.4, each an tableau update rather than a walk over amplitudes:
1/// Measure qubit a in the Z basis, collapsing the tableau. `coin` supplies2 /// the outcome in the random case. Returns (outcome_bit, was_random).3 fn measure(&mut self, a: usize, coin: bool) -> (u8, bool) {4 let n = self.n;5 let pivot = (n..2 * n).find(|&row| self.x[row][a]);6 match pivot {7 Some(p) => {8 // Random outcome: make p the only anticommuting generator.9 for i in 0..2 * n {10 if i != p && self.x[i][a] {11 self.rowsum(i, p);12 }13 }14 // The old stabilizer p becomes a destabilizer; p becomes ±Z_a.15 self.row_copy(p - n, p);16 for j in 0..n {17 self.x[p][j] = false;18 self.z[p][j] = false;19 }20 self.r[p] = coin;21 self.z[p][a] = true;22 (coin as u8, true)23 }24 None => {25 // Deterministic outcome: accumulate in the scratch row.26 let scratch = 2 * n;27 for j in 0..n {28 self.x[scratch][j] = false;29 self.z[scratch][j] = false;30 }31 self.r[scratch] = false;32 for i in 0..n {33 if self.x[i][a] {34 self.rowsum(scratch, i + n);35 }36 }37 (self.r[scratch] as u8, false)38 }39 }40 }
The lab does not ask you to trust the update rules; it proves them. A from-scratch state-vector simulator plays referee: on hundreds of random Clifford circuits (up to eight qubits) every measurement outcome and its deterministic/random label must match the tableau exactly, sharing the same coin flips. The Bell and GHZ generators are read back and confirmed to hold their states at — and the residual there is not merely small but exactly zero, since a Pauli only permutes and negates amplitudes of .
At a thousand qubits there is no oracle left: the -amplitude state vector could never be written down. So the three referees that run there grade predictions against the measurement outcomes themselves, and each of them is a count of how many the tableau got wrong. In a GHZ state, once qubit 0 has been measured every remaining outcome must be flagged deterministic and repeat the first. A measurement repeated immediately must return the same bit, now with certainty — the one check that exercises the destabilizer bookkeeping at that size. And once every qubit of a random Clifford state has been measured, the surviving generators must be exactly the stabilizer group of the recorded bit string: pure -strings whose signs are its parities. Each doubtful measurement is handed a poisoned coin, the opposite of the required answer, so a branch that wrongly calls an outcome random convicts itself twice over.
What the lab pointedly does not referee is the clock. The tableau's speed is this chapter's whole point, so the times are reported — but a stopwatch measures the machine, not the physics, and a gate on wall time would fail on a busy laptop while passing a simulator that is fast and wrong. Every number below is whatever your last cargo run --release produced:
cargo run --release in Rust-QML/ch05-stabilizer)Run it yourself with cargo run --release in Rust-QML/ch05-stabilizer. The tableau is the working language of quantum error correction, which Part III builds on top of it — and, read the other way, it is a precise map of the territory where quantum computers win nothing at all.
5.6Exercises
1. (F) Prove the commute-or-anticommute dichotomy (5.3) in full: show that two elements of anticommute precisely when they differ (as non-identity Paulis) on an odd number of qubits, and commute otherwise.
2. (F) Verify by hand that stabilizes , and that the third nontrivial group element stabilizes it too. Since , why is it , not , that is the correct stabilizer (the element with eigenvalue )?
3. (C) Using the tableau explorer, prepare the Bell state on , then apply to both qubits. What are the new generators? Explain the result from the conjugation rule .
4. (C) Starting from , find a gate sequence in the explorer whose stabilizer generators are . Confirm it is the GHZ state, and give a second, different generating set for the same group.
5. (P) The lab's three large- referees all grade outcomes. Add one that grades the tableau's internal structure instead: the CHP invariant that destabilizer anticommutes with stabilizer and commutes with every other stabilizer, and that all stabilizers mutually commute. Two Paulis and anticommute exactly when is odd over . Check it on a random Clifford state, then check it survives a measurement — and report how many pairs you had to test.
6. (P, hard) The tableau cannot represent , since is non-Clifford. Prove it: show that no single-qubit stabilizer fixes , so it is not a stabilizer state at all. Then argue why this single gate is enough, in principle, to break the Gottesman–Knill guarantee — and connect it to the universality result of Chapter 2.
The bridge → Chapter 6: Interference as Computation
Where you stand. You can now describe and simulate a vast family of quantum machines with a binary tableau — Bell and GHZ states, the full Clifford group, measurement — in polynomial time, refereed to a thousand qubits. And you have seen the flip side plainly: that entire world offers no quantum advantage, because a laptop keeps pace.
The open question. If the states we can simulate cheaply — however entangled — buy nothing, then quantum advantage must come from the states and gates that escape the tableau. What, precisely, does a quantum computer do with those extra degrees of freedom that a classical one cannot match?
What comes next. Part II opens by isolating the mechanism: interference. We build oracles and simple algorithms — Deutsch–Jozsa, Bernstein–Vazirani — where amplitudes with opposite phase cancel wrong answers and reinforce right ones, and measure exactly how much that saves over any classical query strategy.