Bit-flip repetition code Created 2026-09-28 Updated 2026-10-14
The -qubit bit-flip repetition code stores one logical qubit in and . Its stabilizer generators are for , and its logical operators are and . Interchanging the Pauli X gate and Pauli Z gate gives the phase-flip repetition code. For odd , majority-vote decoding of a repetition code corrects up to physical Pauli X gate errors, assuming ideal operations and a noise family containing only these bit flips.
For , prepare two quantum ancillas in and apply controlled-NOT gates from the input qubit to each of them. By linearity, encoding sends
This does not produce , which would contain cross terms. For example, encoding produces , whereas three independent copies would have eight equal computational basis amplitudes. The encoding creates quantum entanglement when both coefficients are nonzero and respects the no-cloning theorem.
The three-qubit bit-flip syndrome table corrects the family and its entire linear span, as specified by the Knill--Laflamme condition. It cannot correct arbitrary errors on one physical qubit: the phase flip
commutes with both checks and acts as logical . In particular, it takes the encoded to the orthogonal encoded with error syndrome . Thus its full quantum code distance is one, despite correcting one error of the restricted Pauli X gate type. The Shor code, Steane code and five-qubit error correcting code provide protection against arbitrary one-qubit errors.
A concatenated quantum code replaces each physical qubit of an outer code by a logical qubit of an inner code. Correction proceeds from inner blocks to outer blocks. For independent errors and ideal correction, a logical-error map iterates as . This recursion describes the code/channel model and does not by itself include errors in encoding and recovery gates.
// Target: quantum-error-correction.bigb
Error syndrome Created 2026-09-24 Updated 2026-10-14
An error syndrome is the list of outcomes obtained by measuring a chosen ordered family of stabilizer generators. Write for eigenvalue and for eigenvalue . For a definite Pauli error on a code state, the rule is
The commuting checks admit joint orthogonal projectors
For density operator , the Born rule gives outcome probability and conditional state when that probability is nonzero. A definite Pauli error has one deterministic error syndrome independent of the encoded amplitudes. A coherent linear combination of Pauli errors may occupy several sectors, so measuring the error syndrome selects a sector; recovery preserves the logical qubit when the entire error family is jointly correctable. [ref].
An error syndrome locates an error only relative to an assumed family and a recovery rule. Two Pauli errors differing by a logical operator can share an error syndrome; see stabilizer-syndrome coset. In the three-qubit bit-flip syndrome table, and both give . Recovering with corrects the first but converts the second into the logical operator . Likewise, has error syndrome yet changes the encoded relative phase.
Logical qubit 2026-10-14
A logical qubit is a two-dimensional encoded quantum subsystem with chosen orthonormal logical basis states . An encoding linear isometry sends to . In a concatenated quantum error-correcting code, one level's logical qubit supplies one qubit of the next outer code.
The Pauli group includes scalar phases . For a nonzero stabilizer code, its Abelian subgroup must satisfy . Otherwise a common positive eigenvector would satisfy and vanish; for example is Abelian but yields no nonzero stabilizer code. We impose this standard admissibility condition.
Every element of such a stabilizer group is Hermitian and squares to : an imaginary-phase Pauli with square is excluded. The associated stabilizer code and its orthogonal projector are
The group multiplication proves , Hermiticity gives , and its range is exactly the common positive eigenspace. If has independent generators, . Every nonidentity element has trace zero, while , so
Thus it encodes logical qubits.
For the symplectic representation of a stabilizer code, label by , ignoring scalar phase. Products add labels, and
This is the nondegenerate alternating form on the binary symplectic space of Pauli labels. The image of is an r-dimensional isotropic subspace of a binary symplectic space, since the generators commute and no nontrivial scalar lies in . Consequently and . A binary generator matrix satisfies . Conversely an isotropic subspace can be lifted by choosing commuting Hermitian generators with independent labels; their products cannot equal , and the orthogonal projector formula supplies the stabilizer code. The labels of the centralizer of a stabilizer group are , with nontrivial logical actions represented by .
For an example, the three-qubit bit-flip repetition code has and . Its two binary rows have zero X part and Z parts . The errors have respective error syndromes , so all single bit flips can be corrected. This is not a stabilizer code correcting every single-qubit error: acts as a nontrivial logical phase error.
Let denote the Pauli centralizer. The exact Pauli error criterion for a stabilizer code is
Equivalently, no difference of error labels lies in . The scalar phases in are essential: an error product is harmless even though it is not in .
We prove the criterion. For outside , some anticommutes with . Since , we have , hence . If , then . If , it restricts to a unitary operator on the stabilizer code, but
no is scalar. A scalar restriction would have scalar coefficient zero by this trace equation, contradicting unitarity. Thus this third case is not scalar.
To justify why scalar compressions are exactly what correction requires, suppose one recovery corrects every . Dilate that recovery to an isometry including its auxiliary system. Correct recovery of every pure stabilizer code state gives . The auxiliary state is independent of : linearity on basis states and their superpositions forces their auxiliary vectors to coincide. Preservation of inner products then gives
which is the Knill--Laflamme condition . The three cases above prove necessity of the boxed criterion.
For sufficiency, put errors in the same class when . They act identically on the stabilizer code up to scalar phase, so give the same error-image subspace. Under the criterion, different classes give mutually orthogonal subspaces , because their cross-compressions vanish. Measure which of these subspaces is occupied and apply the inverse of a representative error. This returns every stabilizer code state unchanged; extend the recovery on the orthogonal complement by preparing any fixed stabilizer code state. Linearity also corrects any valid noise channel whose Kraus operators are linear combinations of the specified errors: within each syndrome all amplitudes multiply the same logical state, and trace preservation normalizes the recovered state. This proves sufficiency, including degenerate error classes.
For a classical error-correcting code of length , alphabet size , minimum Hamming distance and codewords, the Singleton bound is
For a linear code this is . Deleting any coordinates is injective on the codewords, since two words agreeing on the remaining coordinates would differ in fewer than positions; this also explains the classical bound.
For an n-qubit quantum code carrying logical qubits and having quantum code distance , the quantum Singleton bound is
More generally replace by for code dimension . The proof applies to degenerate codes too.
Let . Purify the maximally mixed encoded input by a reference of dimension :
Distance makes erasure of any subset of at most qubits correctable. The allowed quantum erasure correction condition says that a correctable erased set is decoupled from :
This is the matrix-element correction condition in another form: all operators on have constant diagonal matrix elements and zero off-diagonal matrix elements in the logical basis, so tracing the other physical qubits in yields the displayed product.
First justify the sizes needed for the partition. If , partition all physical qubits into , both of size at most . Both sets are correctable. Purity of and the Schmidt decomposition give
Adding forces , a contradiction. Thus , without assuming the bound we aim to prove.
Choose disjoint sets of size , and let contain the remaining qubits. The joint state is pure, so decoupling and Subadditivity of Von Neumann entropy give
Adding and cancelling gives . The Von Neumann entropy of -dimensional states is at most : for positive eigenvalues , concavity of the logarithm gives . Here , so , proving the quantum bound. The code is assumed to encode information (); a one-dimensional code requires a separate distance convention, since simply re-preparing a known state makes its erasure-correction condition vacuous.
Quantum error correction Created 2026-09-24 Updated 2026-10-13
Quantum error correction protects a logical qubit by encoding its quantum state into a larger Hilbert space, where a specified family of physical errors can be diagnosed and reversed by a common recovery quantum channel. The requirement is to restore every encoded quantum superposition, including its relative phase, rather than only the computational basis states. A quantum error-correcting code specifies which errors have this protection; it does not promise recovery from every possible disturbance.
The beautiful idea is to measure relations between physical qubits that reveal an error syndrome while revealing nothing about the protected logical qubit. For example, the bit-flip repetition code compares neighboring qubits without reading their individual values. Its parity checks can locate one Pauli X gate error while leaving the unknown coefficients intact. Encoding is a linear isometry, consistent with the no-cloning theorem: redundancy in a shared quantum state supplies protection without making independent copies of the unknown input.
Peter W. Shor's 1995 paper [ref], published on 1 October, introduced the nine-qubit Shor code to reduce quantum decoherence in memory. Andrew M. Steane's [ref], published on 29 July 1996 and [ref], connected quantum error correction to classical linear codes; the seven-qubit Steane code protects against arbitrary errors on one physical qubit. These constructions protect relative phase as well as computational basis values, going beyond the elementary bit-flip repetition code.
For an authored account of the mechanism, see John Preskill's [ref], especially section 7.1 on collective parity measurements and section 7.9 on stabilizer codes. Andrew Steane's A tutorial on quantum error correction develops the distinction between correcting a stored quantum state and operating with imperfect quantum gates.
Stabilizer code Created 2026-09-24 Updated 2026-10-14
A stabilizer code is the common eigenspace of a stabilizer group , an abelian subgroup of the Pauli group excluding . Choose independent stabilizer generators on physical qubits. They are commuting Hermitian operators, each squaring to . The stabilizer subspace and its orthogonal projector are
The stabilizer-projector formula gives , so logical qubits remain. Independent here means that no nonempty product of the chosen stabilizer generators is . Excluding is necessary: a vector cannot simultaneously be fixed by and unless it is zero.
For the three-qubit bit-flip repetition code, take and , with the Pauli Z gate on site and identities elsewhere. The stabilizer group is . Both stabilizer generators have eigenvalue exactly on the span of and , giving dimensions for one logical qubit. A projective measurement of these checks distinguishes four orthogonal two-dimensional sectors rather than eight individual computational basis states.
A Pauli error that anticommutes with a stabilizer generator changes that check's sign, producing an error syndrome. A Pauli operator commuting with every check can still act on the logical qubits; the centralizer of a stabilizer group describes these possibilities. Thus the number of checks determines the encoded dimension, while the quantum code distance determines protection against arbitrary local errors. The five-qubit error correcting code, for instance, has four stabilizer generators and quantum code distance three; the three-qubit bit-flip repetition code has two checks but quantum code distance one because a single phase flip is unflagged. [ref].
Measure the commuting stabilizer generators and in that order. Use error syndrome bit for eigenvalue and bit for eigenvalue . For the Pauli X gate on physical qubit , every row holds for arbitrary normalized . This ordered parity-check convention follows [ref]:
ErrorState before recovery eigenvaluesError syndromeRecovery
Each pair of computational basis words within a row has the same two parities. Consequently the projective measurement reveals the row without distinguishing its two amplitudes. For example, becomes under . Both checks give with probability one, and applying restores both coefficients exactly, including the relative phase .
One implementation uses two quantum ancillas initialized to . Two controlled-NOT gates from data qubits 1 and 2 to the first quantum ancilla write their parity; two more from data qubits 2 and 3 to the second quantum ancilla write the other parity. Measuring only the quantum ancillas in the computational basis gives . Measuring the individual data qubits instead would reveal the encoded computational basis value and destroy the unknown quantum superposition. The existing coherent syndrome extraction for the three-qubit repetition code uses the alternative ordered checks , so its bit labels differ from this table.
Figure 1.
Parity checks identify a bit flip without reading the logical amplitudes
. Details.
The recovery also handles coherent errors. Put . Their images of the code are mutually orthogonal, giving , the Knill--Laflamme condition for this family. For any linear combination , its component in sector is . Measuring that error syndrome has probability on the normalized erroneous state, and recovery returns . More generally one recovery quantum channel corrects every noise quantum channel whose Kraus operators belong to this span. The assumption concerns the whole jointly correctable family; it does not extend to the span of arbitrary single-site Pauli errors. [ref].
A fully computed coherent example is the unitary operator . At it gives
The error syndromes and occur with probabilities and , independently of . Doing nothing for and applying for restores the same logical qubit in both branches; the scalar in the second branch is an irrelevant global phase. This is an example of linearity of coherent quantum error correction, rather than an assumption that the original error was a classical random bit flip.