3-Qubit Repetition Code — Fault-Tolerant Quantum Sensing
The pedagogically ideal on-ramp to fault-tolerant quantum computing — reproduced end-to-end with 97× logical-error reduction and exact threshold recovery.

Log-log logical error rate vs physical bit-flip error rate. Encoded (purple) sits at 3p² for small p, unencoded (amber) sits at p. Crossover at p = 1/2 reproduced to 0.3% deviation (0.501 measured vs 0.500 analytical). Below threshold: 97× reduction in logical error at p = 0.005. Above threshold: encoded is worse than unencoded — the second pedagogical insight of QEC that redundancy amplifies noise when physical error is too high.
[ overview ]
What this reproduces & why it matters
Every serious DoD quantum program has a quantum-error-correction (QEC) component: DARPA US2QC (Utility-Scale Quantum Computing), IARPA ELQ (Entangled Logical Qubits), AFRL Rome Lab, DOE Quantum Science Center at ORNL, and the Naval Postgraduate School's quantum research program. Fault-tolerant quantum computing is the infrastructure that makes hour-to-day quantum computation practical — the gate between microsecond NISQ demonstrations and real DoD-scale quantum algorithms.
The 3-qubit repetition code is the pedagogically ideal entry point: the smallest quantum code that demonstrates the central QEC virtue (logical error rate < physical error rate below threshold, and logical error rate > physical error rate above threshold), while admitting a full analytical closed-form solution p_L(p) = 3p²(1−p) + p³ that enables direct cross-check against measured behavior. This showcase reproduces the encoder, syndrome extraction, and classical majority-vote decoder end-to-end, then sweeps 16 physical error rates from p = 0.005 to p = 0.9 to characterize the full threshold behavior.
Directly adjacent to fault-tolerant quantum sensing (adversary-resistant spectrum sensors, quantum magnetometers) — the natural Navy application where fault-tolerance requirements meet operational sensor reliability floors.
[ verified results ]
Every number below is [PASS]-checked in source.
| Logical-error reduction at p = 0.005 measured encoded 5.0e-5 vs unencoded 4.85e-3 | 97× |
| Threshold measured vs analytical 0.3% deviation from exact threshold at p = 1/2 | p = 0.501 vs 0.500 |
| Analytical p_L formula match every measured p_L within Monte Carlo precision of 3p²(1−p) + p³ | 16/16 points |
| Above-threshold behavior encoded worse than unencoded at p > 0.5 — the second pedagogical insight of QEC | reproduced |
| Syndrome distribution vs (1−p)³ direct noise-model cross-check against theory | < 1% deviation |
| Full-sweep wall-clock local Aer simulation, no hardware needed for baseline | ~90 s |
[ method ]
How it's built
Logical states |0⟩_L = |000⟩ and |1⟩_L = |111⟩. Encoder: two CNOT gates from data qubit to two ancillas. Syndrome extraction via two additional ancilla qubits measuring Z₀Z₁ and Z₁Z₂ parities through four CNOT gates. Classical majority-vote decoder applies X-correction based on the 2-bit syndrome lookup table.
Noise model: uniform per-qubit bit-flip channel at rate p applied during a wait tick between encoding and syndrome extraction, implemented via Aer's pauli_error on identity gates. Monte Carlo sweep across 16 physical error rates p ∈ [0.005, 0.9], 40,000 shots per point for both encoded and unencoded conditions.
[ figures ]
Physics visuals

[ mitigation ]
What Qubital's ZNE buys you here
[ references ]
Papers & sources
- Wootton, J. R. & Loss, D. (2018). "Repetition code of 15 qubits." Phys. Rev. A 97, 052313.arXivThe reproduction target
- Nielsen, M. A. & Chuang, I. L. (2010). Quantum Computation and Quantum Information, Ch. 10.1 — the canonical textbook introduction to the 3-qubit bit-flip code.
- Devitt, S. J., Munro, W. J., Nemoto, K. (2013). "Quantum error correction for beginners." Rep. Prog. Phys. 76, 076001.
- Chen, Z. et al. (Google Quantum AI, 2023). "Suppressing quantum errors by scaling a surface code logical qubit." Nature 614, 676 — the first below-threshold demonstration on real hardware.
[ what's next ]
Roadmap for this showcase
- Distance-3 rotated surface code (17 qubits, one logical) on IBM Heron with ZNE mitigation
- Extend to phase-flip code and Shor 9-qubit code for full arbitrary-single-error protection
- Real-hardware run of the current 3-qubit code on IBM Heron to characterize NISQ-scale threshold behavior against simulator baseline
- Direct partner engagement: DOE QSC (ORNL) surface-code effort, IARPA ELQ, DARPA US2QC
[ request access ]
Want to run this yourself?
The physics-showcases repo is currently private, protecting IP pre-revenue. Physicists, quantum-industry contacts, and investors: reach out and I'll set up a technical walkthrough, call, or Loom.
Request a walkthrough