Interactive Notes ยท Note 08

Quantum Error
Correction

How to protect a qubit from noise without ever measuring it โ€” the surprising solution using entanglement and the stabilizer formalism.

Repetition Code Stabilizer Groups Syndrome Extraction
Section 01

Classical Error Correction

Whenever we send information through a channel โ€” be it fiber optic cable, radio, or the internet โ€” noise can flip bits. Error correction codes add redundancy to detect and fix these errors. Before tackling the quantum case, let's understand the classical approach.

The Channel Model
We send a codeword c through a noisy channel. The receiver gets r = c ⊕ n, where n is the noise vector. Each bit nᵢ = 1 (error) with probability p and nᵢ = 0 (no error) with probability 1−p.
c   โ†’   [Channel]   โ†’   r = c โŠ• n

The Repetition Code โ€” The Simplest Code

The simplest idea: repeat each bit multiple times. To transmit message bit m = 0, send the codeword c = (000). To transmit m = 1, send c = (111).

At the receiver, apply a majority rule: whatever value appears most often among the three received bits is the decoded message.

Received rDecodedCorrect?Probability
0000โœ“(1−p)³
0010โœ“(1−p)²p
0100โœ“(1−p)²p
0111โœ—(1−p)p²
1000โœ“ (1 error corrected!)(1−p)²p
1011โœ—(1−p)p²
1101โœ—(1−p)p²
1111โœ— (3 errors)
Perr with code:
= 3p²(1−p) + p³ ≈ 3p²    (for small p)
Perr without:
= p
Improvement when:
3p² < p  ⇔  p < 1/3   →   The code always helps if p < 1/2!
Code Notation [n, k, d]
A code that encodes k information bits into n physical bits and can correct up to t = ⌊(d−1)/2⌋ errors is denoted [n, k, d]. The repetition code is a [3, 1, 3] code: n=3 bits, k=1 info bit, minimum distance d=3 (corrects t=1 error).
Rate   Rc = k/n    (repetition code: Rc = 1/3)
  Low rate is the cost of protection — 3 physical bits for 1 logical bit
Classical repetition code โ€” error probability comparison. Drag slider to change channel error rate p.
0.10
Ex 1.1Error probability with the repetition code

The channel error probability is p = 0.1. What is the decoding error probability with the [3,1,3] repetition code? (Use Perr = 3p²(1−p) + p³.)

Perr
Ex 1.2When does the code help?

For what values of p does the repetition code actually reduce error probability? (Compare 3pยฒ < p.)

p <
Section 02

Three Challenges for Quantum Error Correction

Naively, we might try to apply classical error correction to qubits. But there are three fundamental obstacles that make this impossible without new ideas.

The challenge: quantum information is fragile in ways that classical information is not. Three quantum-specific obstacles must be overcome.

Challenge 1 โ€” A Continuum of Errors

Classical channel
0 → 0 with prob. 1−p
0 → 1 with prob. p
(only 1 type of error: bit-flip)
Quantum channel
|ฯˆโŸฉ = ฮฑ|0โŸฉ + ฮฒ|1โŸฉ โ†’ |ฯˆฬƒโŸฉ = ฮฑ|0โŸฉ + ฮฒeiฮ”|1โŸฉ
(continuous parameter ฮ” โ€” infinitely many errors)
Surprisingly, this is NOT a real obstacle. Quantum error correction works by discretizing errors. When we perform syndrome measurement (Section 5), the continuous error collapses into one of a discrete set of Pauli errors (I, X, Y, Z). We only need to correct those!

Challenge 2 โ€” No-Cloning Theorem

Classical (easy)
b โ†’ bbb    (copy a bit 3 times)
[3,1] repetition code โœ“
Quantum (impossible)
|ฯˆโŸฉ โ†’ |ฯˆโŸฉ|ฯˆโŸฉ|ฯˆโŸฉ    FORBIDDEN!
No-Cloning Theorem โœ—
No-Cloning Theorem: There is no unitary operation U such that U|ฯˆโŸฉ|0โŸฉ = |ฯˆโŸฉ|ฯˆโŸฉ for all states |ฯˆโŸฉ. It is fundamentally impossible to copy an unknown quantum state. So the classical "just repeat it" strategy cannot be directly applied.
The quantum solution: instead of copying, we use entanglement. The quantum repetition code does not clone |ฯˆโŸฉ โ€” it creates a specific entangled 3-qubit state that encodes the same information in a distributed way.

Challenge 3 โ€” Measurement Collapses the State

Classical decoder
Reads r = c โŠ• n directly โ†’ decides which error occurred
Quantum decoder
If we measure |ฯˆฬƒโŸฉ โ†’ state collapses! We lose ฮฑ and ฮฒ forever.
The quantum solution: We never measure the data qubits directly. Instead, we perform syndrome measurement using ancilla qubits. This extracts information about the error without revealing anything about the actual data (ฮฑ and ฮฒ).
Ex 2.1Why can't we copy a qubit?

Suppose we could clone: U|ฯˆโŸฉ|0โŸฉ = |ฯˆโŸฉ|ฯˆโŸฉ. Apply U to |+โŸฉ|0โŸฉ and expand using superposition. Does the result equal |+โŸฉ|+โŸฉ? (Hint: expand |+โŸฉ = (|0โŸฉ+|1โŸฉ)/โˆš2 and see what linearity gives.)

Section 03

The Quantum Repetition Code

We want to protect the qubit |ฯ†โŸฉ = ฮฑ|0โŸฉ + ฮฒ|1โŸฉ. We cannot copy it, but we can encode it into an entangled 3-qubit state.

Encoding

Use two CNOT gates (with |ฯ†โŸฉ as control) to create the codeword:

|ฯ†โŸฉ
โ”€โ”€โ”€โ”€โ”€
|0โŸฉ
โŠ•
โ”€โ”€โ”€โ”€โ”€
|0โŸฉ
โŠ•
โ”€โ”€โ”€โ”€โ”€
Input:
|ฯ†โŸฉ|0โŸฉ|0โŸฉ = (ฮฑ|0โŸฉ + ฮฒ|1โŸฉ)|0โŸฉ|0โŸฉ
After CNOTโ‚:
ฮฑ|000โŸฉ + ฮฒ|110โŸฉ
After CNOTโ‚‚:
|ฮจโŸฉ = ฮฑ|000โŸฉ + ฮฒ|111โŸฉ    (encoded codeword)

Note:
|ฮจโŸฉ ≠ |ฯ†โŸฉ|ฯ†โŸฉ|ฯ†โŸฉ โ€” this is NOT copying! It is an entangled state that encodes ฮฑ and ฮฒ in a distributed way.

Effect of Errors

Suppose the channel applies a Pauli X gate (bit-flip) to one of the qubits. The state becomes:

ErrorState after errorAncilla result I (none)ฮฑ|000โŸฉ + ฮฒ|111โŸฉ|00โŸฉ   syndrome (0,0) Xโ‚€ฮฑ|100โŸฉ + ฮฒ|011โŸฉ|11โŸฉ   syndrome (1,1) Xโ‚ฮฑ|010โŸฉ + ฮฒ|101โŸฉ|11โŸฉ โ†’ Xโ‚ Xโ‚‚ฮฑ|001โŸฉ + ฮฒ|110โŸฉ|10โŸฉ   syndrome (1,0)

Decoding โ€” Without Measuring Data!

Instead of measuring |ฮจโŸฉ directly, we introduce two ancilla qubits and measure them. This gives us the syndrome โ€” information about which error occurred โ€” without revealing ฮฑ or ฮฒ.

data
Q. Ch.
โ†’ |ฮจฬƒโŸฉ
|0โŸฉ (anc)
โŠ•
โŠ•
M
sโ‚
|0โŸฉ (anc)
โŠ•
โŠ•
M
sโ‚‚
Key insight: measuring the ancilla qubits gives information about the error (which qubit was flipped) but reveals nothing about ฮฑ and ฮฒ. The data qubit |ฮจฬƒโŸฉ is unchanged by this measurement!
Quantum repetition code โ€” select an error to see the syndrome and correction.
Error:
Ex 3.1Codeword verification

The encoded state is |ฮจโŸฉ = ฮฑ|000โŸฉ + ฮฒ|111โŸฉ. Apply Zโ‚€Zโ‚ (Pauli Z on qubits 0 and 1) to |ฮจโŸฉ. What do you get?

Ex 3.2Syndrome after error Xโ‚

After an Xโ‚ error, the state becomes ฮฑ|010โŸฉ + ฮฒ|101โŸฉ. What is the measurement outcome (sโ‚, sโ‚‚) of the ancilla circuit above? The ancilla measures Zโ‚Zโ‚€ and Zโ‚‚Zโ‚.

sโ‚ = sโ‚‚ =
Section 04

Stabilizer Formalism

The stabilizer formalism provides a powerful, systematic language for quantum error correcting codes. It answers the question: what operators leave the codewords unchanged?

Group Theory Reminder

Group (G, ยท)
A set G with a binary operation "ยท" satisfying:
Closure
gโ‚ ยท gโ‚‚ ∈ G   for all gโ‚, gโ‚‚ ∈ G
Associativity
(gโ‚ ยท gโ‚‚) ยท gโ‚ƒ = gโ‚ ยท (gโ‚‚ ยท gโ‚ƒ)
Identity
∃ e ∈ G such that e ยท g = g ยท e = g   for all g
Inverse
For each g ∈ G, ∃ gโปยน ∈ G such that g ยท gโปยน = e
If also gโ‚ ยท gโ‚‚ = gโ‚‚ ยท gโ‚ for all gโ‚, gโ‚‚, the group is abelian.

The Pauli Group ๐’ขโ‚™

The Pauli group on n qubits consists of all tensor products of Pauli matrices {I, X, Y, Z} across n qubits, with overall phases ±1 or ±i.

๐’ขโ‚ (1 qubit):
{±I, ±iI, ±X, ±iX, ±Y, ±iY, ±Z, ±iZ}
๐’ขโ‚‚ (2 qubits):
{±Iโ‚Iโ‚€, ±iIโ‚Iโ‚€, ±Iโ‚Xโ‚€, ..., ±iYโ‚Zโ‚€, ...}
NOT abelian:
XZ = iY ≠ ZX = −iY. The Pauli matrices do not always commute!
Commutation rule for Paulis: Two Pauli operators either commute (AB = BA) or anticommute (AB = −BA). On a single qubit: X and Z anticommute (XZ = −ZX), while X and X commute. On multiple qubits, two Pauli strings commute iff they anticommute on an even number of qubit positions.

The Stabilizer Set S(C)

Stabilizer Set
Given a quantum error correcting code C (a set of quantum states called codewords), the stabilizer set is:
S(C) = { M ∈ ๐’ขโ‚™ : M|ฯˆโŸฉ = |ฯˆโŸฉ   for all |ฯˆโŸฉ ∈ C }
S(C) is the set of all Pauli operators that leave every codeword unchanged.
S(C) is an Abelian Group
Proof:
Closure
Sโ‚, Sโ‚‚ ∈ S(C) โ†’ Sโ‚Sโ‚‚|ฯˆโŸฉ = Sโ‚|ฯˆโŸฉ = |ฯˆโŸฉ โ†’ Sโ‚Sโ‚‚ ∈ S(C) โœ“
Identity
I|ฯˆโŸฉ = |ฯˆโŸฉ โ†’ I ∈ S(C) โœ“
Inverse
S ∈ S(C) โ†’ Sโปยน|ฯˆโŸฉ = Sโปยน(S|ฯˆโŸฉ) = e|ฯˆโŸฉ = |ฯˆโŸฉ โ†’ Sโปยน ∈ S(C) โœ“
Abelian
Sโ‚Sโ‚‚|ฯˆโŸฉ = Sโ‚|ฯˆโŸฉ = |ฯˆโŸฉ and Sโ‚‚Sโ‚|ฯˆโŸฉ = Sโ‚‚|ฯˆโŸฉ = |ฯˆโŸฉ โ†’ same result โ†’ Sโ‚Sโ‚‚ = Sโ‚‚Sโ‚ โœ“

Generator Set G

Generator Set
Instead of listing all elements of S(C), we can specify a small set of generators G = {gโ‚, gโ‚‚, ..., gโ‚˜} such that every element of S(C) can be written as a product of generators:
S(C) = { gโ‚ฮฑโ‚ gโ‚‚ฮฑโ‚‚ ... gโ‚˜ฮฑโ‚˜ | ฮฑแตข ∈ {0,1} }
If |G| = M generators โ†’ |S(C)| = 2M stabilizers (much more compact!).

Example: Quantum Repetition Code

The code C = {ฮฑ|000โŸฉ + ฮฒ|111โŸฉ} has the following stabilizer set and generators:

S(C) =
{I, Zโ‚Zโ‚€, Zโ‚‚Zโ‚€, Zโ‚‚Zโ‚}   (4 elements = 2ยฒ โ†’ need 2 generators)
Generators:
G = {gโ‚, gโ‚‚} = {Zโ‚Zโ‚€, Zโ‚‚Zโ‚}
Verify gโ‚:
Zโ‚Zโ‚€(ฮฑ|000โŸฉ+ฮฒ|111โŸฉ) = ฮฑ(+1)(+1)|000โŸฉ + ฮฒ(−1)(−1)|111โŸฉ = ฮฑ|000โŸฉ+ฮฒ|111โŸฉ โœ“

Matrix form:
The generator matrix G (rows = generators, columns = qubits):

IZZ
ZZI
  rows: gโ‚, gโ‚‚   columns: qโ‚‚, qโ‚, qโ‚€
Explore which Pauli operators stabilize the encoded state ฮฑ|000โŸฉ + ฮฒ|111โŸฉ.
Test operator:
Ex 4.1Is Xโ‚€Xโ‚Xโ‚‚ a stabilizer?

Apply Xโ‚€Xโ‚Xโ‚‚ to the codeword |ฮจโŸฉ = ฮฑ|000โŸฉ + ฮฒ|111โŸฉ. Does it stabilize |ฮจโŸฉ? (Recall X|0โŸฉ = |1โŸฉ and X|1โŸฉ = |0โŸฉ.)

Section 05

Syndrome Extraction

The generators of the stabilizer code tell us exactly what to measure. The key insight: measuring a generator either confirms the state is in the code space (eigenvalue +1) or reveals that an error occurred (eigenvalue −1), without disturbing the quantum information.

Commuting vs Anticommuting with Errors

Suppose the channel introduces a Pauli error E on the codeword |ฯˆโŸฉ ∈ C. The corrupted state is |ฯˆฬƒโŸฉ = E|ฯˆโŸฉ. Now we apply a generator gแตข:

If gแตขE = Egแตข (commute):
gแตขE|ฯˆโŸฉ = Egแตข|ฯˆโŸฉ = E|ฯˆโŸฉ = |ฯˆฬƒโŸฉ โ†’ eigenvalue +1 โ†’ syndrome bit sแตข = 0
If gแตขE = −Egแตข (anticommute):
gแตขE|ฯˆโŸฉ = −Egแตข|ฯˆโŸฉ = −E|ฯˆโŸฉ = −|ฯˆฬƒโŸฉ โ†’ eigenvalue −1 โ†’ syndrome bit sแตข = 1
Different errors give different syndromes. This is how we identify which error occurred: by checking which generators anticommute with it. The syndrome S = (sโ‚, sโ‚‚, ..., sโ‚˜) uniquely identifies the error (for a good code).

The Ancilla Circuit for Syndrome Measurement

We cannot just apply gแตข and read the eigenvalue โ€” that would collapse |ฯˆฬƒโŸฉ. Instead, we use an ancilla qubit and controlled-gแตข to extract the eigenvalue into the ancilla:

|ฯˆฬƒโŸฉ
gแตข
|ฯˆฬƒโŸฉ (unchanged)
|0โŸฉ
H
H
M
sแตข ∈ {0,1}

Let's trace the ancilla through this circuit step by step:

|ฯˆโ‚€โŸฉ =
|0โŸฉ โŠ— |ฯˆฬƒโŸฉ
After H on ancilla:
|ฯˆโ‚โŸฉ = |+โŸฉ โŠ— |ฯˆฬƒโŸฉ = (|0โŸฉ + |1โŸฉ)/โˆš2 โŠ— |ฯˆฬƒโŸฉ
After controlled-gแตข:
|ฯˆโ‚‚โŸฉ = (|0โŸฉ|ฯˆฬƒโŸฉ + |1โŸฉgแตข|ฯˆฬƒโŸฉ)/โˆš2 = (|0โŸฉ|ฯˆฬƒโŸฉ ± |1โŸฉ|ฯˆฬƒโŸฉ)/โˆš2 = |±โŸฉ โŠ— |ฯˆฬƒโŸฉ
After H on ancilla:
|ฯˆโ‚ƒโŸฉ = |"0" or "1"โŸฉ โŠ— |ฯˆฬƒโŸฉ    (ancilla tells us eigenvalue of gแตข)
Measure ancilla:
Get sแตข = 0 if gแตขE commutes (no error signature for gแตข)   or   sแตข = 1 if anticommutes (error detected!)

Key fact:
|ฯˆฬƒโŸฉ is UNCHANGED throughout this process. The data qubit is unperturbed.

Full Syndrome Table for the Repetition Code

Error ESyndrome (sโ‚‚,sโ‚)Correction I(0, 0)None needed โœ“ Xโ‚€(0, 1)Apply Xโ‚€ Xโ‚(1, 1)Apply Xโ‚ Xโ‚‚(1, 0)Apply Xโ‚‚ Zโ‚€ = Zโ‚ = Zโ‚‚(0, 0)Ambiguous with I โ€” cannot correct Z errors! (need Shor/surface code)
Limitation: The quantum repetition code can only correct X (bit-flip) errors, not Z (phase-flip) errors. Z errors produce syndrome (0,0) โ€” indistinguishable from no error! A full code like the Shor [[9,1,3]] code combines bit-flip and phase-flip repetition codes to handle both.
Syndrome Extraction Map SE
The full syndrome extraction circuit performs the mapping:
SE(|0โŸฉ โŠ— E|ฯˆโŸฉ) = |SEโŸฉ โŠ— E|ฯˆโŸฉ
  The ancilla contains the syndrome โ€” the data is unchanged
Example: SE(|00โŸฉ โŠ— Xโ‚€|ฯˆโŸฉ) = |01โŸฉ โŠ— Xโ‚€|ฯˆโŸฉ   (syndrome 01, apply Xโ‚€ to correct)
Syndrome extraction โ€” trace the ancilla state for each possible error.
Error applied:
Ex 5.1Syndrome computation

Using generators gโ‚ = Zโ‚Zโ‚€ and gโ‚‚ = Zโ‚‚Zโ‚, compute the syndrome (sโ‚‚, sโ‚) for error E = Xโ‚€ (bit-flip on qubit 0). Does Xโ‚€ commute or anticommute with each generator?

sโ‚ = sโ‚‚ =
Ex 5.2Why measuring ancillas doesn't disturb data?

After the syndrome circuit, the state is |S_EโŸฉ โŠ— E|ฯˆโŸฉ (product state). When we measure the ancilla and get syndrome s, what happens to the data part E|ฯˆโŸฉ?