Curriculum / Noise & Error Correction / Error Correction Capstone

Lesson 14 of 14ProjectPro+300 XP

Error Correction Capstone

Build a complete error detection and correction pipeline.

Error Correction Capstone

In this capstone you run a complete quantum error correction cycle, end to end: encode a logical qubit across three physical qubits, let a phase flip error strike, diagnose exactly which qubit was hit without ever looking at the data, undo the damage, and prove the logical state survived. This is the full loop that every fault-tolerant quantum computer must execute millions of times per second.

The code you build protects against Z errors (phase flips). That choice is deliberate: on real hardware, dephasing is typically the dominant noise process, the T2 time that limits superconducting qubits is exactly a phase flip rate. The bit flip code from earlier in this track cannot see a Z error at all; this one is built for it.

The 3-Qubit Phase Flip Code

The phase flip code is the bit flip code viewed through Hadamard glasses. The encoding maps

  • logical to
  • logical to

and the circuit is the familiar repetition spread followed by a basis change: cx(0,1), cx(0,2), then H on all three data qubits. The H layer is what re-aims the protection: since HZH = X, a Z error striking the codeword acts exactly like an X error in the rotated frame, and bit flips are what repetition codes catch.

Duality: bit flip and phase flip codes

The phase flip code is exactly the bit flip code conjugated by Hadamards. Applying H to every qubit swaps X and Z errors, so a code correcting one type transforms into a code correcting the other. The two fundamental error types are related by a change of basis, and so are their codes. Shor's 9-qubit code, earlier in this track, nests one inside the other to catch both at once.

Diagnosing Without Looking

Measuring a data qubit directly would collapse the encoded superposition. Instead, the code measures parities: ancilla q3 records whether qubits 0 and 1 agree in the X basis, and ancilla q4 does the same for qubits 1 and 2. Each check is an H sandwich: rotate the pair into the computational basis, copy the parity onto a fresh ancilla with two CNOTs, rotate back. The data qubits are touched only by gates, never by measurement.

This is the opening of the lesson. The full walkthrough, the interactive circuit, and the graded challenge continue inside myqubit.

How this lesson works

A multi-step project that combines several concepts into one larger build, checked checkpoint by checkpoint as you go.

Part of: Noise & Error Correction

Understand quantum noise and build error correction codes to protect quantum information.

This lesson is part of Pro

Unlock Noise & Error Correction and all 10 tracks with Pro: $12.99/month, $79/year, or $97 lifetime. Start with the free track first if you are new.