Encoding & Syndrome Measurement¶
Repetition Codes showed the whole encode → detect → correct pattern in one demo, but skated past one crucial question: how do you get the information needed to correct an error without collapsing the very state you're trying to protect? This page slows down and answers that question directly.
The central idea for the rest of this page:
We don't ask "What is the logical state?" We ask "Is there evidence that the physical qubits disagree?"
Starting with the Problem¶
How can we determine which physical qubit was affected — without measuring the logical qubit itself?
The answer: measure relationships between the physical qubits, not the qubits' individual values.
What Is a Syndrome?¶
A syndrome is the set of measurement outcomes obtained from the checks used to detect errors. For the 3-qubit repetition code, those checks are the same parity checks from Repetition Codes:
Each check asks a yes/no question about a pair of qubits — do they agree with each other? — rather than asking what either qubit's value is. We won't need the full mathematical machinery behind \(Z_1Z_2\) yet; for now it's enough to know it's a measurement whose outcome is \(+1\) when q₁ and q₂ agree, and \(-1\) when they don't.
Main Interactive — Measure the Syndrome¶
Pick a scenario, then take the deliberate step of measuring the syndrome.
1. Choose what happened:
For reference:
| Error | Syndrome |
|---|---|
| None | (+1, +1) |
| X₁ | (−1, +1) |
| X₂ | (−1, −1) |
| X₃ | (+1, −1) |
Explore the circuit →
This is optional. The interactive above is the canonical way to understand syndrome measurement in this module — this is just a peek at how it's actually implemented as a quantum circuit, using two extra ancilla qubits entangled with the data qubits via CNOT gates and then measured. The ancilla measurement outcome is the syndrome bit — the data qubits themselves are never measured.
- Data qubits (q₁, q₂, q₃) — the encoded physical qubits, never measured directly.
- Ancilla / check qubits (a₁, a₂) — fresh qubits used only to extract syndrome information.
- Entangling gates (●–⊕) — a CNOT from a data qubit into an ancilla, flipping the ancilla if that data qubit is |1⟩.
- M — measurement of the ancilla in the computational basis.
- Syndrome result — the ancilla outcomes, translated into (+1/−1) exactly like the simplified view above.
Uses whichever scenario is currently set up in the interactive above.
The Crucial Measurement Concept¶
Syndrome measurements give information about the presence and location of errors without directly revealing whether the logical qubit represents \(|0\rangle\), \(|1\rangle\), or a superposition of both.
That said, this isn't "measurement that never disturbs anything" — that would overstate it. QEC is deliberately designed so that the operators being measured (\(S_1\), \(S_2\), and their generalizations) commute with the encoded logical information. That's precisely what lets them extract error information while leaving the protected state alone.
Interactive Challenge — Decode the Syndrome¶
Given a syndrome, can you identify the error it's consistent with?
Syndrome ≠ error
A syndrome doesn't necessarily tell us the complete history of what happened — it tells us what error information is consistent with the measured checks. For the single-error cases in this section, that's enough to pin down the answer exactly. In larger codes, multiple different physical error patterns can sometimes produce the very same syndrome.
From Repetition Codes to Stabilizers¶
The parity-check idea generalizes well beyond three qubits:
In stabilizer codes, the operators used for these checks are called stabilizers, and their measurement outcomes form the syndrome — exactly the pattern you just used, generalized to codes far more powerful than three qubits in a row. We'll leave the formalism itself for Stabilizer Codes.
Takeaway¶
We can measure error information without directly measuring the logical state. But once we have a syndrome, how do we decide which error most likely occurred? That decision is called decoding — but first, let's generalize the parity-check idea itself so it works for codes far more powerful than the repetition code.