Skip to content

Three-Qubit Codes

The three-qubit repetition codes are the smallest encodings that expose the central mechanism of quantum error correction without hiding its limits. One version protects an unknown qubit against every error in the linear span of the identity and the three single-qubit bit flips. Its Hadamard-conjugate version protects against the corresponding span of single-qubit phase flips. In both cases, two commuting checks identify an error sector without measuring the encoded amplitudes, and an ideal recovery returns every state in the declared correctable span to the code space.

These are targeted codes, not general one-qubit-error-correcting codes. With the standard distance defined over the full Pauli group, each is an [[3,1,1]][[3,1,1]] stabilizer code: a weight-one Pauli from the complementary axis is already a logical operator. The often quoted “distance three” belongs to the restricted repetition problem—XX errors for the bit-flip code or ZZ errors for the phase-flip code. Keeping those statements together makes the examples useful rather than misleading.

Required background. Why Quantum Error Correction Is Possible supplies the encoding-isometry viewpoint and the Knill–Laflamme condition used to certify an error span. Stabilizer Formalism supplies stabilizer groups, code projectors, normalizers, logical Pauli classes, and algebraic syndromes.

Let the logical Hilbert space be one qubit and let the physical register contain qubits 1,2,31,2,3 in that order. The encoding isometry is defined on the computational basis by

V∣0⟩=∣000⟩≡∣0L⟩,V∣1⟩=∣111⟩≡∣1L⟩.V\lvert 0\rangle=\lvert 000\rangle\equiv\lvert 0_L\rangle, \qquad V\lvert 1\rangle=\lvert 111\rangle\equiv\lvert 1_L\rangle.

Linearity then encodes an arbitrary unknown state as

∣ψ⟩=α∣0⟩+β∣1⟩⟼∣ψL⟩=α∣000⟩+β∣111⟩,\lvert\psi\rangle = \alpha\lvert0\rangle+\beta\lvert1\rangle \quad\longmapsto\quad \lvert\psi_L\rangle = \alpha\lvert000\rangle+\beta\lvert111\rangle,

where ∣α∣2+∣β∣2=1|\alpha|^2+|\beta|^2=1. This is one distributed logical state, not three independent copies. No physical qubit has state ∣ψ⟩\lvert\psi\rangle by itself, and the map does not violate no-cloning. Its redundancy resides in correlations: the two computational-basis strings agree in every position, while the amplitudes α\alpha and β\beta remain global logical information.

For a classical repetition code, reading all three bits and taking a majority vote is allowed. Doing that here would measure whether the logical state is ∣0L⟩\lvert0_L\rangle or ∣1L⟩\lvert1_L\rangle and would destroy a superposition. Quantum recovery therefore asks different questions: do neighboring computational-basis values agree, and if not, which disagreement pattern occurred? Those parity questions can reveal a bit-flip sector while acting identically on both logical basis states.

The requirement applies equally when the input qubit is entangled with a reference that the encoder never touches. If

∣Ψ⟩RL=α∣r0⟩∣0⟩+β∣r1⟩∣1⟩,\lvert\Psi\rangle_{RL} = \alpha\lvert r_0\rangle\lvert0\rangle +\beta\lvert r_1\rangle\lvert1\rangle,

then IR⊗VI_R\otimes V produces α∣r0⟩∣000⟩+β∣r1⟩∣111⟩\alpha\lvert r_0\rangle\lvert000\rangle+ \beta\lvert r_1\rangle\lvert111\rangle. A valid recovery must preserve those reference correlations, not merely return the right answer for the two basis inputs. That is why the correction statement below is made for arbitrary density operators and an operator span rather than for a classical list of bit strings.

The code subspace is

C=span⁡{∣000⟩,∣111⟩},\mathcal C = \operatorname{span}\{\lvert000\rangle,\lvert111\rangle\},

so it encodes one qubit into three and has dimension two. Nielsen and Chuang (2010) use this example to separate quantum redundancy from literal copying and to introduce syndrome-based recovery.

Choose the commuting stabilizer generators

g1=Z1Z2,g2=Z2Z3.g_1=Z_1Z_2, \qquad g_2=Z_2Z_3.

Both logical basis states have eigenvalue +1+1 under both checks. Conversely, a computational-basis state in the simultaneous +1+1 eigenspace must have its first bit equal to its second and its second equal to its third. The common eigenspace is therefore exactly C\mathcal C.

Because each gjg_j is a Hermitian involution and [g1,g2]=0[g_1,g_2]=0, the code projector is

P=I+g12I+g22=14(I+Z1Z2)(I+Z2Z3).P = \frac{I+g_1}{2}\frac{I+g_2}{2} = \frac{1}{4}(I+Z_1Z_2)(I+Z_2Z_3).

Its trace gives an immediate dimension check. Every nonidentity Pauli has trace zero on the eight-dimensional physical space, so

Tr⁡P=14Tr⁡I=2.\operatorname{Tr}P = \frac{1}{4}\operatorname{Tr}I =2.

The same conclusion follows from independent constraints. Each nonredundant binary stabilizer generator halves the simultaneous eigenspace, so two generators reduce dimension 232^3 to 23−2=22^{3-2}=2. The product g1g2=Z1Z3g_1g_2=Z_1Z_3 supplies no third independent constraint; its eigenvalue is fixed once those of g1g_1 and g2g_2 are fixed.

The stabilizer group generated by the checks is

S={I,  Z1Z2,  Z2Z3,  Z1Z3}.\mathcal S = \{I,\;Z_1Z_2,\;Z_2Z_3,\;Z_1Z_3\}.

It contains four elements and does not contain −I-I, as required for a nonempty code space. Gottesman (1997) generalizes this projector construction to arbitrary independent commuting Pauli generators. Here the small code lets every step be checked directly.

A bit flip XiX_i anticommutes with each check that contains ZiZ_i and commutes with the other check. It therefore moves the code into a simultaneous eigenspace labeled by two signs. Crucially, those signs depend on the error location but not on α\alpha or β\beta. The checks compare correlations without distinguishing the logical alternatives.

A physical Pauli represents a logical operation when it preserves the code space but acts nontrivially inside it. One convenient choice is

X‾=X1X2X3,Z‾=Z1.\overline X=X_1X_2X_3, \qquad \overline Z=Z_1.

Indeed, X‾\overline X exchanges ∣000⟩\lvert000\rangle and ∣111⟩\lvert111\rangle, while Z‾\overline Z assigns them eigenvalues +1+1 and −1-1. Both commute with g1g_1 and g2g_2, yet neither lies in S\mathcal S. They are elements of the normalizer of the stabilizer modulo the stabilizer itself.

Logical representatives are not unique. Multiplication by a stabilizer does not change the action on C\mathcal C. Thus

Z1∼Z2∼Z3Z_1\sim Z_2\sim Z_3

as logical operators, because Z2=Z1g1Z_2=Z_1g_1 and Z3=Z1g1g2Z_3=Z_1g_1g_2. Likewise, any representative obtained from X1X2X3X_1X_2X_3 by multiplying a stabilizer has the same encoded action, up to an overall Pauli phase.

The encoded Pauli relations are preserved. The chosen representatives square to II, commute with every stabilizer, and anticommute with each other:

X‾Z‾=−Z‾X‾.\overline X\overline Z=-\overline Z\overline X.

Changing a representative by an element of S\mathcal S preserves these relations on C\mathcal C. In quotient language, the nontrivial classes of N(S)/S\mathcal N(\mathcal S)/\mathcal S are the encoded XX, ZZ, and YY classes. The quotient records logical action, while the syndrome records which coset of the normalizer an error occupies.

This equivalence already exposes the asymmetry of the code. The smallest XX-type logical operator has weight three, which is why one targeted XX error can be corrected. A logical ZZ, however, has a weight-one representative. A single phase flip can change the relative phase of the encoded amplitudes while commuting with both ZZ-type checks.

For an error Pauli EE, define the ordered algebraic syndrome by

Egj=(−1)sj(E)gjE,s(E)=s1(E)s2(E).E g_j=(-1)^{s_j(E)}g_jE, \qquad s(E)=s_1(E)s_2(E).

A stored bit sj=0s_j=0 therefore denotes commutation and a +1+1 check eigenvalue on ECE\mathcal C; sj=1s_j=1 denotes anticommutation and a −1-1 eigenvalue. The order is (g1,g2)(g_1,g_2). Reversing the checks or inverting a hardware readout discriminator changes the printed bit string without changing the underlying code, so a syndrome table is meaningful only together with its convention.

The four simultaneous-eigenspace projectors are

Ps1s2=14[I+(−1)s1g1][I+(−1)s2g2].P_{s_1s_2} = \frac{1}{4} \left[I+(-1)^{s_1}g_1\right] \left[I+(-1)^{s_2}g_2\right].

They obey

Ps†=Ps,PsPt=δstPs,∑s∈{0,1}2Ps=I.P_s^\dagger=P_s, \qquad P_sP_t=\delta_{st}P_s, \qquad \sum_{s\in\{0,1\}^2}P_s=I.

Each projector has trace two, so the four sectors partition the full eight-dimensional physical Hilbert space. The code projector is P00=PP_{00}=P. For an encoded vector and a Pauli error, the convention can be read directly from the state:

gjE∣ψL⟩=(−1)sj(E)E∣ψL⟩.g_jE\lvert\psi_L\rangle = (-1)^{s_j(E)}E\lvert\psi_L\rangle.

The definition assumes that the code is the +1+1 eigenspace of the printed generators. Replacing a generator by its negative leaves the parity support unchanged but chooses a different stabilized eigenspace and reverses that syndrome coordinate. The signs of checks are therefore data, not decoration.

These are ideal algebraic projectors. A laboratory implementation needs ancillas, an interaction order, readout conventions, and a fault model; Syndrome Measurement owns those physical circuits and repeated detector records.

For the targeted set

EX={I,X1,X2,X3},\mathcal E_X=\{I,X_1,X_2,X_3\},

the syndrome distinguishes the four weight-at-most-one representatives. It does not identify a unique unrestricted physical error: the paired representative in each row differs by the logical operator X‾\overline X.

SyndromeCheck eigenvalues (g1,g2)(g_1,g_2)Weight-at-most-one representativePaired representativeChosen correction
0000(+1,+1)(+1,+1)IIX1X2X3X_1X_2X_3II
1010(−1,+1)(-1,+1)X1X_1X2X3X_2X_3X1X_1
1111(−1,−1)(-1,-1)X2X_2X1X3X_1X_3X2X_2
0101(+1,−1)(+1,-1)X3X_3X1X2X_1X_2X3X_3

For example, X2X_2 anticommutes with both checks because both contain Z2Z_2, whereas X1X_1 anticommutes only with g1g_1. Applied to an arbitrary logical state, the low-weight representatives produce

I∣ψL⟩=α∣000⟩+β∣111⟩,X1∣ψL⟩=α∣100⟩+β∣011⟩,X2∣ψL⟩=α∣010⟩+β∣101⟩,X3∣ψL⟩=α∣001⟩+β∣110⟩.\begin{aligned} I\lvert\psi_L\rangle &=\alpha\lvert000\rangle+\beta\lvert111\rangle,\\ X_1\lvert\psi_L\rangle &=\alpha\lvert100\rangle+\beta\lvert011\rangle,\\ X_2\lvert\psi_L\rangle &=\alpha\lvert010\rangle+\beta\lvert101\rangle,\\ X_3\lvert\psi_L\rangle &=\alpha\lvert001\rangle+\beta\lvert110\rangle. \end{aligned}

The two basis strings in each line share the same check eigenvalues. A syndrome measurement can therefore identify the sector without learning the relative weights or phase of α\alpha and β\beta.

For a concrete branch, suppose X2X_2 occurs. Then P11X2∣ψL⟩=X2∣ψL⟩P_{11}X_2\lvert\psi_L\rangle=X_2\lvert\psi_L\rangle, while all other PsP_s annihilate the state. The selected correction gives

X2P11X2∣ψL⟩=∣ψL⟩.X_2P_{11}X_2\lvert\psi_L\rangle = \lvert\psi_L\rangle.

Nothing in this calculation requires a choice of α\alpha and β\beta. If a classical mixture assigns probability p2p_2 to this branch, syndrome 1111 occurs with that probability for every logical input. If the physical error is a coherent combination, the branch probabilities are determined by its sector amplitudes, while the same state-independent correction property holds for the complete certified span.

The word sector is safer than “the error.” Across the full Pauli group, all operators in EN(S)E\mathcal N(\mathcal S) have the same syndrome as EE. Some differ by a stabilizer and act identically on the code; others differ by a logical Pauli and have different logical consequences. The lookup identifies a unique representative only under the declared promise of at most one targeted XX error.

Choose E00=IE_{00}=I, E10=X1E_{10}=X_1, E11=X2E_{11}=X_2, and E01=X3E_{01}=X_3. The sector projectors can then be written compactly as

Ps=EsPEs.P_s=E_sPE_s.

Since the XX representatives are self-inverse, the ideal measurement-and-correction recovery is

RX(ρ)=∑s∈{0,1}2EsPsρPsEs.\mathcal R_X(\rho) = \sum_{s\in\{0,1\}^2} E_sP_s\rho P_sE_s.

Each summand is completely positive. Trace preservation follows from the unitarity of the representatives and completeness of the projectors:

∑s(EsPs)†(EsPs)=∑sPs=I.\sum_s(E_sP_s)^\dagger(E_sP_s) = \sum_sP_s =I.

For any encoded density operator ρL=PρLP\rho_L=P\rho_LP and any targeted representative EaE_a,

RX(EaρLEa†)=ρL.\mathcal R_X(E_a\rho_LE_a^\dagger)=\rho_L.

Only the branch with s=s(Ea)s=s(E_a) survives because EaCE_a\mathcal C lies wholly in that sector; its correction then cancels EaE_a. One can apply EsE_s physically or retain it as a Pauli-frame update when later operations and measurements can interpret the frame. The ideal channel does not determine which implementation is preferable.

If the classical syndrome is retained, the outcome-resolved instrument has branches ρ↦EsPsρPsEs\rho\mapsto E_sP_s\rho P_sE_s with probabilities Tr⁡(Psρ)\operatorname{Tr}(P_s\rho). Summing the branches gives the channel above. Retaining or discarding the classical record does not alter the corrected logical state for a promised correctable input, but it matters operationally for diagnostics, Pauli-frame tracking, and later decoding.

The correction representative is a convention as well. Multiplying EsE_s by a stabilizer leaves its action on the mapped code sector unchanged. Multiplying it by a logical operator would preserve the code space but change the recovered logical state. A recovery table must therefore specify logical class, not merely return each branch somewhere inside C\mathcal C.

The same channel supplies a useful reference-system check. Let RR be arbitrary and let ρRL\rho_{RL} have its logical support in C\mathcal C. For every promised representative EaE_a acting only on the physical register,

(IR⊗RX) ⁣[(IR⊗Ea)ρRL(IR⊗Ea)†]=ρRL.(I_R\otimes\mathcal R_X) \!\left[(I_R\otimes E_a)\rho_{RL}(I_R\otimes E_a)^\dagger\right] = \rho_{RL}.

Thus recovery preserves not only the logical density matrix but every correlation with an external reference. Checking only ∣0L⟩\lvert0_L\rangle and ∣1L⟩\lvert1_L\rangle would not establish this stronger statement: a process could return both basis states yet erase their relative phase. The sector-projector calculation and the Knill–Laflamme identity rule out that failure for the declared span.

Recovery is also not unique outside that span. Two channels can agree on all four promised sectors while acting differently on a weight-two fault, a leakage state, or a coherent component outside the Pauli span. The table fixes the minimum-weight extension because it makes the later failure calculation well defined. It should not be read as a theorem that this extension is optimal for every prior. Once high-weight errors, correlations, or noisy records have appreciable probability, choosing among logically inequivalent extensions is a decoding problem rather than part of the code definition.

Correctability without learning amplitudes

Section titled “Correctability without learning amplitudes”

The Knill–Laflamme condition certifies the whole encoded qubit at once. For the ordered errors

E0=I,E1=X1,E2=X2,E3=X3,E_0=I, \qquad E_1=X_1, \qquad E_2=X_2, \qquad E_3=X_3,

one has

PEa†EbP=δabP.PE_a^\dagger E_bP=\delta_{ab}P.

When a=ba=b, the product is II. When a≠ba\ne b, the product is either a single XiX_i or a two-qubit XiXjX_iX_j. Every such product anticommutes with at least one stabilizer generator. If an operator AA anticommutes with a stabilizer gg and gP=PgP=P, then

PAP=PgAgP=−PAgP=−PAP,PAP = PgAgP = -PAgP = -PAP,

so PAP=0PAP=0. The Knill–Laflamme matrix is therefore the identity in this error basis. Knill and Laflamme (1997) prove that this state-independent relation is necessary and sufficient for exact correction of the declared error span.

The diagonal scalar does not depend on whether the input is ∣0L⟩\lvert0_L\rangle, ∣1L⟩\lvert1_L\rangle, or a superposition. Equivalently, the four error images EaCE_a\mathcal C are mutually orthogonal two-dimensional subspaces. A syndrome register may acquire the label aa, but it cannot acquire information about α\alpha and β\beta. After the conditional inverse, the logical state factorizes from that label.

The same test covers noise correlated with an inaccessible environment. A joint error isometry can be expanded as ∑aEa∣ψL⟩∣ea⟩\sum_aE_a\lvert\psi_L\rangle\lvert e_a\rangle whenever its system operators lie in the certified span. Orthogonal syndrome sectors carry the aa dependence, while the logical factor is the same in every corrected branch. The environment may learn an error label or a coherent combination of labels; the scalar condition prevents it from learning the logical amplitudes.

For a stochastic bit-flip channel

NX(ρ)=∑a=03paEaρEa†,pa≥0,∑apa=1,\mathcal N_X(\rho) = \sum_{a=0}^{3}p_aE_a\rho E_a^\dagger, \qquad p_a\ge0, \qquad \sum_ap_a=1,

the corrected output obeys

(RX∘NX)(ρL)=ρL.(\mathcal R_X\circ\mathcal N_X)(\rho_L)=\rho_L.

The probabilities can be unequal and need not be inferred from the logical state. What matters is that the channel has support inside the correctable operator span and that recovery uses the matching syndrome convention.

Coherent bit rotations lie in the corrected span

Section titled “Coherent bit rotations lie in the corrected span”

Exact correctability is linear in the error operators, so it is stronger than correction of a classical random label. Consider a coherent rotation on physical qubit ii,

Ui(θ)=e−iθXi/2=cos⁡θ2 I−isin⁡θ2 Xi.U_i(\theta) = e^{-i\theta X_i/2} = \cos\frac{\theta}{2}\,I -i\sin\frac{\theta}{2}\,X_i.

This unitary lies in span⁡{I,Xi}\operatorname{span}\{I,X_i\} and hence in the span certified above. Acting on the code, it creates a coherent superposition of the no-error and XiX_i sectors. The ideal syndrome measurement places those components in orthogonal branches; the branch-dependent correction maps both components back to the same logical state. Consequently,

RX ⁣(Ui(θ)ρLUi(θ)†)=ρL\mathcal R_X\!\left( U_i(\theta)\rho_LU_i(\theta)^\dagger \right) = \rho_L

for every angle θ\theta and every encoded density operator.

More generally, every operator A=∑a=03caEaA=\sum_{a=0}^{3}c_aE_a belongs to the corrected linear span. This is why correcting a basis of error operators corrects coherent combinations of them. It does not mean that every multi-qubit coherent process is corrected. A product of rotations on several carriers contains weight-two and weight-three terms. Under the minimum-weight lookup, those components can become a logical X‾\overline X. Nor does an ideal projective recovery model interference that may persist when a physical syndrome extraction is weak, faulty, or incompletely recorded.

A syndrome measurement need not be interpreted as revealing which term “really happened.” Before measurement, II and XiX_i can be coherent amplitudes of one unitary process. The recovery works because their error subspaces are distinguishable without logical information, not because the noise was secretly a classical coin flip. If the syndrome record is coherently retained rather than measured, a unitary recovery controlled by that record gives the same logical decoupling.

The statement is therefore exact and bounded: the bit-flip repetition code corrects the operator space spanned by I,X1,X2,X3I,X_1,X_2,X_3. Calling the physical process “coherent” does not defeat that theorem, while calling it “small” does not license the omission of uncorrectable components outside the span.

The single-qubit Hadamard exchanges Pauli axes,

HXH=Z,HZH=X.HXH=Z, \qquad HZH=X.

Conjugating the entire bit-flip construction by H⊗3H^{\otimes3} gives the phase-flip code. With

∣+⟩=∣0⟩+∣1⟩2,∣−⟩=∣0⟩−∣1⟩2,\lvert+\rangle = \frac{\lvert0\rangle+\lvert1\rangle}{\sqrt2}, \qquad \lvert-\rangle = \frac{\lvert0\rangle-\lvert1\rangle}{\sqrt2},

its logical basis is

∣0L(ph)⟩=∣+++⟩,∣1L(ph)⟩=∣−−−⟩.\lvert0_L^{(\mathrm{ph})}\rangle=\lvert+++\rangle, \qquad \lvert1_L^{(\mathrm{ph})}\rangle=\lvert---\rangle.

An unknown logical state is therefore encoded as α∣+++⟩+β∣−−−⟩\alpha\lvert+++\rangle+\beta\lvert---\rangle, not as three copies of the original qubit. The stabilizer generators are

g~1=X1X2,g~2=X2X3,\widetilde g_1=X_1X_2, \qquad \widetilde g_2=X_2X_3,

and the code projector is

Pph=14(I+X1X2)(I+X2X3).P_{\mathrm{ph}} = \frac{1}{4}(I+X_1X_2)(I+X_2X_3).

Equivalently, one may encode in the computational basis, conjugate physical phase noise by Hadamards, apply bit-flip recovery, and conjugate back. That identity derives the algebra, but a hardware implementation must count the basis-changing operations if they are actually performed. One can instead measure the XX-type checks directly using an appropriate ancilla circuit. The code is defined by its subspace and checks, not by a mandatory sequence of three Hadamards.

This duality turns comparisons of computational-basis values into comparisons in the XX basis. A physical ZiZ_i exchanges ∣+⟩\lvert+\rangle and ∣−⟩\lvert-\rangle, so it plays the role that XiX_i played before conjugation. The construction is the elemental reason that combining protection in complementary bases can address a larger Pauli set. Shor Code owns the concatenated nine-qubit construction, degenerate recovery, and full distance-three proof, following Shor’s original scheme (Shor 1995); this page retains the two component repetition codes, each of which protects only one axis.

Use the same stored-bit convention and the ordered checks (g~1,g~2)(\widetilde g_1,\widetilde g_2). Then

s(I)=00,s(Z1)=10,s(Z2)=11,s(Z3)=01.s(I)=00, \qquad s(Z_1)=10, \qquad s(Z_2)=11, \qquad s(Z_3)=01.

The phase-code projectors are

P~s1s2=14[I+(−1)s1g~1][I+(−1)s2g~2],\widetilde P_{s_1s_2} = \frac{1}{4} \left[I+(-1)^{s_1}\widetilde g_1\right] \left[I+(-1)^{s_2}\widetilde g_2\right],

and the corrections are I,Z1,Z2,Z3I,Z_1,Z_2,Z_3 for syndromes 00,10,11,0100,10,11,01, respectively. Thus

RZ(ρ)=∑sE~sP~sρP~sE~s\mathcal R_Z(\rho) = \sum_s \widetilde E_s\widetilde P_s \rho \widetilde P_s\widetilde E_s

corrects span⁡{I,Z1,Z2,Z3}\operatorname{span}\{I,Z_1,Z_2,Z_3\} on the phase-code subspace. Its Knill–Laflamme matrix is again δab\delta_{ab}, now for the ordered ZZ representatives. A coherent rotation e−iθZi/2e^{-i\theta Z_i/2} is corrected by the same linear-span argument.

For example, Z3Z_3 anticommutes with g~2\widetilde g_2 but commutes with g~1\widetilde g_1, so it produces 0101. Applying Z3Z_3 then returns both ∣+++⟩\lvert+++\rangle and ∣−−−⟩\lvert---\rangle, and therefore every superposition of them, to their pre-error values.

The syndromes are formally identical because Hadamard conjugation preserves commutation and anticommutation. Their physical circuits are not literally identical in a fixed hardware basis: measuring an XX-type product generally requires basis changes or the complementary ancilla orientation. The algebraic table specifies the ideal observable and bit convention, while the extraction owner specifies how a device obtains that record.

Conjugating the bit-code logical representatives gives

X‾ph=Z1Z2Z3,Z‾ph=X1.\overline X_{\mathrm{ph}}=Z_1Z_2Z_3, \qquad \overline Z_{\mathrm{ph}}=X_1.

The first exchanges ∣+++⟩\lvert+++\rangle and ∣−−−⟩\lvert---\rangle; the second assigns them eigenvalues +1+1 and −1-1. As before, multiplication by a stabilizer gives equivalent representatives, so X1∼X2∼X3X_1\sim X_2\sim X_3 on the phase-code subspace.

The complete crosswalk records both the exact duality and the boundary that Hadamard conjugation preserves.

ObjectBit-flip codePhase-flip code
Codewords∣000⟩\lvert000\rangle, ∣111⟩\lvert111\rangle∣+++⟩\lvert+++\rangle, ∣−−−⟩\lvert---\rangle
Stabilizer generatorsZ1Z2Z_1Z_2, Z2Z3Z_2Z_3X1X2X_1X_2, X2X3X_2X_3
Code projector(I+Z1Z2)(I+Z2Z3)/4(I+Z_1Z_2)(I+Z_2Z_3)/4(I+X1X2)(I+X2X3)/4(I+X_1X_2)(I+X_2X_3)/4
Declared correctable setI,X1,X2,X3I,X_1,X_2,X_3I,Z1,Z2,Z3I,Z_1,Z_2,Z_3
Ordered syndrome mapI,X1,X2,X3→00,10,11,01I,X_1,X_2,X_3\to00,10,11,01I,Z1,Z2,Z3→00,10,11,01I,Z_1,Z_2,Z_3\to00,10,11,01
Chosen ideal recoveryI,X1,X2,X3I,X_1,X_2,X_3 by syndromeI,Z1,Z2,Z3I,Z_1,Z_2,Z_3 by syndrome
Logical X‾\overline XX1X2X3X_1X_2X_3Z1Z2Z3Z_1Z_2Z_3
Logical Z‾\overline ZZ1∼Z2∼Z3Z_1\sim Z_2\sim Z_3X1∼X2∼X3X_1\sim X_2\sim X_3
Distance statementtargeted single-axis distance 33; full d=1d=1targeted single-axis distance 33; full d=1d=1

Hadamard duality exchanges the two constructions; it does not combine their protection. The phase code corrects one targeted Pauli axis and is transparent to the complementary weight-one logical operation, just as the bit code is.

Restricted Distance and Full-Pauli Failure

Section titled “Restricted Distance and Full-Pauli Failure”

Targeted distance three is not full distance three

Section titled “Targeted distance three is not full distance three”

For a stabilizer code, the standard distance is the minimum weight of a Pauli operator in N(S)∖S\mathcal N(\mathcal S)\setminus\mathcal S. It is defined over all Pauli axes unless a restriction is stated. In the bit-flip code, Z1Z_1 commutes with both ZZ-type stabilizers, is not a stabilizer, and acts as Z‾\overline Z. Therefore the minimum weight is one. In the phase-flip code, X1X_1 similarly acts as a weight-one logical Z‾ph\overline Z_{\mathrm{ph}}. Both codes have full parameters

[[3,1,1]].[[3,1,1]].

A restricted repetition distance asks a narrower question. Among XX-type operators for the bit code, the smallest undetectable nontrivial logical operator is X1X2X3X_1X_2X_3, of weight three. The code detects up to two targeted XX flips in the algebraic sense and corrects up to one under t=⌊(d−1)/2⌋t=\lfloor(d-1)/2\rfloor. The phase code has the corresponding weight-three statement for ZZ-type operators.

Standard distance controls arbitrary operator errors because the single-qubit Pauli matrices span every one-qubit operator. A genuine distance-three qubit code can correct the full span generated by I,Xi,Yi,ZiI,X_i,Y_i,Z_i at each location. These repetition codes fail that test before recovery design begins: the weight-one complementary logical operator makes two distinct logical states respond differently to an error with syndrome zero.

Writing [[3,1,3]][[3,1,3]] without a qualifier would assert correction of every single-qubit Pauli error, which is false. The precise language is “the [[3,1,1]][[3,1,1]] bit-flip repetition code has targeted XX distance three,” or its phase-dual counterpart. Restricted distances are useful when a noise model has a strongly biased axis, but the bias and its stability are then hypotheses of the protection claim.

Complementary Pauli faults become logical operators

Section titled “Complementary Pauli faults become logical operators”

The bit-code checks cannot detect any single ZiZ_i, because all such operators commute with g1g_1 and g2g_2. Moreover,

PZiP=Z‾PPZ_iP=\overline ZP

for each ii, using equivalent logical representatives. A phase fault therefore produces syndrome 0000 while changing α∣000⟩+β∣111⟩\alpha\lvert000\rangle+\beta\lvert111\rangle to α∣000⟩−β∣111⟩\alpha\lvert000\rangle-\beta\lvert111\rangle. Recovery sees the no-error sector and leaves the logical phase flip in place.

A YiY_i fault shows why a nonzero syndrome is not enough. Using Yi=iXiZiY_i=iX_iZ_i, it has the same syndrome as XiX_i, since the ZiZ_i factor commutes with both checks. The targeted decoder applies XiX_i, leaving

XiYi=iZi,X_iY_i=iZ_i,

which is a logical Z‾\overline Z up to global phase. The location was inferred correctly for the XX component, yet the logical state was not recovered because the declared error model omitted the complementary component.

The phase code has the dual failure. A single XiX_i is an undetected logical phase in its encoded basis, and a YiY_i shares the syndrome of ZiZ_i but leaves a weight-one XiX_i residual after the targeted correction. No syndrome relabeling fixes this information deficit: with two checks and one encoded qubit, the code separates four targeted sectors, not all single-qubit Pauli faults.

Weight-two targeted faults fail differently. In the bit code, X1X2X_1X_2 has the same syndrome as X3X_3. Applying X3X_3 leaves X1X2X3=X‾X_1X_2X_3=\overline X. Every pair aliases to the remaining single flip. A triple flip has syndrome 0000 and is itself X‾\overline X. These aliases turn the majority rule into the logical-failure polynomial below.

Logical Failure Under Independent Targeted Noise

Section titled “Logical Failure Under Independent Targeted Noise”

Majority failure gives the logical polynomial

Section titled “Majority failure gives the logical polynomial”

Assume a frozen one-step model: each physical carrier independently suffers the targeted Pauli with probability pp, no complementary error occurs, encoding and recovery are perfect, and the fixed lookup chooses the weight-zero or weight-one representative for each syndrome. The output is successful when the residual operator is a stabilizer and fails when it differs by the targeted logical X‾\overline X.

Zero or one targeted fault is corrected. Exactly two faults occur with probability

(32)p2(1−p),\binom{3}{2}p^2(1-p),

and all three occur with probability p3p^3. Both cases leave the targeted logical operation after the minimum-weight correction. Hence

pL=3p2(1−p)+p3=3p2−2p3.p_L = 3p^2(1-p)+p^3 = 3p^2-2p^3.

For independent but nonidentical targeted probabilities p1,p2,p3p_1,p_2,p_3, the same event count gives

pL=p1p2+p1p3+p2p3−2p1p2p3.p_L = p_1p_2+p_1p_3+p_2p_3-2p_1p_2p_3.

Setting all three values to pp recovers the displayed polynomial. Correlation invalidates this product expansion even if every one-qubit marginal equals pp; the probability of weight two or three must then be taken from the joint law.

The same polynomial applies to bit flips in the bit code and phase flips in the phase code. It is a pushforward of a declared independent physical-error law through this particular code and decoder. Pauli Noise and Depolarizing Channels owns the broader probability-law, correlation, and channel-convention audit.

At small pp, the leading logical term is 3p23p^2. For example, the frozen model gives pL=0.028p_L=0.028 at p=0.1p=0.1, compared with the unencoded value 0.10.1, and pL=0.000298p_L=0.000298 at p=0.01p=0.01. These numbers are exact evaluations of the polynomial, not device forecasts; every omitted circuit fault or complementary error lies outside them. The quadratic behavior expresses removal of all weight-one targeted contributions. It does not say that full device error is quadratic if encoding, checks, recovery, or readout have faults.

Improvement, crossover, and what this is not

Section titled “Improvement, crossover, and what this is not”

Compare pLp_L with the failure pp of one unencoded carrier under the same one-step targeted model. Their difference factors as

pL−p=p(1−p)(2p−1).p_L-p = p(1-p)(2p-1).

Therefore

pL<p⟺0<p<12.p_L<p \quad\Longleftrightarrow\quad 0<p<\frac12.

The two are equal at p=0p=0, p=1/2p=1/2, and p=1p=1 under the fixed decoder, while the encoded rule is worse for 1/2<p<11/2<p<1. When p>1/2p>1/2, a decoder that knows the prior could reinterpret likely high-weight patterns rather than retain the minimum-weight rule; changing that rule changes the estimand. The displayed comparison is an exact finite calculation for a specified decoder, not a universal optimum.

The crossover at p=1/2p=1/2 is not a fault-tolerance threshold. There is no infinite code family, no noisy syndrome circuit, no repeated round, no locality model, no decoder-scaling claim, and no quantified logical suppression with growing distance. It is also not a break-even experiment unless preparation, operations, waits, measurements, selection, and denominators are brought inside a matched comparison.

Correlations replace the binomial weights; coherent multi-qubit terms can interfere before a syndrome record is formed; complementary errors enter at first order because the full distance is one; and measurement faults can make a single data error look like a different sector. Decoders owns inference under nonuniform priors, aliasing, noisy records, and latency constraints. The polynomial remains valuable precisely because its assumptions are explicit and its conclusion is limited.

This page owns the two pedagogical three-qubit constructions, their exact stabilizers and projectors, the fixed four-sector syndrome conventions, ideal targeted recoveries, the Knill–Laflamme certificate for their operator spans, Hadamard duality, restricted-distance language, and the finite independent-noise polynomial. It does not own the general proof of quantum correctability, general stabilizer formalism, physical syndrome circuits, probabilistic decoding, or device-noise reconstruction.

Five-Qubit Code owns the full-Pauli [[5,1,3]][[5,1,3]] cyclic construction, its sixteen-error syndrome lookup, perfect Hamming packing, and minimum-length proof; this page retains the restricted bit- and phase-flip repetition constructions.

Bits, Qubits, Qudits, and Modes provides the carrier-versus-logical-system orientation behind the encoding isometry; this page begins only after that distinction has been fixed.

Use the Quantum Error Correction and Fault Tolerance guide to place a code-level statement inside a complete protection-to-evidence record. Return to Why Quantum Error Correction Is Possible for the general Knill–Laflamme theorem and the no-cloning boundary, and to Stabilizer Formalism for binary symplectic representations, normalizers, degeneracy, Clifford updates, and arbitrary stabilizer codes.

Move to Syndrome Measurement when ideal projectors must become ancilla circuits, signed outcomes, repeated records, and detector parities. Move to Decoders when the syndrome no longer identifies one promised representative and a prior over logical equivalence classes is required. Use Pauli Noise and Depolarizing Channels before interpreting pp as a device parameter, especially when axes, correlations, time steps, or approximation error matter.

The boundary explains why a favorable calculation here does not settle an engineering choice. A repetition experiment may deliberately protect one Pauli observable, use postselection, repeat checks over time, or compare several physical lengths without claiming storage of an arbitrary qubit under full Pauli noise. Those can be rigorous and valuable tasks. They should be reported in their own terms rather than upgraded to a stronger full-state claim.

The codes have a substantial experimental afterlife, but each result must be read with its task and trusted boundary intact. Chiaverini and collaborators (2004) demonstrated active quantum error correction with trapped ions; Reed and collaborators (2012) implemented a three-qubit correction protocol with superconducting circuits; Ristè and collaborators (2015) repeatedly measured stabilizers of a superconducting logical qubit; and Google Quantum AI (2021) studied finite repetition-code scaling for targeted bit or phase errors. These works do not turn the three-qubit constructions into full-distance-three codes. They show how code algebra, extraction, feedback, and evidence become distinct experimental layers.

Show that P=(I+Z1Z2)(I+Z2Z3)/4P=(I+Z_1Z_2)(I+Z_2Z_3)/4 is an orthogonal projector, find its trace, and identify a basis for its image. Explain why the answer encodes one logical qubit.

Solution

The two checks commute and square to II, so each factor (I+gj)/2(I+g_j)/2 is an orthogonal projector and their product is an orthogonal projector onto the simultaneous +1+1 eigenspace. Expanding gives

P=14(I+Z1Z2+Z2Z3+Z1Z3).P = \frac14(I+Z_1Z_2+Z_2Z_3+Z_1Z_3).

All three nonidentity Paulis are traceless, while Tr⁡I=8\operatorname{Tr}I=8. Hence Tr⁡P=8/4=2\operatorname{Tr}P=8/4=2. A computational-basis vector is in the image exactly when bit 1 equals bit 2 and bit 2 equals bit 3, so the image is span⁡{∣000⟩,∣111⟩}\operatorname{span}\{\lvert000\rangle,\lvert111\rangle\}. Its dimension is two, equal to the Hilbert-space dimension of one logical qubit.

Starting from the ordered checks (Z1Z2,Z2Z3)(Z_1Z_2,Z_2Z_3) and the convention 00 for commutation, derive the syndromes of I,X1,X2,X3I,X_1,X_2,X_3. Then find the syndrome of each two-qubit product X1X2X_1X_2, X1X3X_1X_3, and X2X3X_2X_3 and identify the single-error representative with which it aliases.

Solution

An XiX_i anticommutes with a check exactly when that check contains ZiZ_i. Thus

s(I)=00,s(X1)=10,s(X2)=11,s(X3)=01.s(I)=00, \quad s(X_1)=10, \quad s(X_2)=11, \quad s(X_3)=01.

Syndromes add componentwise modulo two under Pauli multiplication. Therefore

s(X1X2)=01=s(X3),s(X1X3)=11=s(X2),s(X_1X_2)=01=s(X_3), \qquad s(X_1X_3)=11=s(X_2),

and s(X2X3)=10=s(X1)s(X_2X_3)=10=s(X_1). Each pair differs from the aliased single error by X1X2X3=X‾X_1X_2X_3=\overline X. A minimum-weight correction consequently turns every weight-two targeted fault into a logical bit flip.

For EX={I,X1,X2,X3}\mathcal E_X=\{I,X_1,X_2,X_3\}, prove directly that PEa†EbP=δabPPE_a^\dagger E_bP=\delta_{ab}P. State what this matrix says about the encoded amplitudes.

Solution

If a=ba=b, then Ea†Eb=IE_a^\dagger E_b=I and the projected product is PP. If a≠ba\ne b, the product is a single XiX_i or a two-body XiXjX_iX_j. Every such operator anticommutes with at least one generator gg. Since gP=PgP=P,

PEa†EbP=PgEa†EbgP=−PEa†EbP,PE_a^\dagger E_bP = PgE_a^\dagger E_bgP = -PE_a^\dagger E_bP,

so the expression vanishes. The scalar matrix is the identity and is independent of the state in the code. Error-sector information can be learned without distinguishing α\alpha from β\beta in α∣0L⟩+β∣1L⟩\alpha\lvert0_L\rangle+\beta\lvert1_L\rangle.

Let U2(θ)=e−iθX2/2U_2(\theta)=e^{-i\theta X_2/2} act on an encoded density operator. Show from the syndrome projectors and corrections that ideal recovery returns the input for every θ\theta. Why does this not prove correction of U1(θ)U2(θ)U3(θ)U_1(\theta)U_2(\theta)U_3(\theta)?

Solution

Write

U2(θ)=cI−isX2,c=cos⁡θ2,s=sin⁡θ2.U_2(\theta) = cI-isX_2, \qquad c=\cos\frac{\theta}{2}, \qquad s=\sin\frac{\theta}{2}.

The identity component lies in sector 0000 and the X2X_2 component in sector 1111. The projectors remove cross-sector terms in the unread record. Correction II maps the first branch to the input, and correction X2X_2 maps the second branch to the same input. Their weights are c2c^2 and s2s^2, so they sum to the original density operator.

The three-rotation product also contains terms proportional to XiXjX_iX_j and X1X2X3X_1X_2X_3. Those operators lie outside the declared correctable span and are mapped to logical-X‾\overline X branches by the fixed recovery.

Apply H⊗3H^{\otimes3} to the bit-flip code. Derive the encoded basis, checks, targeted error representatives, syndrome order, recovery representatives, and one pair of logical Pauli representatives.

Solution

Hadamard sends ∣0⟩\lvert0\rangle to ∣+⟩\lvert+\rangle, ∣1⟩\lvert1\rangle to ∣−⟩\lvert-\rangle, ZZ to XX, and XX to ZZ. Hence

∣0L(ph)⟩=∣+++⟩,∣1L(ph)⟩=∣−−−⟩,\lvert0_L^{(\mathrm{ph})}\rangle=\lvert+++\rangle, \qquad \lvert1_L^{(\mathrm{ph})}\rangle=\lvert---\rangle,

with checks X1X2X_1X_2 and X2X3X_2X_3. The targeted representatives are I,Z1,Z2,Z3I,Z_1,Z_2,Z_3, with syndromes 00,10,11,0100,10,11,01 in that order, and the matching corrections are I,Z1,Z2,Z3I,Z_1,Z_2,Z_3. Conjugating the bit-code logical representatives gives

X‾ph=Z1Z2Z3,Z‾ph=X1.\overline X_{\mathrm{ph}}=Z_1Z_2Z_3, \qquad \overline Z_{\mathrm{ph}}=X_1.

Both commute with the checks, anticommute with each other, and act as the encoded Pauli pair.

6. Show that the full Pauli distance is one

Section titled “6. Show that the full Pauli distance is one”

Use the normalizer definition of stabilizer-code distance to prove that both three-qubit repetition codes have full distance one, while retaining targeted distance three.

Solution

For the bit code, Z1Z_1 has weight one, commutes with both ZZ-type checks, is not in the stabilizer, and acts nontrivially as Z‾\overline Z. Thus Z1∈N(S)∖SZ_1\in\mathcal N(\mathcal S)\setminus\mathcal S and the full distance is at most one; a nontrivial code cannot have distance below one, so d=1d=1. The smallest nontrivial logical operator made only of XX factors is X1X2X3X_1X_2X_3, which has weight three.

For the phase code, the dual statements use weight-one X1=Z‾phX_1=\overline Z_{\mathrm{ph}} and weight-three Z1Z2Z3=X‾phZ_1Z_2Z_3=\overline X_{\mathrm{ph}}. Therefore both are [[3,1,1]][[3,1,1]] codes with a restricted targeted-axis repetition distance of three.

7. Compute the independent-noise logical failure

Section titled “7. Compute the independent-noise logical failure”

Assume independent targeted faults of probability pp and the fixed minimum-weight recovery. Derive pLp_L, determine every equality point of pL=pp_L=p on 0≤p≤10\le p\le1, and state the interval of strict improvement and all idealizations used.

Solution

Recovery succeeds for weights zero and one and leaves a logical targeted flip for weights two and three. Thus

pL=(32)p2(1−p)+p3=3p2−2p3.p_L = \binom{3}{2}p^2(1-p)+p^3 = 3p^2-2p^3.

Subtracting the unencoded probability gives

pL−p=p(1−p)(2p−1).p_L-p=p(1-p)(2p-1).

The equality points are p=0p=0, p=1/2p=1/2, and p=1p=1. For 0<p<1/20<p<1/2 the final factor is negative, so pL<pp_L<p. For 1/2<p<11/2<p<1 it is positive, so the fixed encoded rule is worse. The calculation assumes independent targeted-axis faults, ideal encoding, ideal syndrome extraction, ideal recovery, ideal readout, and the fixed minimum-weight rule. It is a finite comparison, not a threshold theorem.

8. Diagnose a Y fault and decoder mismatch

Section titled “8. Diagnose a Y fault and decoder mismatch”

A Y2Y_2 fault acts on the bit-flip code, but the decoder assumes the targeted set {I,X1,X2,X3}\{I,X_1,X_2,X_3\}. Find the recorded syndrome, selected correction, and residual logical operation. Explain which assumption failed.

Solution

Since Y2=iX2Z2Y_2=iX_2Z_2 and the Z2Z_2 factor commutes with both ZZ-type checks, Y2Y_2 has the same syndrome as X2X_2, namely 1111. The decoder applies X2X_2. The residual is

X2Y2=iZ2.X_2Y_2=iZ_2.

On the code, Z2Z_2 is equivalent to the logical Z‾\overline Z, so the output has an undetected logical phase flip up to global phase. The syndrome and lookup were internally consistent; the failed assumption was that the physical error belonged to the targeted XX-only set. A broader noise model requires a code and decoder that distinguish or otherwise correct the additional logical classes.

  • J. Chiaverini et al., “Realization of quantum error correction,” Nature 432, 602–605, 2004, doi:10.1038/nature03074.
  • Google Quantum AI, “Exponential suppression of bit or phase errors with cyclic error correction,” Nature 595, 383–387, 2021, doi:10.1038/s41586-021-03588-y.
  • D. Gottesman, Stabilizer Codes and Quantum Error Correction, Ph.D. thesis, California Institute of Technology, 1997, doi:10.7907/rzr7-dt72.
  • E. Knill and R. Laflamme, “Theory of quantum error-correcting codes,” Physical Review A 55, 900–911, 1997, doi:10.1103/PhysRevA.55.900.
  • M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, 10th anniversary edition, Cambridge University Press, 2010, doi:10.1017/CBO9780511976667.
  • M. D. Reed et al., “Realization of three-qubit quantum error correction with superconducting circuits,” Nature 482, 382–385, 2012, doi:10.1038/nature10786.
  • D. Ristè et al., “Detecting bit-flip errors in a logical qubit using stabilizer measurements,” Nature Communications 6, 6983, 2015, doi:10.1038/ncomms7983.
  • P. W. Shor, “Scheme for reducing decoherence in quantum computer memory,” Physical Review A 52, R2493–R2496, 1995, doi:10.1103/PhysRevA.52.R2493.