∑ | Quantum Computing
Chapter 18 / 20

Quantum error correction

Encode logical information into a larger physical system.

1. Core idea

The three-qubit repetition code protects against a single bit flip, not arbitrary quantum noise. Parity checks locate an error syndrome without directly measuring the logical amplitude. More complete quantum codes must address both X and Z errors and require fault-tolerant procedures.

2. Mathematical foundation

The notation describes a precise relationship among states, transformations or probabilities. Identify each symbol, check the dimensions of the objects, and distinguish amplitudes from the probabilities produced by a measurement.

3. Worked example

Encode α|0⟩+β|1⟩ as α|000⟩+β|111⟩. A flip on the middle qubit changes neighboring parity checks, identifying which correction to apply.

4. Reasoning flow

  1. Define the initial register and its basis states.
  2. Apply the transformations in their intended order.
  3. Track amplitude magnitudes and relative phases.
  4. Measure in the basis that reveals the desired property.
  5. Interpret the result and check the resource assumptions.

Qiskit implementation

Run this standalone Python script with Qiskit installed. It uses exact statevector simulation rather than noisy hardware shots.

from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
qc = QuantumCircuit(3)
qc.h(0)                 # illustrative unknown logical superposition
qc.cx(0, 1); qc.cx(0, 2)  # encode alpha|000>+beta|111>
qc.x(1)                 # inject bit-flip error on middle qubit
print(qc.draw())
print(Statevector.from_instruction(qc).probabilities_dict())
# Error syndrome would be extracted with ancillas in a full QEC circuit.
Download runnable Python

5. Check your understanding

Practice question

Explain why directly measuring all three data qubits destroys an unknown logical superposition.

6. What to watch out for

Ideal-state calculations assume perfect gates and measurements. When assessing an algorithm, separate its mathematical guarantee from the cost of building oracles, preparing inputs, repeating experiments and correcting physical noise.

◈ QubitSemantics Hub