English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

One Life Shared by Three: The Three-Qubit and Nine-Qubit Codes

Forum topic · 小凯 · 2026-11-07

Summary

This tutorial post from a Chinese quantum computing column (episode 053, 'From Coins to Error Correction') explains the first practical quantum error-correcting codes. It introduces the three-qubit repetition code, which encodes one logical qubit as |000⟩ or |111⟩ via two CNOT gates. Two ancilla 'sentinel' qubits measure pairwise synchrony, producing a syndrome table that pinpoints which physical qubit suffered a bit-flip (X error) without ever measuring the encoded amplitudes a and b. The post then exposes the code's fatal blind spot: phase-flip (Z) errors are invisible to parity checks and even get promoted to logical errors. The fix exploits the fact that a Z error becomes an X error in the Hadamard-rotated basis: nesting a second three-qubit code in the ± basis yields Shor's nine-qubit code (1995), the first code correcting any single-qubit error—X, Z, or Y. Finally, it counts the overhead: while 3 or 9 physical qubits suffice for single errors, continuous noise and faulty sentinels push real-world costs to hundreds or thousands of physical qubits per logical qubit. The article closes by teasing stabilizer formalism as the next topic, and dissects where the three-legged-race analogy breaks down due to entanglement and discrete error archiving.

One Life Shared by Three: The Three-Qubit and Nine-Qubit Codes

> Prerequisites: Episode 052 (three dark corridors), 051 (the error trio), 022 (CNOT), 017 (basis change). > Next episode: 054, "Guarding Quantum States with Measurement: Stabilizers and Syndromes."

Ever watched a three-legged race? Three people run side by side with adjacent legs tied together. When one stumbles, the formation instantly breaks—the other two immediately sense "who stumbled and which way they lean" and pull them upright. Three people share one life: a single fall is no longer fatal, because the formation itself raises the alarm.

The previous episode fixed three dark corridors: information spread into entanglement, measurement asks only about errors, errors are forced into discrete archives. This episode combines them into the first real artifacts: the three-qubit code—one life shared by three qubits, warned by "formation"; then it confronts the code's fatal blind spot (it cannot handle phase errors at all) and patches it via "re-encode in a new basis" into the nine-qubit code—the first full quantum error-correcting code, introduced in 1995 (names omitted per column convention; see the roster later).

The Three-Qubit Code: Spreading |0⟩ into |000⟩

Encoding needs only two CNOTs (the 022 pipeline, a physical realization of corridor one from 052):

  • |0⟩ → |000⟩, |1⟩ → |111⟩;
  • a general state (a|0⟩+b|1⟩) → (a|000⟩+b|111⟩)/√2—the information lives in the "three-qubit move-together" formation.
  • The formation rule is just one line: all three must agree. That is the entire code.

    Diagnosis and Repair: Two "Synchrony" Measurements

    Dispatch two ancilla qubits as sentinels (corridor two from 052: ask only about errors, never about content):

  • Sentinel 1 checks "whether qubits 1 and 2 are in sync";
  • Sentinel 2 checks "whether qubits 2 and 3 are in sync."
  • The two sentinels' answers (jargon: the syndrome) pinpoint the lesion exactly:

    | Sentinels (1,2) | Meaning | Faulty qubit | Repair action | | :---: | :--- | :---: | :---: | | 0, 0 | All in sync | None | Do nothing | | 1, 0 | 1 and 2 out of sync | Qubit 1 | Flip qubit 1 | | 1, 1 | Both pairs out of sync | Qubit 2 | Flip qubit 2 | | 0, 1 | 2 and 3 out of sync | Qubit 3 | Flip qubit 3 |

    The logic is plain: the "break point" in the formation marks the faller—a three-legged team that stumbles once only breaks the formation in one place. Apply one targeted X gate (the rescue mission from 020's toolkit) to restore the formation. Not a single measurement touches a and b—the information survives intact; collapse only lands on the sentinels.

    The Fatal Blind Spot: Z Errors Walk Right In

    The three-qubit code is perfect against X errors (bit flips). But—051's enemy list also includes the Z error (phase flip).

    Run an experiment: apply a Z to one qubit of the formation (a|000⟩+b|111⟩)/√2. Expand the algebra and you'll find the result is exactly a global phase inversion of the logical state—what (a|0⟩−b|1⟩) looks like when spread out. The code not only fails to detect the Z error—it promotes it into an error of the logical information. The sentinels (measuring qubit agreement) are completely blind to phase. The three-qubit code has single-leg defense: it guards only one member of the trio.

    The Patch: In a Different Basis, a Phase Error Is a Bit Error

    How to defend against Z? The answer hides in the column's earliest technique—017's basis change:

    In the "left-right basis" (|±⟩), a Z error is an X error. (017's table: Z swaps |+⟩ and |−⟩—a flip!) So the strategy writes itself: first switch to the ± basis, then apply the three-qubit code again. Two nested defense lines: the outer layer handles "bit errors," the inner layer handles "phase errors" in the ± basis—3×3 = nine qubits in total.

    Expanded form (no need to memorize; just see the structure):

    (|000⟩+|111⟩) with each qubit spread again into combinations of (|0⟩+|1⟩) and (|0⟩−|1⟩)—a nine-qubit state, three outer groups of three qubits each, with separate sentinel systems for bit errors and phase errors. The mathematical conclusion is crisp: the nine-qubit code can locate and repair any single-qubit error—X, Z, Y (=XZ), and any small drift after discretization into the trio (episode 051), without exception.

    Its debut in 1995 meant one thing: quantum error correction went from "forbidden in principle" to "recipe available in engineering"—the three corridors combined, and the empire had its first city.

    The City's Bill: Overhead Surfaces

    Don't celebrate yet—do the accounting. Protecting one logical qubit costs 3 physical qubits (three-qubit code) or 9 (nine-qubit code); this is the bare bill for single errors only: real machines suffer errors continuously (051: noise works every microsecond), sentinels must patrol repeatedly, repairs run nonstop, and sentinels themselves err (who guards the guards?)—layer upon layer, the real bill is hundreds to thousands of physical qubits per logical qubit (episode 058 does the math). The nine-qubit code answers "can it be done"; episode 058 answers "is it worth it."

    Tearing Down the Analogy

    Where the three-legged-race analogy works and where it doesn't:

  • Disanalogy one: the three racers each have their own body and mind; each encoded qubit individually carries no information (052)—the "formation" isn't a convention among three people but the mathematical structure of entanglement.
  • Disanalogy two: in the race, a referee does the straightening; quantum repair is an automatic process of sentinel measurement + targeted gates, acting on discretely archived errors (052, corridor three)—a continuous stumble is either ignored or repaired to the nearest discrete level.

What to Take Away

1. The three-qubit code: |0⟩→|000⟩, |1⟩→|111⟩; formation = three qubits moving together; two sentinels measure synchrony, the syndrome pinpoints the lesion, a targeted X repairs it—information never touched. 2. Blind spot and patch: Z errors are invisible to agreement-measuring sentinels and get promoted to logical errors; in the changed basis, Z = X (017's technique)—outer layer against bit errors, inner layer (± basis) against phase errors, 3×3 = the nine-qubit code, fixing any single-qubit error. 3. Bill awareness: 3–9 physical qubits is the bare bill for single errors; continuous noise plus faulty sentinels push the true overhead to hundreds or thousands—"can it be done" is answered; "is it worth it" awaits episode 058.

Hook for the next stop: this episode's sentinel system ("are 1 and 2 in sync?") is clumsy to write down—as codes grow, we need an "algebraic language for sentinels." It has a name: stabilizers. Learn it, and the famous checkerboard of the surface code (055) becomes readable. Episode 054: "Guarding Quantum States with Measurement: Stabilizers and Syndromes."

*(Original post tags: quantum computing, from coins to error correction, quantum error-correcting codes, nine-qubit code.)*

Tags

#quantum-computing#quantum-error-correction#three-qubit-code#nine-qubit-code#syndrome-measurement#stabilizer-codes#tutorials

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/178636887