Skip to main content
Sandbox Physics

Q045 · Detect / decode / repair

Quantum Error Correction

Encode one qubit, introduce an error, and read an auxiliary qubit. Use its syndrome to choose a repair. Compare a three-qubit repetition code with the complete five-qubit code, then check the recovered state.

Interactive modelQuantum Error Correction
Recorded trials00
From the current records—\text{—}
ONE MESSAGE · SEVERAL DATA QUBITS

Only the auxiliary qubit is read here

Ideal circuit protocol. The lines are registers, not atom trajectories. One auxiliary qubit is reset and reused for each check.

  1. Encode + noise
  2. Read checks
  3. Decode
  4. Correct
  5. Verify

Ready. No recorded evidence yet.

02 / WHAT THE RECORDS SAY

A quiet check can still miss an error.

Ideal target-state verification, with pointwise 95% Wilson intervals. The unencoded comparator is an independent qubit exposed to the same memory channel and forced error.

—\text{—}

—\text{—}

03 / THE DECODER ONLY SEES THE CHECKS

Same syndrome. Same suggested repair.

Multiple errors can imitate one correctable error. A flipped syndrome can trigger the wrong repair. The final target projection consumes the encoded state and is kept separate from the syndrome measurement.

04 / KEEP THE EVIDENCE

Compare complete recorded samples.

Most recent twelve trials shown. Export keeps every zero and every failed outcome. Save up to six samples, then restore their settings and records.

Code, fault model & scientific sources

Generators are measured through a fresh auxiliary qubit: Hadamard, controlled Pauli factors, Hadamard, readout. After each controlled gate the touched data qubit may receive a uniform Pauli fault. Ancilla propagation faults, leakage, correlated noise, encoding faults and verification faults are omitted. Memory noise acts independently on each data qubit before extraction. Correction gates are ideal.

—\text{—}

The repetition code protects bit flips only. The five-qubit code corrects arbitrary single-qubit errors with perfect extraction. Stochastic rates describe one declared noise model, not a hardware error budget or fault-tolerance threshold. Resource counts cover extraction only, not encoding or verification synthesis.

IBM · Stabilizer codes · Laflamme et al. · Perfect quantum code

Physics tutorial

Quantum Error Correction

BackgroundEncode one qubit, introduce an error, and read an auxiliary qubit. Use its syndrome to choose a repair. Compare a three-qubit repetition code with the complete five-qubit code, then check the recovered state.

Why it mattersMake a prediction from the information you can actually observe, then perform a separate check.

Start with the essentials

Focus question
Find the error without reading the message.
One-sentence intuition
A stabilizer check learns an error syndrome while preserving the logical superposition. A final target measurement asks a different, destructive question.

Core mathematical model

Preserve the message

∣ψL⟩=α∣0L⟩+β∣1L⟩,Sj∣ψL⟩=∣ψL⟩|\psi_L\rangle=\alpha|0_L\rangle+\beta|1_L\rangle,\qquad S_j|\psi_L\rangle=|\psi_L\rangle

Encoding distributes a superposition over the code space; it does not clone the input into independent copies.

Auxiliary check

Mb=I+(−1)bSj2M_b=\frac{I+(-1)^b S_j}{2}

An auxiliary Hadamard, controlled stabilizer and final Hadamard implement these projectors. The displayed syndrome is the classical readout, including selected readout flips.

Repetition code limit

Pfail=3p2(1−p)+p3P_{\rm fail}=3p^2(1-p)+p^3

For an encoded zero state, independent bit-flip memory errors and perfect extraction, failure requires two or three flips. This does not protect phase errors or establish a fault-tolerant threshold.

Final known-state verification

Ppass=∣⟨ψL∣ψrecovered⟩∣2P_{\rm pass}=|\langle\psi_L|\psi_{\rm recovered}\rangle|^2

This ideal target projection is sampled into pass/fail records. It is not a syndrome measurement or a universal logical error metric.

Common difficulties

What was measured?

Typical misconceptionThe syndrome is the logical message.

Better mental modelOnly auxiliary check bits feed the decoder. The final known-target projection is a separate destructive test.

Scope of evidence

Typical misconceptionA successful simulated run certifies a device.

Better mental modelExact small-register simulation; one reused auxiliary qubit. Memory Pauli faults, data-only faults after controlled gates, and classical syndrome flips are separate. Encoding and final verification are ideal. One extraction round is not fault tolerant and does not establish a threshold.

Run the experiment

  1. 01

    Choose a contrast

    Repair a bit flip with the repetition code, then keep the code and switch to a phase-sensitive input with a phase error.

    What to observe: The phase error may leave every check quiet while failing final verification.
  2. 02

    Complete the protocol

    Repeat the phase-error experiment with the five-qubit code. Follow extraction, decoding, correction and final verification separately.

    What to observe: The auxiliary syndrome determines a repair without reading the logical amplitudes.
  3. 03

    Stress the assumption

    Remove the forced error and raise gate or readout errors. Compare encoded and unencoded survival with the extraction resource counts.

    What to observe: Noisy correction can hurt. One round of these unprotected checks is not fault tolerant.