The Three-Qubit Code

A satellite beams a qubit through a noisy channel. Somewhere along the way, a stray cosmic ray flips its state. On a classical bit this would be trivial to fix. Send three copies and take a majority vote. On a qubit this fix seems impossible. Measuring it to check for errors destroys the very superposition we are trying to protect. The three-qubit bit-flip code resolves this paradox. It gives the first working example of a genuine quantum error-correcting code. The stakes are not abstract. Every physical qubit — a trapped ion, a superconducting loop, a photon — is bathed in an environment. That environment constantly nudges its state through unwanted interactions. Without a way to detect and reverse these nudges, no quantum computation longer than a few gates could survive intact. The three-qubit code is the smallest, cleanest illustration of a general strategy. This strategy is used in every real quantum error-correcting code: encode one logical qubit redundantly across several physical qubits. Then extract only the information needed to diagnose the error. Never extract the delicate quantum information itself. The big picture is this: quantum error correction must fight two enemies at once. First, the no-cloning theorem rules out simply copying an unknown qubit. Classical repetition codes can copy a bit this way, but qubits cannot be copied. Second, any error-detection measurement threatens to collapse a superposition. The three-qubit code shows how to encode logical information across an entangled triple of qubits. It also shows how to measure syndromes — coarse, error-revealing information. This happens while leaving the logical superposition untouched. This same syndrome-extraction machinery, only slightly generalized, powers the Stabilizer Codes framework. It also powers the full nine-qubit Shor Code. This article builds the code from first principles: encoding, error model, syndrome extraction circuit, recovery, and a full correctness proof. That proof is based on the discreteness of quantum errors. It closes with a worked numerical trace, a table of common misconceptions, and the history of how this idea emerged in 1995.

Key takeaways
  • Encodes one logical qubit into three physical qubits using repetition: ∣0⟩L=∣000⟩|0\rangle_L=|000\rangle, ∣1⟩L=∣111⟩|1\rangle_L=|111\rangle.
  • Corrects any single bit-flip (XX) error on one of the three physical qubits, exactly once per round.
  • Uses two ancilla qubits to measure parity checks (syndromes) without measuring or collapsing the logical qubit.
  • Correctness rests on the fact that quantum errors, though continuous in principle, project onto a discrete set of correctable cases.
  • A dual version with Hadamard-rotated encoding corrects phase-flip (ZZ) errors instead — the two combine in the Shor code.
  • Cannot correct two simultaneous errors on different qubits, and offers no protection against phase-flip noise on its own.
The core insight

Measuring parity between qubits reveals where an error happened without revealing what the encoded quantum state is, making correction possible without collapse.

The idea

The three-qubit bit-flip code protects one logical qubit from the bit-flip channel, the quantum analogue of a bit that randomly flips 0↔10 \leftrightarrow 1. It encodes a single logical qubit ∣ψ⟩L=α∣0⟩L+β∣1⟩L|\psi\rangle_L = \alpha|0\rangle_L + \beta|1\rangle_L into three physical qubits via the encoding map

∣0⟩↦∣000⟩,∣1⟩↦∣111⟩,|0\rangle \mapsto |000\rangle, \qquad |1\rangle \mapsto |111\rangle,

so that an arbitrary state α∣0⟩+β∣1⟩\alpha|0\rangle + \beta|1\rangle becomes the entangled state α∣000⟩+β∣111⟩\alpha|000\rangle + \beta|111\rangle. This is emphatically not three independent copies of α∣0⟩+β∣1⟩\alpha|0\rangle+\beta|1\rangle — that would violate the no-cloning theorem. It is one logical qubit's amplitude structure spread coherently across a triple of physical qubits, all correlated. The error model under consideration is the independent bit-flip channel: each physical qubit, independently, either survives unchanged (probability 1−p1-p) or is hit by a Pauli XX operator (probability pp), which swaps ∣0⟩↔∣1⟩|0\rangle \leftrightarrow |1\rangle. This is a caricature of real noise, but it captures the essential difficulty: an XX error can strike any one of the three qubits, at an unknown time, and we must find and undo it without ever learning α\alpha or β\beta. The key mechanism is syndrome extraction. Rather than measuring the three data qubits directly (which would collapse the superposition and destroy α,β\alpha,\beta), the protocol measures two parity checks: whether qubits 1 and 2 agree, and whether qubits 2 and 3 agree. These parities are the eigenvalues of the stabilizer generators Z1Z2Z_1Z_2 and Z2Z3Z_2Z_3. Crucially, Z1Z2Z_1Z_2 and Z2Z3Z_2Z_3 commute with the logical operators XL=X1X2X3X_L = X_1X_2X_3 and ZL=Z1Z2Z3Z_L = Z_1Z_2Z_3, so measuring them extracts error information while leaving the encoded logical state completely undisturbed. This idea — measure operators that commute with the logical algebra but anticommute with likely errors — is the seed from which the entire Stabilizer Codes formalism grows.

How it works

Encoding. Starting from ∣ψ⟩∣0⟩∣0⟩=(α∣0⟩+β∣1⟩)∣0⟩∣0⟩|\psi\rangle|0\rangle|0\rangle = (\alpha|0\rangle+\beta|1\rangle)|0\rangle|0\rangle, two CNOT gates, controlled by qubit 1 and targeting qubits 2 and 3, produce

α∣000⟩+β∣111⟩.\alpha|000\rangle + \beta|111\rangle.

Noise. The channel independently applies XX to each of the three qubits with probability pp, and leaves it alone with probability 1−p1-p. We assume (for the basic analysis) at most one qubit is flipped per round — a good approximation when pp is small, since two simultaneous flips occur with probability O(p2)O(p^2).

Syndrome extraction. Two ancilla qubits, initialized to ∣0⟩|0\rangle, are used to non-destructively measure the parities Z1Z2Z_1Z_2 and Z2Z3Z_2Z_3. This is done with CNOT gates: ancilla a1a_1 is flipped by qubits 1 and 2 (measuring Z1⊕Z2Z_1 \oplus Z_2 in the computational basis sense), and ancilla a2a_2 is flipped by qubits 2 and 3.

Correction. The two classical bits (s1,s2)(s_1, s_2) obtained from measuring the ancillas identify which qubit (if any) was flipped, via a lookup table. A classically controlled XX gate is applied to that qubit, restoring the encoded state exactly. ``` // THREE-QUBIT BIT-FLIP CODE function ENCODE(psi): // psi lives on qubit q0; q1, q2 start at |0> CNOT(q0 -> q1) CNOT(q0 -> q2) return (q0, q1, q2) // now alpha|000> + beta|111> function NOISE(q0, q1, q2, p): for q in (q0, q1, q2): with probability p: apply X(q) return (q0, q1, q2) function EXTRACT_SYNDROME(q0, q1, q2): a1, a2 <- |0>, |0> // fresh ancillas CNOT(q0 -> a1); CNOT(q1 -> a1) // a1 = q0 XOR q1 CNOT(q1 -> a2); CNOT(q2 -> a2) // a2 = q1 XOR q2 s1 <- MEASURE(a1) // classical bit, Z-basis s2 <- MEASURE(a2) return (s1, s2) function RECOVER(q0, q1, q2, s1, s2): // Syndrome table (derived below) if (s1, s2) == (0, 0): pass // no error else if (s1, s2) == (1, 0): apply X(q0) // q0 flipped else if (s1, s2) == (1, 1): apply X(q1) // q1 flipped else if (s1, s2) == (0, 1): apply X(q2) // q2 flipped return (q0, q1, q2) // restored to alpha|000> + beta|111> function DECODE(q0, q1, q2): CNOT(q0 -> q2) CNOT(q0 -> q1) return q0 // logical qubit recovered ``` The syndrome table is derived directly from the parity structure. If qubit ii alone is flipped, it disagrees with its neighbors; the two parity bits record exactly which boundary of agreement/disagreement appears, pinpointing ii uniquely, regardless of α\alpha and β\beta.

Figure
Syndrome extraction circuit for the three-qubit bit-flip code
q0: α|0⟩+β|1⟩ q1: |0⟩ q2: |0⟩ a1: |0⟩ a2: |0⟩ encode noisy channel syndrome extraction M s1 M s2 classical bits s1 → s2 →

Complexity & correctness

Resource cost. Encoding one logical qubit costs 2 CNOT gates and 2 extra physical qubits. Syndrome extraction costs 4 CNOT gates and 2 ancilla qubits, plus 2 classical measurements. Recovery costs at most 1 conditional XX gate. All of this is O(1)O(1) — constant overhead independent of circuit depth — per round of error correction. Repeating this every fixed number of time steps, over a computation of TT logical gates, multiplies total resource use by a constant factor, not asymptotically, since the code distance stays fixed at d=3d=3 physical qubits per logical qubit.

Why this is efficient in practice: the only growth in overhead comes from wanting a lower logical error rate, which requires larger codes (distance dd scales with desired suppression), not from this specific code's mechanics. The three-qubit code is a proof of concept with minimal d=3d=3; larger stabilizer and topological codes trade more qubits for better suppression, following the same syndrome-extraction blueprint.

Correctness proof sketch. The crux of quantum error correction is recognizing that even though a general error is a continuous quantum channel, our measurement of the syndrome projects it onto a discrete outcome. Here is the precise argument. Let the codespace be C=span{∣000⟩,∣111⟩}\mathcal{C} = \text{span}\{|000\rangle, |111\rangle\}. Consider the four possible single-qubit error operators: II (no error), X1X_1, X2X_2, X3X_3 (bit-flip on qubit 1, 2, or 3). Apply one of these to an encoded state ∣ψL⟩=α∣000⟩+β∣111⟩|\psi_L\rangle = \alpha|000\rangle+\beta|111\rangle:

I∣ψL⟩=α∣000⟩+β∣111⟩I|\psi_L\rangle = \alpha|000\rangle + \beta|111\rangle
X1∣ψL⟩=α∣100⟩+β∣011⟩X_1|\psi_L\rangle = \alpha|100\rangle + \beta|011\rangle
X2∣ψL⟩=α∣010⟩+β∣101⟩X_2|\psi_L\rangle = \alpha|010\rangle + \beta|101\rangle
X3∣ψL⟩=α∣001⟩+β∣110⟩X_3|\psi_L\rangle = \alpha|001\rangle + \beta|110\rangle

These four resulting states live in four mutually orthogonal two-dimensional subspaces of the 8-dimensional Hilbert space (C2)⊗3(\mathbb{C}^2)^{\otimes 3}. Orthogonality is easy to check: the basis strings {000,111}\{000,111\}, {100,011}\{100,011\}, {010,101}\{010,101\}, {001,110}\{001,110\} are pairwise disjoint sets of bit strings, hence the subspaces they span are orthogonal. The syndrome measurement is precisely a projective measurement that distinguishes these four orthogonal subspaces — it measures Z1Z2Z_1Z_2 and Z2Z3Z_2Z_3, whose four joint eigenspaces are exactly the four subspaces above:

ErrorZ1Z2Z_1Z_2 eigenvalueZ2Z3Z_2Z_3 eigenvaluesyndrome (s1,s2)(s_1,s_2)
II+1+1+1+1(0,0)(0,0)
X1X_1−1-1+1+1(1,0)(1,0)
X2X_2−1-1−1-1(1,1)(1,1)
X3X_3+1+1−1-1(0,1)(0,1)

Because measuring which orthogonal subspace the state lies in does not disturb the state within that subspace, the coefficients α,β\alpha,\beta survive completely intact — this is the standard projective-measurement postulate applied to a degenerate two-dimensional eigenspace. Once the syndrome (i.e., the subspace) is known, applying the inverse Pauli (XiX_i again, since Xi2=IX_i^2=I) maps the state back to C\mathcal{C} exactly, recovering α∣000⟩+β∣111⟩\alpha|000\rangle+\beta|111\rangle with fidelity 1. This is the general mechanism behind all of quantum error correction, first formalized as the Quantum Error Correction Conditions (Knill–Laflamme criteria): correctable errors must map the codespace into mutually orthogonal subspaces indexed by distinguishable syndromes, and within each subspace act identically up to a fixable unitary. The three-qubit code satisfies this exactly for the single-bit-flip error set {I,X1,X2,X3}\{I, X_1, X_2, X_3\}.

Honest limitations.

  • If two of the three qubits flip simultaneously, the resulting state lands in the same subspace as a single flip on the third qubit (e.g., X1X2∣ψL⟩=α∣110⟩+β∣001⟩X_1X_2|\psi_L\rangle = \alpha|110\rangle+\beta|001\rangle, indistinguishable in syndrome from X3X_3 alone), and the recovery procedure misdiagnoses and actively introduces a logical error. This is why the code corrects at most one bit-flip error; it has distance d=3d=3.
  • The code offers zero protection against phase-flip (ZZ) errors: applying Z1Z_1 to α∣000⟩+β∣111⟩\alpha|000\rangle+\beta|111\rangle produces α∣000⟩−β∣111⟩\alpha|000\rangle-\beta|111\rangle, an undetectable logical phase error, since Z1Z_1 has trivial syndrome only when it acts identically on the code as Z2Z_2 or Z3Z_3 up to sign — in fact any single ZiZ_i flips the relative sign and is not even correctable in principle by this code, since Z1Z_1, Z2Z_2, Z3Z_3 all commute with both stabilizers and act as the same logical operator (up to global phase) on the codespace, making them indistinguishable from each other and from a logical ZZ error.
  • The syndrome extraction circuit itself, if implemented with noisy CNOTs, can propagate errors onto the data qubits or introduce faulty syndromes — full fault tolerance requires additional care (repetition of syndrome measurement, fault-tolerant gadgets), a topic that becomes central once we scale to Stabilizer Codes and beyond.

Worked example

Take the logical state ∣ψL⟩=12(∣0⟩L+∣1⟩L)=12(∣000⟩+∣111⟩)|\psi_L\rangle = \tfrac{1}{\sqrt2}(|0\rangle_L + |1\rangle_L) = \tfrac{1}{\sqrt2}(|000\rangle + |111\rangle), i.e. α=β=1/2\alpha=\beta=1/\sqrt2. Suppose the noise channel flips qubit 2 (an X2X_2 error).

StepState / Value
After encoding12(∥000⟩+∥111⟩)\tfrac{1}{\sqrt2}(\|000\rangle + \|111\rangle)
Noise appliedX2X_2 flips qubit index 2 (0-indexed middle qubit)
After noise12(∥010⟩+∥101⟩)\tfrac{1}{\sqrt2}(\|010\rangle + \|101\rangle)
Ancilla a1=q0⊕q1a_1 = q_0 \oplus q_1On ∥010⟩\|010\rangle: 0⊕1=10\oplus1=1. On ∥101⟩\|101\rangle: 1⊕0=11\oplus0=1. Both terms give a1=1a_1=1.
Ancilla a2=q1⊕q2a_2 = q_1 \oplus q_2On ∥010⟩\|010\rangle: 1⊕0=11\oplus0=1. On ∥101⟩\|101\rangle: 0⊕1=10\oplus1=1. Both terms give a2=1a_2=1.
Measured syndrome(s1,s2)=(1,1)(s_1,s_2) = (1,1) — deterministic, same for both branches of the superposition
Lookup table(1,1)⇒(1,1) \Rightarrow qubit q1q_1 (index 1, the middle qubit) was flipped
RecoveryApply XX to q1q_1
After recovery12(∥000⟩+∥111⟩)\tfrac{1}{\sqrt2}(\|000\rangle + \|111\rangle) — exactly restored

The crucial detail: the syndrome (1,1)(1,1) came out identically on both branches ∣010⟩|010\rangle and ∣101⟩|101\rangle of the superposition. This is exactly the orthogonality argument from the correctness proof made concrete — the measurement reveals where the error struck without ever distinguishing the α\alpha-branch from the β\beta-branch, so no information about α,β\alpha,\beta leaks out and no collapse of the logical superposition occurs. Now contrast with a double error: suppose instead X1X_1 and X2X_2 both strike. Then ∣000⟩→∣110⟩|000\rangle \to |110\rangle and ∣111⟩→∣001⟩|111\rangle\to|001\rangle, giving 12(∣110⟩+∣001⟩)\tfrac{1}{\sqrt2}(|110\rangle+|001\rangle). Checking parities: a1=1⊕1=0a_1 = 1\oplus1=0 and 0⊕0=00\oplus0=0 (consistent, s1=0s_1=0); a2=1⊕0=1a_2=1\oplus0=1 and 0⊕1=10\oplus1=1 (consistent, s2=1s_2=1). Syndrome (0,1)(0,1) — the table says "qubit 2 (index 2) was flipped," so recovery applies XX to q2q_2, giving 12(∣111⟩+∣000⟩)\tfrac{1}{\sqrt2}(|111\rangle+|000\rangle) up to relabeling — but wait, tracing through carefully: X2X_2 applied to ∣110⟩|110\rangle gives ∣111⟩|111\rangle and to ∣001⟩|001\rangle gives ∣000⟩|000\rangle, yielding 12(∣111⟩+∣000⟩)=∣ψL⟩\tfrac{1}{\sqrt2}(|111\rangle+|000\rangle) = |\psi_L\rangle. In this particular case the double error happens to be corrected — but this is a coincidence of this specific pair; in general, a double bit-flip XiXjX_iX_j is indistinguishable from a single flip XkX_k on the third qubit and the "correction" instead applies XkX_k, producing XiXjXk∣ψL⟩=X1X2X3∣ψL⟩X_iX_jX_k|\psi_L\rangle = X_1X_2X_3|\psi_L\rangle, which equals the logical XLX_L operator and swaps α↔β\alpha\leftrightarrow\beta — a full logical error. This illustrates precisely why the code's guarantee is limited to at most one physical bit-flip per round.

Common pitfalls & traps

PitfallWhy it happensFix
Measuring the data qubits directly to "check for errors"Confusing classical repetition codes with quantum ones; forgetting no-cloning and collapseMeasure only the syndrome ancillas (Z1Z2Z_1Z_2, Z2Z3Z_2Z_3), never the data qubits in the computational basis
Assuming the code fixes phase-flip noise tooConflating "quantum error correction" with "corrects all errors"Recognize this code targets XX errors only; a separate Hadamard-basis code targets ZZ errors
Believing two independent bit flips are always fixedWorking only the toy example where it happens to cancelTwo flips on two different qubits generically produce the same syndrome as a single flip on the third qubit, causing a logical error
Forgetting ancillas must start in a known, uncorrelated stateSkipping initialization in circuit diagramsAlways reset ancillas to ∣0⟩\lvert0\rangle before each syndrome round
Applying recovery based on syndrome bits before they are fully measuredRace between classical readout and conditional gateRecovery must be classically conditioned on the completed measurement outcome, not applied speculatively

Pioneers & history

The three-qubit bit-flip code marks the moment quantum error correction stopped being a theoretical impossibility and became an engineering blueprint.

Origins · 1 minPeter W. Shor and how this was discovered
PW
Peter W. Shor
born 1959 · Bell Labs, then MIT — devised the first quantum error-correcting code and the eponymous factoring algorithm

Shor, already famous for his 1994 factoring algorithm that jolted the field into taking quantum computing seriously, turned immediately to the question of whether quantum information could survive noise at all. His 1995 paper constructing the nine-qubit code (combining the bit-flip and phase-flip repetition ideas) proved for the first time that quantum error correction is possible in principle, directly answering skepticism that decoherence would make large quantum computers fundamentally unbuildable.

History
1995
— Peter Shor publishes the nine-qubit quantum error-correcting code, embedding the three-qubit bit-flip code (and its phase-flip dual) as its core building block.
1996
— Andrew Steane and, independently, Robert Calderbank and Peter Shor generalize the construction into the CSS code family, unifying classical linear codes with quantum error correction.
1996
— Daniel Gottesman formalizes the stabilizer formalism, recasting syndrome extraction (as used here) into a systematic group-theoretic framework.
1997
— The threshold theorem (Aharonov, Ben-Or; Knill, Laflamme, Zurek) shows that if physical error rates fall below a constant threshold, arbitrarily long quantum computation is possible using concatenated codes.
2020
s — Superconducting and trapped-ion hardware groups implement three- and five-qubit repetition codes experimentally as milestones toward fault-tolerant logical qubits.

Where this matters

Every current effort to build a fault-tolerant quantum computer relies on the same conceptual skeleton first exhibited by the three-qubit code: encode redundantly, extract syndromes without measuring logical information, and correct. Google's and IBM's superconducting qubit programs run repetition codes — direct multi-qubit generalizations of this bit-flip code — as calibration and demonstration experiments for logical error suppression. Trapped-ion platforms (Quantinuum, IonQ) and neutral-atom arrays (QuEra, Pasqal) similarly benchmark syndrome-extraction cycles using small stabilizer codes derived from this exact template. Beyond hardware demonstrations, the three-qubit code is the pedagogical entry point to the entire modern theory of fault tolerance. The Knill–Laflamme correctability conditions it satisfies generalize directly to arbitrary Stabilizer Codes, including the surface code that underlies most large-scale fault-tolerant architecture roadmaps today. Its natural extension, combining bit-flip and phase-flip protection, is precisely Shor's original nine-qubit code — the historical proof that quantum computation can, in principle, be made arbitrarily reliable despite continuous, uncontrollable noise.

Ask the tutor: How would you modify this code and its circuit to correct a phase-flip (Z) error instead of a bit-flip?

Why can't we just copy the qubit three times like a classical repetition code?

The no-cloning theorem forbids creating three independent copies of an unknown quantum state α∣0⟩+β∣1⟩\alpha|0\rangle+\beta|1\rangle; any attempt to "copy" a superposition via a unitary necessarily fails for generic α,β\alpha,\beta. What the three-qubit code does instead is fundamentally different: it uses CNOT gates to spread the same pair of amplitudes α,β\alpha,\beta across a single entangled state α∣000⟩+β∣111⟩\alpha|000\rangle+\beta|111\rangle. This is one coherent object living in an 8-dimensional space, not three copies of a 2-dimensional object. The redundancy is structural (entanglement across basis strings), not literal duplication, and this distinction is exactly what makes the scheme compatible with no-cloning.

Does measuring the syndrome ever reveal anything about α and β?

No, by construction. The operators Z1Z2Z_1Z_2 and Z2Z3Z_2Z_3 have eigenspaces that each contain both basis strings needed to represent an arbitrary superposition (e.g. the no-error eigenspace contains both ∣000⟩|000\rangle and ∣111⟩|111\rangle). Because the syndrome measurement projects onto one of these two-dimensional eigenspaces without further resolving which vector inside it the state occupies, the relative amplitudes α,β\alpha,\beta pass through unchanged. This engineered "blindness" to logical information, while retaining full sensitivity to which physical qubit flipped, is the central trick of every stabilizer code.

What if the syndrome measurement itself introduces an error, e.g. a faulty CNOT?

This is a real and serious concern called fault tolerance. The basic three-qubit code as presented assumes ideal syndrome-extraction gates; if the CNOTs used to compute the ancilla parities are themselves noisy, they can propagate an error back onto the data qubits or produce an incorrect syndrome, potentially causing a misdiagnosed (and harmful) recovery operation. Real implementations address this by using fault-tolerant syndrome-extraction circuits, repeating syndrome measurements multiple times, and using majority voting over syndrome rounds — techniques developed extensively in the stabilizer and surface-code literature.

Why does this code fail against phase-flip (Z) errors specifically?

A phase-flip ZiZ_i applied to any one of the three qubits multiplies the ∣111⟩|111\rangle component of the codeword by −1-1 (since exactly one of the three qubits in that basis string is a ∣1⟩|1\rangle, picking up the sign), producing α∣000⟩−β∣111⟩\alpha|000\rangle-\beta|111\rangle regardless of which qubit ii was hit. All three single-qubit ZZ errors are therefore completely indistinguishable from each other by any measurement compatible with preserving the codespace, and moreover this transformation is exactly the action of the logical operator ZLZ_L. There is no syndrome information to extract because the "error" and the logical operation coincide.

How does this relate to the Shor code mentioned as a follow-up topic?

Shor's nine-qubit code is built by nesting two three-qubit codes: first apply a phase-flip-correcting code (using the Hadamard-rotated version of this construction) to encode one qubit into three "blocks," then apply the bit-flip-correcting three-qubit code within each block, giving nine physical qubits total. This concatenation lets the code correct an arbitrary single-qubit error — any combination of bit-flip and phase-flip on one qubit — since the two constituent codes handle each error type independently and simultaneously. The three-qubit code studied here is therefore not just a toy example; it is literally one half of the first fully general quantum error-correcting code.

Is the three-qubit code used in real quantum hardware today?

Directly as a production error-correcting code, rarely — its distance-3, single-error-type limitation is too weak for genuine fault tolerance. But as an experimental milestone and calibration tool, repetition codes built on exactly this principle are run routinely on superconducting and trapped-ion devices to measure logical error rates, validate syndrome-extraction circuits, and demonstrate that error suppression scales correctly as more qubits are added. It remains the standard first experiment any new quantum error correction platform performs.

What's the difference between "detecting" and "correcting" an error here?

Detection would mean learning that an error occurred, possibly without knowing where; correction requires learning enough to reverse it. The two-bit syndrome (s1,s2)(s_1,s_2) in this code does both simultaneously: a nonzero syndrome detects that some error occurred, and its specific value among four possibilities pinpoints exactly which qubit (if any) was affected, enabling immediate, deterministic correction via a lookup table. This dual detect-and-locate property, achievable only because the number of correctable error types matches the number of distinguishable syndromes, is a hallmark of well-designed stabilizer codes.

Before this

Where this leads