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.
Number the physical wires from top to bottom and write a computational basis ket in that order. The first four are ancilla qubits and the fifth carries the input. It is enough to follow the basis input , , because the encoding quantum circuit acts linearly.
The first fan-out consists of four controlled-NOT gates from wire 5 to wires 1–4. It sends to . The three Hadamard gates then give
The two Pauli X gates on wires 2 and 3, followed by a Controlled-Z gate and the same two X gates, restore the bits but contribute : the sign is negative exactly when the original bits on both wires were zero. Finally, the right-hand controlled-NOT gates are , , and . They leave the first three bits unchanged and turn the last two into and . Thus
Explicitly, the logical basis quantum states produced by the printed gates are
Each has eight orthogonal terms of equal magnitude, and their supports are disjoint, so they are normalized and mutually orthogonal. The arbitrary input is therefore encoded as
This is a realization of the five-qubit error correcting code. The input amplitudes and their relative quantum phase are preserved in the logical subspace; the encoding is an entangled-state linear isometry, not five independent copies of the unknown input. The explicit signs and bit ordering above are fixed by this circuit, rather than by a convention for a different encoder.
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].