- Error Correction
- Also: nine-qubit code
- Also: Shor's 9-qubit code
Shor Code
The Shor code is the first quantum error-correcting code, encoding one logical qubit in nine physical qubits to protect against arbitrary single-qubit errors including both bit flips and phase flips.
The Shor code, published by Peter Shor in 1995, was the first quantum error-correcting code. It proves that quantum information can be protected against decoherence, resolving a fundamental question about whether fault-tolerant quantum computing is even possible.
Encoding
The Shor code encodes one logical qubit into nine physical qubits. The encoding works in two stages:
Phase correction (outer code). The logical state is encoded into three blocks of three qubits each, using a repetition code in the X basis:
|0⟩_L → |+⟩|+⟩|+⟩ (each |+⟩ = (|000⟩ + |111⟩)/√2)
|1⟩_L → |-⟩|-⟩|-⟩ (each |-⟩ = (|000⟩ - |111⟩)/√2)
Bit-flip correction (inner code). Within each block of three qubits, the state is further encoded using a bit-flip repetition code:
|0⟩ → |000⟩
|1⟩ → |111⟩
The combination of the two repetition codes corrects any single-qubit error, including:
- Bit flips (X errors)
- Phase flips (Z errors)
- Combined Y errors
- Any single-qubit unitary error (by linearity)
Error Correction
The Shor code uses six stabilizer measurements (four-qubit parity checks) to identify which qubit suffered an error without measuring the encoded logical state:
- Bit-flip syndromes: compare adjacent qubits within each group of three
- Phase-flip syndromes: compare the phases between the three blocks
After measuring the six syndrome bits, the correction circuit applies X and/or Z gates to restore the logical qubit.
Why the Surface Code Replaced It
The Shor code uses 9 physical qubits per logical qubit and requires long-range gates between non-neighbouring qubits. The surface code achieves comparable error correction with:
- Only nearest-neighbor interactions (crucial for physical hardware)
- Higher error thresholds (~1% vs ~0.1% for Shor)
- Better efficiency at large code distances
The Shor code remains historically important and conceptually illuminating, but is not used in modern fault-tolerant architectures.