Stabilizer Codes¶
The parity checks from Repetition Codes and Encoding & Syndrome Measurement were built by hand for one specific code. This page generalizes them into stabilizers — the mathematical language that describes checks like \(S_1\) and \(S_2\) for essentially any quantum error-correcting code, not just the 3-qubit repetition code.
This isn't a heavy math section. The goal is the mental model and vocabulary you'll need for surface codes later.
Starting From What You Already Know¶
What if we wanted to describe these checks mathematically, in a way that generalizes to much larger codes?
Stabilizers are operators whose expected measurement outcome characterizes the valid encoded states.
What Does "Stabilize" Mean?¶
A stabilizer represents a property that the encoded state satisfies — before any notation, that's all it is.
If an error occurs, one or more checks change, and the syndrome changes with them:
The stabilizer doesn't tell us the logical state. It tells us whether the encoded state still satisfies the required constraints.
Introducing Pauli Operators¶
You've already met three of these in Errors and Noise:
| Operator | Meaning |
|---|---|
| \(I\) | no error |
| \(X\) | bit-flip type error |
| \(Z\) | phase-flip type error |
| \(Y\) | combined X/Z behavior |
Stabilizers are built from products of these operators acting on multiple qubits at once. For example, the two repetition-code checks are:
You don't need to be able to multiply operators together yet — just recognize that a stabilizer is really a list of one Pauli operator per physical qubit (most of them \(I\), meaning "not involved").
Main Interactive — Build a Stabilizer¶
Pick a preset below to see how a stabilizer is assembled from one operator per qubit.
Select a preset above to see its operator sequence.
Explore the stabilizer circuit →
This shows the currently selected stabilizer above measured with a single ancilla — the same technique from Encoding & Syndrome Measurement, now generalized to whichever qubits that stabilizer actually involves.
Interactive — Find the Changed Stabilizer¶
Start from a valid encoded state (\(S_1 = +1\), \(S_2 = +1\)) and inject a single-qubit error. Watch which stabilizer(s) change.
No error — both stabilizers are satisfied.
The formal picture: anticommutation
An error and a stabilizer either commute (the check is unaffected) or anticommute (the check flips sign). Two single-qubit Pauli operators anticommute exactly when they're different and neither is \(I\) — for example, \(X\) and \(Z\) anticommute, but \(X\) and \(X\) commute. For a multi-qubit stabilizer, the check flips when the error anticommutes with an odd number of the stabilizer's per-qubit operators. That's the rule the interactive above is computing.
This gives you the physical error → syndrome connection in full generality:
Stabilizer vs. Logical Operator¶
These sound similar but do opposite jobs:
- A stabilizer asks: "Does the state still satisfy the code's constraints?"
- A logical operator asks nothing — it changes the encoded logical state.
We generally do not want syndrome measurements to reveal the logical information being protected — that's the whole point of the measurement caveat from Encoding & Syndrome Measurement. Stabilizers are designed to commute with the logical operators, so measuring them never touches the encoded information itself.
Number of Qubits and Code Space¶
A system of \(n\) physical qubits has a large space of possible states. Stabilizer constraints restrict that space down to a much smaller code space, where the logical information actually lives:
Preview: [[n, k, d]] notation
You may see a stabilizer code written as \([[n, k, d]]\) — meaning \(n\) physical qubits encode \(k\) logical qubits with code distance \(d\). The 3-qubit repetition code, for what it protects against, is a \([[3, 1, 3]]\) code. We won't derive this yet; it's vocabulary that becomes useful once you're comparing codes.
From One Code to a Family of Codes¶
Stabilizers aren't specific to the 3-qubit repetition code — they're a common language for describing many different QEC codes:
Different codes choose different sets of stabilizers — arranged differently, acting on different numbers of qubits — but they all share this same underlying structure. That's what makes stabilizers such a useful common language, and it's exactly what prepares you for Surface Codes, where stabilizers get arranged on a two-dimensional lattice.
Takeaway¶
Stabilizers define the constraints of the code; syndrome measurements tell us which of those constraints have been violated.
We now know how to build the checks (stabilizers) and read their outcomes (syndrome) for essentially any code. But knowing that something's wrong isn't the same as knowing what to do about it — given a syndrome, how do we decide which correction to apply?