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.
Use the normalized three-qubit states . The Shor code has logical basis
It encodes as , preserving the unknown amplitudes by a linear isometry. It concatenates a three-block phase-flip repetition code with the three-qubit bit-flip repetition code inside each block. Six stabilizer generators, , test bit errors inside the blocks. The other two stabilizer generators are
All eight commute and have eigenvalue on both logical basis states. They define the stabilizer code. The inner checks identify single bit flips, and the outer checks identify a block phase flip; combined they also correct a Pauli Y gate error, since .
For the requested phase flip, a on any one qubit interchanges and in its block. It commutes with the six -pair checks. It anticommutes with or exactly when its block is contained in that check. The Shor-code phase-flip syndrome is therefore
A projective measurement of the two commuting checks yields the displayed error syndrome without learning or : both logical components have the same check eigenvalues after the error. Applying the indicated Pauli Z gate restores every encoded quantum state.
The correction is genuinely degenerate. For in the same block, fixes both and , so and consequently . In particular and are distinct physical errors but have identical action on every code state; their image subspaces coincide, not merely their observed syndrome labels. In the Knill--Laflamme condition for , the error Gram matrix has , , and
The zero overlaps between different blocks follow because a phase flip changes a different pattern of orthogonal factors; cross-logical overlaps also vanish. Thus consists of one block and three all-ones blocks and has rank four, not ten. This both proves correctability of the entire single-phase-error span and exhibits its degeneracy. A coherent sum of phase errors in one block has the same logical action with its coefficients summed, so inability to locate the individual qubit loses no logical information. The two block checks suffice to correct every single phase flip, even though the within-block errors are indistinguishable.
For an -qubit quantum code with projector , the quantum code distance is
Here the weight counts nonidentity tensor factors. Thus every error supported on fewer than qubits is detectable, by the Pauli expansion of a quantum error. A scalar action on the code, including a nonidentity stabilizer, is harmless and does not reduce this distance. For a stabilizer code, the equivalent definition minimizes weight among Pauli operators which commute with every stabilizer generator but act nontrivially on the logical information. The Knill--Laflamme condition then guarantees correction of all errors of weight at most , since each pairwise product has weight at most .
Suppose the code encodes logical qubits and is nondegenerate for all errors through weight . There are
distinct Pauli errors modulo phase: choose the affected positions and choose or at each. Each error is unitary, so its image of the code has dimension . Nondegeneracy makes these images mutually orthogonal, equivalently the combined vectors are orthonormal. They all lie in the physical Hilbert space of dimension . Counting dimensions proves the quantum Hamming bound
This dimension argument requires nondegeneracy. For a degenerate code, different errors can share an image, as in the Shor code, and this counting proof cannot be applied unchanged.
For a binary classical code of words, the Hamming bound is : disjoint Hamming balls around the words must fit into all binary strings. The quantum factor is needed because at each erroneous qubit there are three linearly independent nonidentity Pauli operators, not just a classical bit flip. A phase flip is invisible to a computational-basis classical record but changes a quantum superposition. A error combines bit and phase effects, and the identity with spans every one-qubit operator. Quantum correction must protect amplitudes and coherences, and consequently count whole orthogonal logical subspaces rather than just classical words.
For parameters , , and
Thus a nondegenerate such code saturates the bound: the sixteen two-dimensional error images exhaust the physical space. It is a perfect quantum error-correcting code for single-qubit errors. It also has the smallest possible length for nondegenerate single-error protection of one logical qubit: for , the required inequality fails.
Here is an explicit realization and its five-qubit stabilizer syndrome table. Write tensor products without multiplication symbols and use
Each pair has an even number of anticommuting single-site factors, so the four stabilizer generators commute. Their binary Pauli labels are independent: no nonempty product has identity label. For example, the -support at site three fixes the exponent of in such a product to zero, site five then fixes that of , site one fixes that of , and site two fixes that of . Thus their group has sixteen elements and excludes . The common eigenspace has projector and dimension , since all nonidentity Pauli strings have zero trace.
Record a syndrome bit as one when an error anticommutes with the corresponding generator, in order . Direct local commutation gives
These are all fifteen nonzero four-bit error syndromes; the identity has . Distinct errors in this list have a product with nonzero syndrome, so it anticommutes with some . Inserting on both sides gives . The diagonal product is the identity. Hence the Knill--Laflamme condition is exactly , proving nondegenerate correction. Measure the four commuting checks, apply the unique indicated Pauli error again, and every logical state is recovered. The Pauli expansion of a quantum error extends this recovery to an arbitrary one-qubit noise channel, not just the fifteen discrete errors.
The table also proves that every Pauli operator of weight one or two has nonzero syndrome: a weight-two operator is the product of distinct single-site errors, whose syndromes differ. Therefore the distance is at least three. The operators and commute with all four generators and anticommute with each other. They are nontrivial logical Pauli operators. Multiplication of by gives , a weight-three operator with the same logical action; it cannot be scalar on the code because it anticommutes with the invertible logical operator . This proves exactly.
The code consequently detects every two-qubit error and corrects two known-location erasures by the quantum erasure correction criterion, but it cannot correct all two-qubit errors of unknown location. A nontrivial weight-three logical operator can be split into a weight-one and a weight-two error, whose pairwise product violates the correction condition. It also saturates the quantum Singleton bound, since . These properties distinguish single-error perfectness from unrestricted protection against larger errors.
Let be the bit string with one in position and zero elsewhere, and use the standard convention . On the computational basis, the single-site Pauli operators act as
The identity leaves the basis state unchanged. A tensor-product Pauli operator applies these actions at each occupied site; operators at different sites commute. Their linear span is the full operator algebra, so correcting their span handles coherent combinations as well as random Pauli errors.
Let project onto the code , with orthonormal logical basis . A set is correctable exactly when the Knill--Laflamme condition holds:
for a matrix independent of the logical indices. A set is detectable when
These conditions extend by linearity to the corresponding operator spans. Detection allows an error to act as a harmless scalar on the code; it need not assign a distinct syndrome to such an error.
For distinct Pauli representatives modulo phase, a nondegenerate quantum error-correcting code has orthogonal error-image subspaces, giving because each Pauli is unitary. In the usual nondegenerate, or pure, detection convention, every nonidentity detectable Pauli has , while . More generally a nonsingular error-overlap matrix can be diagonalized and the resulting error operators rescaled to obtain orthogonal syndrome spaces; a singular overlap matrix expresses degeneracy of the specified independent error family.
For an code, the quantum code distance is the smallest Pauli weight for which scalar compression fails. Hence every Pauli of weight at most is detectable. If each have weight at most , their product has weight at most . When , its compression is scalar, so the Knill--Laflamme condition proves simultaneous correction of all such errors. Therefore
The integer part is understood when the printed half-distance is not an integer. Arbitrary operators on such subsets are covered by their Pauli expansion.
For errors confined to a known set of positions, every pairwise product is still supported on that same set and has weight at most , rather than . Thus supplies quantum erasure correction, with maximum guaranteed number
This guarantee cannot hold for every set of positions: a minimum-weight undetectable Pauli has support in such a set, and the pair consisting of it and the identity violates the Knill--Laflamme condition. Particular larger location sets can sometimes be correctable; is the maximum uniform guarantee over all possible known sets.
For the Shor code, write . The logical codewords are and . A phase flip in one block interchanges and in that block, independently of its position within the block. Let , , . Measure the two commuting stabilizer generators and . Both are on the entire logical code space. The Shor-code phase-flip syndrome is
These parity measurements reveal the erroneous block without revealing the logical amplitudes, so they preserve arbitrary superpositions of the two codewords. Applying the listed representative phase flip restores the state.
For any two physical positions in the same block, acts as on both and , and hence on the code. Therefore and even when . Their error spaces coincide, and the error-overlap matrix has a nonzero off-diagonal entry. The correction is degenerate because different within-block phase errors have exactly the same action on every logical state.
The physical space of qubits is . An error operator is a linear operator on this space, for example one Kraus operator of a noise quantum channel. The usual channel description assumes initially uncorrelated system and environment, with the environment subsequently ignored; more general initial correlations need not define a channel on arbitrary system inputs. Finite dimension and the tensor decomposition into identifiable qubits allow an exact Pauli expansion of a quantum error. No independence between errors on different qubits is assumed by this expansion.
The tensor products of form an orthogonal basis of the operator space under the Hilbert-Schmidt inner product. Equivalently, absorbing phases into coefficients, every error has an expansion
For a computational basis vector labelled by , this gives
where addition and the dot product in the exponent are modulo two. Thus changes a bit, changes its phase, and performs both up to a scalar phase. A general error is a coherent linear combination of such actions; it need not be a classical random choice of Pauli operators. A restriction to at most faulty qubits is an additional locality assumption, expressed by the span of Pauli operators of weight at most .
The weight of a Pauli operator is the number of tensor factors different from , ignoring global phase. Let be the orthogonal projector onto a -dimensional code . Quantum error detection means
Indeed, a projective measurement of flags departure from the code, while its code-space outcome acts as the scalar on every encoded state and hence does not change logical information. Harmless scalar actions are included in this criterion. The quantum code distance is
Thus every Pauli operator of weight at most is detectable. The condition is linear in , so it holds for any error in their span. This proves detection of arbitrary errors affecting at most qubits, including coherent errors.
For correction, put and take all phase-free Pauli operators of weight at most . Their pairwise products satisfy
These are the Knill--Laflamme conditions. Here is their recovery construction, rather than merely using the criterion's name. For any normalized code state , the matrix is a Gram matrix, since , and is therefore positive semidefinite. Choose linear combinations of the errors diagonalizing this matrix, so that
For , the operators are isometries from the code into mutually orthogonal error-image subspaces: . Measure the projectors and, on outcome , apply . Complete this recovery arbitrarily on the remaining orthogonal subspace to make a trace-preserving quantum channel.
For an error and any encoded density operator , the recovered contribution is
Terms with annihilate the code. For a physical noise channel whose Kraus operators belong to this span, summing the displayed scalar over those operators gives one by trace preservation. The resulting recovered state is exactly . This proves the constructive recovery from the Knill-Laflamme condition and the requested guarantee
This argument allows degenerate codes; distinct physical errors may have identical actions on the code.
For the Shor code, define . Its two normalized basis codewords are
Six stabilizer generators are ; the two phase checks are
All eight have eigenvalue on both basis codewords. A phase error commutes with the six checks and anticommutes with both and . Their projective measurements therefore return
The two negative phase checks identify the middle three-qubit block. Apply the Pauli Z gate to restore the state, since . This procedure acts identically on every logical superposition, and the checks reveal no logical amplitudes. The syndrome cannot distinguish from or , but all three have the same action on the code: their pairwise products lie in the stabilizer group. Correcting with any one of them is sufficient. Thus the degeneracy in the syndrome is harmless.
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.