In short

The 3-qubit bit-flip code is the simplest quantum error-correcting code. Using two CNOTs, you encode a data qubit \alpha|0\rangle + \beta|1\rangle and two ancillas |00\rangle into the entangled state \alpha|000\rangle + \beta|111\rangle — one logical qubit spread across three physical qubits, not three copies. If any single physical qubit suffers a bit-flip (X) error, two parity measurementsZ_0 Z_1 and Z_0 Z_2 — tell you exactly which qubit flipped, without ever measuring \alpha or \beta. The four possible syndromes (++), (-+), (+-), (--) correspond to "no error, X on qubit 1, X on qubit 2, X on qubit 0". Apply the matching X to fix, and the logical state is exactly restored. The code fails only when two or more qubits flip — probability \approx 3p^2 for small p, a quadratic suppression over the unprotected rate p. The code's major limitation: it detects only X errors. A Z error on any qubit is invisible and scrambles the logical state. Ch. 117 builds the phase-flip code (the Hadamard-conjugated cousin, which catches Z but misses X), and ch. 118 combines them into Shor's 9-qubit code, which handles any single-qubit error.

In 1995, Peter Shor was trying to prove that large-scale quantum computation was hopeless. Every noise source — a stray magnetic field, a thermal vibration, a photon from the environment — would accumulate errors at a rate that seemed to swamp any possible computation. Classical error correction, via repetition, could not be imported: you cannot copy a qubit, you cannot measure it without collapse, and the errors are continuous. The walls, as discussed in why QEC is hard, were three and tall.

Shor's great insight was that those walls had doors. A qubit can be encoded, not copied. A parity can be measured without revealing the state it is a parity of. And a continuous error collapses onto a discrete one the moment you measure. His 1995 paper — Scheme for reducing decoherence in quantum computer memory — demonstrated all three ideas in a single construction: the 9-qubit code. The 3-qubit bit-flip code is the simplest piece of that construction, isolated for pedagogical clarity. It protects against one specific kind of error — a Pauli X on a single physical qubit — and the protection is exact.

This chapter builds the code from scratch. You will see the encoding circuit and understand why it is not cloning. You will trace a bit-flip error through the syndrome measurement and verify by hand that the logical amplitudes survive. You will compute the failure probability and compare it to the classical repetition code. And you will see the honest limitation — that Z errors slip straight through — which motivates the phase-flip and Shor's codes that follow.

The encoding — one qubit into three, via two CNOTs

The bit-flip code encodes one logical qubit into three physical qubits. The two codewords (the "logical |0\rangle" and "logical |1\rangle") are

|0\rangle_L \;=\; |000\rangle, \qquad |1\rangle_L \;=\; |111\rangle.

A superposition \alpha|0\rangle + \beta|1\rangle encodes to

\alpha|0\rangle_L + \beta|1\rangle_L \;=\; \alpha|000\rangle + \beta|111\rangle.

The encoding circuit is almost embarrassingly simple. Start with the data qubit in state \alpha|0\rangle + \beta|1\rangle and two ancilla qubits in |0\rangle. Apply a CNOT with the data qubit as control and ancilla 1 as target; then a CNOT with the data qubit as control and ancilla 2 as target. That is the entire encoder.

Encoding circuit for the 3-qubit bit-flip codeThree horizontal qubit wires. Top wire labelled alpha |0⟩ plus beta |1⟩ for the data qubit. Middle and bottom wires labelled |0⟩ for the two ancillas. Two CNOT gates act in sequence with the top wire as control and each ancilla as target in turn, shown as filled dot on top wire connected by vertical line to plus-in-circle on the target wire. After both CNOTs the output is labelled alpha |000⟩ plus beta |111⟩. A small label on the left says input, a small label on the right says encoded logical qubit. $\alpha|0\rangle + \beta|1\rangle$ $|0\rangle$ $|0\rangle$ data anc 1 anc 2 CNOT$_{0 \to 1}$ CNOT$_{0 \to 2}$ encoded $\alpha|000\rangle$ $+$ $\beta|111\rangle$
The 3-qubit bit-flip encoding circuit. Two CNOTs with the data qubit as control flip the ancilla wires exactly when the data qubit is $|1\rangle$. The result is one entangled state $\alpha|000\rangle + \beta|111\rangle$ — one logical qubit spread across three physical qubits, not three copies.

Trace through the algebra to see why this works. The initial state is

(\alpha|0\rangle + \beta|1\rangle) \otimes |0\rangle \otimes |0\rangle \;=\; \alpha|000\rangle + \beta|100\rangle.

The first CNOT flips qubit 1 when qubit 0 is |1\rangle. On |000\rangle the control is |0\rangle, so qubit 1 stays |0\rangle; on |100\rangle the control is |1\rangle, so qubit 1 flips to |1\rangle. The state becomes

\alpha|000\rangle + \beta|110\rangle.

The second CNOT flips qubit 2 when qubit 0 is |1\rangle. Same argument: |000\rangle is untouched, |110\rangle becomes |111\rangle. Final state:

\alpha|000\rangle + \beta|111\rangle \;=\; \alpha|0\rangle_L + \beta|1\rangle_L.

Why this is not cloning

Every time a student sees this for the first time, the instinct is to say, "So you have made three copies of the data qubit." No, you have not — and the distinction matters. Cloning would produce

(\alpha|0\rangle + \beta|1\rangle)(\alpha|0\rangle + \beta|1\rangle)(\alpha|0\rangle + \beta|1\rangle),

which, expanded, has eight basis kets with coefficients \alpha^3, \alpha^2\beta, \alpha^2\beta, \alpha\beta^2, \alpha^2\beta, \alpha\beta^2, \alpha\beta^2, \beta^3. The encoding, by contrast, produces only two basis kets: \alpha|000\rangle + \beta|111\rangle. Why these are different states: the cloned state is a tensor product of three identical factors — every one of the eight three-qubit basis kets appears with the combinatorially appropriate weight. The encoded state is a sum of just the two "consensus" basis kets, with weights \alpha and \beta. Measure the first qubit of the cloned state: you get |0\rangle with probability |\alpha|^2, and the other two qubits are independently in \alpha|0\rangle + \beta|1\rangle each. Measure the first qubit of the encoded state: you get |0\rangle with probability |\alpha|^2, but the other two qubits are now perfectly correlated — both in |0\rangle. The encoded state's three qubits are entangled, not independent.

This distinction is the first insight that made quantum error correction possible. Copying is forbidden; entangling is allowed and in fact routine. The encoding circuit uses only unitary operations (initialisation and CNOTs), which quantum mechanics permits. The output is a single three-qubit entangled state, and all the "redundancy" that protects the logical bit lives in the correlations between the three physical qubits, not in any individual qubit.

The error model — a single bit-flip

Suppose each of the three physical qubits independently suffers a bit-flip (X) error with probability p. This is the independent bit-flip channel — an idealisation that captures the dominant error mode in many physical qubit implementations (spin flips, T1 decay on certain platforms). The eight possible error events and their probabilities are:

The code is designed to correct the four low-weight events — no error, or a single error on one of the three qubits. It cannot correct the multi-qubit events, but those have probability O(p^2) or O(p^3), so for small p they are rare.

Write out what happens to the encoded state under each of the four correctable error events.

Error Encoded state afterward
I \alpha|000\rangle + \beta|111\rangle
X_0 \alpha|100\rangle + \beta|011\rangle
X_1 \alpha|010\rangle + \beta|101\rangle
X_2 \alpha|001\rangle + \beta|110\rangle

Each single-qubit X error takes the state out of the code space — the two-dimensional subspace spanned by |000\rangle and |111\rangle — and into a different two-dimensional subspace. The four subspaces (one for no error, three for each single-qubit flip) are orthogonal and together span a large chunk of the eight-dimensional three-qubit Hilbert space. The plan is: detect which subspace the state is in, without measuring where in that subspace — and then apply the correction that maps it back.

Syndrome measurement — parity, not identity

Here is the trick. Rather than measure each qubit individually (which would collapse the superposition), measure two parity operators whose eigenvalues identify the error subspace but do not reveal \alpha or \beta.

The two parity operators for the bit-flip code are

S_1 \;=\; Z_0 Z_1 \;=\; Z \otimes Z \otimes I, \qquad S_2 \;=\; Z_0 Z_2 \;=\; Z \otimes I \otimes Z.

Z_0 Z_1 is "+1 if qubits 0 and 1 agree, -1 if they disagree"; Z_0 Z_2 is "+1 if qubits 0 and 2 agree, -1 if they disagree". Neither operator reveals the actual values of any qubit — only whether a pair agrees.

Why Z Z measures parity: Z|0\rangle = +|0\rangle and Z|1\rangle = -|1\rangle. Applied to a two-qubit state, ZZ|xy\rangle = (-1)^{x+y}|xy\rangle+1 if x and y are equal, -1 if different. The eigenvalue (-1)^{x+y} depends only on the parity x \oplus y, not on the individual values. Measuring ZZ projects onto the "same" subspace (eigenvalue +1, spanned by |00\rangle and |11\rangle) or the "different" subspace (eigenvalue -1, spanned by |01\rangle and |10\rangle).

Apply S_1 and S_2 to each of the four post-error states. For the no-error state \alpha|000\rangle + \beta|111\rangle:

Both basis kets give the same eigenvalues, so the whole superposition is a simultaneous +1 eigenstate of both S_1 and S_2. Measuring either returns +1 deterministically, and leaves the state unchanged. Why the state is unchanged: when you measure an observable on one of its eigenstates, the outcome is certain (the corresponding eigenvalue) and the state after measurement is the same eigenstate — no collapse, no reduction. The encoded superposition \alpha|000\rangle + \beta|111\rangle survives the S_1, S_2 measurement intact.

Now the state after an X_1 error: \alpha|010\rangle + \beta|101\rangle.

Both kets give (S_1, S_2) = (-1, +1) — again deterministic, the superposition is undisturbed. The error syndrome (-1, +1) uniquely identifies "bit-flip on qubit 1".

Repeat for the other two single-qubit errors. The complete syndrome table is:

Error State after error S_1 = Z_0 Z_1 S_2 = Z_0 Z_2
I \alpha|000\rangle + \beta|111\rangle +1 +1
X_0 \alpha|100\rangle + \beta|011\rangle -1 -1
X_1 \alpha|010\rangle + \beta|101\rangle -1 +1
X_2 \alpha|001\rangle + \beta|110\rangle +1 -1

Four distinct syndromes, four distinct (correctable) errors. The syndrome tells you exactly which physical qubit flipped, and the \alpha, \beta amplitudes are preserved throughout.

Syndrome table for the 3-qubit bit-flip codeFour box rows, each showing the four correctable errors. Column 1 is the error label I, X0, X1, X2. Column 2 shows the state after error. Column 3 shows the S1 eigenvalue. Column 4 shows the S2 eigenvalue. The rows are colour coded: the I row is accent (green), the three X rows are neutral. Each row has an arrow to a correction label X on the appropriate qubit. error state after error $(S_1, S_2)$ correction $I$ (no error) $\alpha|000\rangle + \beta|111\rangle$ $(+, +)$ do nothing $X_0$ $\alpha|100\rangle + \beta|011\rangle$ $(-, -)$ apply $X_0$ $X_1$ $\alpha|010\rangle + \beta|101\rangle$ $(-, +)$ apply $X_1$ $X_2$ $\alpha|001\rangle + \beta|110\rangle$ $(+, -)$ apply $X_2$ Four syndromes, four errors, unique mapping. The amplitudes $\alpha, \beta$ are untouched throughout.
The complete syndrome table for the 3-qubit bit-flip code. Each of the four correctable error events produces a distinct pair of eigenvalues $(S_1, S_2)$; reading that pair tells you which qubit to apply $X$ to in order to restore the logical state. The logical amplitudes $\alpha, \beta$ are preserved — only the error information is read.

Recovery — one X, and done

After reading the syndrome, you know exactly which physical qubit needs flipping back. Apply the matching X:

Since X^2 = I, applying X exactly undoes a previous X on the same qubit. The state returns to \alpha|000\rangle + \beta|111\rangle, and you are back in the code space with the original amplitudes.

To recover the logical qubit as a single physical qubit (for further computation or readout), apply the decoding circuit: the same two CNOTs in reverse order (CNOT 0 \to 2 then CNOT 0 \to 1). The state \alpha|000\rangle + \beta|111\rangle goes back to (\alpha|0\rangle + \beta|1\rangle)|0\rangle|0\rangle — the original data qubit, with the two ancillas returned to |0\rangle. The decoding is exact because the entire encode-error-syndrome-correct cycle has been unitary (plus the syndrome measurement, which returned deterministic results on the eigenstates).

Full encode-error-syndrome-correct pipelineA horizontal pipeline of four boxes. Box 1 labelled encode shows alpha |0⟩ plus beta |1⟩ going into an encoding circuit producing alpha |000⟩ plus beta |111⟩. Box 2 labelled error shows a single X on qubit 1 transforming the state to alpha |010⟩ plus beta |101⟩. Box 3 labelled syndrome shows S1 and S2 being measured, returning (-, +), identifying qubit 1 as the flipped qubit. Box 4 labelled recover shows X applied to qubit 1, restoring alpha |000⟩ plus beta |111⟩. Arrows connect the boxes. 1. Encode $\alpha|0\rangle + \beta|1\rangle$ $\downarrow$ 2 CNOTs $\alpha|000\rangle$ $+ \beta|111\rangle$ in code space 2. Error suppose $X_1$ fires $\downarrow$ $\alpha|010\rangle$ $+ \beta|101\rangle$ out of code space 3. Syndrome measure $S_1, S_2$ $\downarrow$ $(S_1, S_2) = (-, +)$ $\Rightarrow$ error on qubit 1 amplitudes preserved 4. Recover apply $X_1$ $\downarrow$ $\alpha|000\rangle$ $+ \beta|111\rangle$ back in code space End-to-end: error is corrected, $\alpha$ and $\beta$ are never measured. The code space acts as a protected subspace; errors knock you out and syndromes knock you back. This template — encode, error, syndrome, recover — is every quantum error-correcting code.
The complete pipeline of the 3-qubit bit-flip code, with a single $X$ error on qubit 1 as the illustrative case. Encoding puts the logical qubit in a protected subspace; the error knocks it out; syndrome measurement tells you how to knock it back without learning the encoded amplitudes; the correction restores the state. This four-step template is common to every quantum error-correcting code.

Failure probability and the quadratic suppression

The code corrects any single-qubit X error (four out of eight possible error events). It fails when two or three qubits flip — events with total probability

P_{\text{fail}} \;=\; 3 p^2 (1-p) + p^3 \;=\; 3p^2 - 2p^3.

For small p, P_{\text{fail}} \approx 3p^2. The unprotected qubit has failure probability p; the encoded logical qubit has failure probability \approx 3p^2. For p = 10^{-3}, this drops from 10^{-3} to 3 \times 10^{-6} — a factor-300 improvement.

This is the same quadratic suppression as the classical 3-bit repetition code. The formula is identical. What is quantum about the bit-flip code is how the suppression is achieved — via entangled encoding and parity measurement rather than via copies and direct reads — and what price is paid. The price is: the code only works for X errors. Any Z or Y error passes through undetected and uncorrected.

The honest limitation — Z errors are invisible

Apply a Z error to qubit 0 of the encoded state \alpha|000\rangle + \beta|111\rangle:

Z_0 (\alpha|000\rangle + \beta|111\rangle) \;=\; \alpha|000\rangle - \beta|111\rangle.

The relative phase between |0\rangle_L and |1\rangle_L has flipped: \beta \mapsto -\beta. This is a real error on the logical qubit — it turns |+\rangle_L = (|0\rangle_L + |1\rangle_L)/\sqrt 2 into |-\rangle_L = (|0\rangle_L - |1\rangle_L)/\sqrt 2, a completely different logical state.

Now measure the syndromes on \alpha|000\rangle - \beta|111\rangle:

The syndrome is (+, +) — identical to the "no error" syndrome. The bit-flip code has no idea a Z error happened. It would cheerfully declare "no correction needed" and leave the logical state corrupted.

Why the bit-flip code misses Z errors: the syndromes S_1, S_2 are built from Z operators, which commute with any single-qubit Z error. Commuting means they share eigenstates, so applying a Z error does not move the state between S_1/S_2 eigenspaces — and the syndromes report no change. The code detects errors only if they anticommute with at least one syndrome operator. X_i anticommutes with some Z_iZ_j (yes, detected); Z_i commutes with every Z_jZ_k (no, not detected).

This is why the bit-flip code on its own is not a useful quantum code. On real hardware, both X and Z errors occur at comparable rates; correcting only half of them is no better than correcting neither. The bit-flip code is a pedagogical building block, not a production code. The phase-flip code (ch. 117) handles Z errors by running the bit-flip code in the Hadamard-rotated basis. The Shor 9-qubit code (ch. 118) concatenates the two: phase-flip-encode each qubit of a bit-flip encoding, giving a 9-qubit code that corrects any single-qubit Pauli error. From the Shor code onward, quantum error correction becomes genuinely useful.

Worked examples

Example 1: encode $|+\rangle$, apply $X_1$, correct

Trace the full bit-flip code pipeline on the input |+\rangle = (|0\rangle + |1\rangle)/\sqrt 2 with a single X error on qubit 1.

Step 1. Encode. The input is |+\rangle = \tfrac{1}{\sqrt 2}(|0\rangle + |1\rangle), so \alpha = \beta = 1/\sqrt 2. Apply the two CNOTs:

|+\rangle|0\rangle|0\rangle \;=\; \tfrac{1}{\sqrt 2}(|0\rangle + |1\rangle)|0\rangle|0\rangle \;\xrightarrow{\text{CNOTs}}\; \tfrac{1}{\sqrt 2}(|000\rangle + |111\rangle) \;=\; |+\rangle_L.

Step 2. Error. Apply X_1 = I \otimes X \otimes I:

X_1 |+\rangle_L \;=\; \tfrac{1}{\sqrt 2}(X_1|000\rangle + X_1|111\rangle) \;=\; \tfrac{1}{\sqrt 2}(|010\rangle + |101\rangle).

Why X_1|000\rangle = |010\rangle: X flips |0\rangle \leftrightarrow |1\rangle on qubit 1; qubits 0 and 2 are untouched. So qubit 0 stays |0\rangle, qubit 1 flips to |1\rangle, qubit 2 stays |0\rangle. Similarly X_1|111\rangle = |101\rangle.

Step 3. Measure S_1 = Z_0 Z_1. On |010\rangle: Z_0|0\rangle = +|0\rangle, Z_1|1\rangle = -|1\rangle, product -1. On |101\rangle: Z_0|1\rangle = -|1\rangle, Z_1|0\rangle = +|0\rangle, product -1. Both kets give -1, so the measurement yields s_1 = -1 with probability 1 and the state is unchanged.

Step 4. Measure S_2 = Z_0 Z_2. On |010\rangle: Z_0 = +1, Z_2 = +1, product +1. On |101\rangle: Z_0 = -1, Z_2 = -1, product +1. Both kets give +1, so s_2 = +1 deterministic, state unchanged.

Step 5. Read syndrome. (s_1, s_2) = (-, +). Consult the table: error on qubit 1.

Step 6. Apply X_1. Since X^2 = I:

X_1 \cdot \tfrac{1}{\sqrt 2}(|010\rangle + |101\rangle) \;=\; \tfrac{1}{\sqrt 2}(X_1|010\rangle + X_1|101\rangle) \;=\; \tfrac{1}{\sqrt 2}(|000\rangle + |111\rangle) \;=\; |+\rangle_L.

Back to the encoded state, amplitudes exactly preserved.

Bit-flip code applied to $|+\rangle$ with $X_1$ errorA horizontal flow of amplitude-bar charts. Stage 1 labelled encoded shows two bars on basis states 000 and 111 both at height 1 over root 2. Stage 2 labelled after X1 shows two bars on basis states 010 and 101 both at height 1 over root 2. Stage 3 labelled syndrome measurement gives (-, +) but the amplitudes stay on 010 and 101. Stage 4 labelled after correction X1 shows amplitudes back on 000 and 111. encoded $|+\rangle_L$ 000 111 $1/\sqrt 2$ each $\to$ $X_1$ after $X_1$ error 010 101 $1/\sqrt 2$ each $\to$ measure syndrome $(-,+)$ 010 101 state unchanged $\to$ $X_1$ corrected 000 111 $|+\rangle_L$ restored The amplitudes (both $1/\sqrt 2$) survive the entire cycle. Only the error location is learned.
The amplitude distribution across the eight computational basis states, at four stages of the bit-flip correction cycle. The $X_1$ error shifts amplitude from $|000\rangle, |111\rangle$ to $|010\rangle, |101\rangle$; the syndrome measurement confirms the new location without changing the amplitudes; the correction $X_1$ shifts them back. Throughout, the two nonzero amplitudes are always equal — the encoded state is $|+\rangle_L$ at the start and end.

What this shows. The bit-flip code preserves an arbitrary superposition — here |+\rangle, a balanced superposition of |0\rangle and |1\rangle — against any single-qubit X error. The amplitudes \alpha = \beta = 1/\sqrt 2 are never read or modified; only the discrete error information (which qubit flipped) is extracted and acted upon. This is the essence of quantum error correction: protect the quantum information by reading around it, not through it.

Example 2: a $Z$ error slips through undetected

Apply a Z error to qubit 1 of the encoded state \alpha|000\rangle + \beta|111\rangle and show that the bit-flip code fails to detect it.

Step 1. Apply Z_1.

Z_1 (\alpha|000\rangle + \beta|111\rangle) \;=\; \alpha Z_1|000\rangle + \beta Z_1|111\rangle.

Z_1|000\rangle = |000\rangle (the middle qubit is |0\rangle, Z|0\rangle = +|0\rangle) and Z_1|111\rangle = -|111\rangle (the middle qubit is |1\rangle, Z|1\rangle = -|1\rangle). So

Z_1 |\psi\rangle_L \;=\; \alpha|000\rangle - \beta|111\rangle.

Step 2. Notice the logical effect. The relative phase between |0\rangle_L and |1\rangle_L has flipped: \beta \mapsto -\beta. This is equivalent to applying Z_L (logical Z) on the encoded qubit — the logical state \alpha|0\rangle + \beta|1\rangle has become \alpha|0\rangle - \beta|1\rangle, a physically different state (in particular, |+\rangle_L \mapsto |-\rangle_L).

Step 3. Measure S_1 = Z_0 Z_1.

S_1 (\alpha|000\rangle - \beta|111\rangle) \;=\; \alpha S_1|000\rangle - \beta S_1|111\rangle \;=\; +\alpha|000\rangle - (+)\beta|111\rangle \;=\; \alpha|000\rangle - \beta|111\rangle.

Eigenvalue +1. The state is unchanged.

Step 4. Measure S_2 = Z_0 Z_2. Same calculation: both |000\rangle and |111\rangle are +1 eigenstates of S_2. Eigenvalue +1.

Step 5. Read syndrome. (s_1, s_2) = (+, +) — the same syndrome as "no error". The bit-flip code concludes that nothing went wrong and applies no correction.

Step 6. The logical state is now wrong. After the non-correction, the state is still \alpha|000\rangle - \beta|111\rangle. Decoding (the reverse CNOTs) gives back (\alpha|0\rangle - \beta|1\rangle)|0\rangle|0\rangle. The logical qubit has been silently corrupted.

Result. The 3-qubit bit-flip code has a zero error rate on X errors (any single-qubit X is detected and corrected) but a 100% error rate on Z errors (any single-qubit Z is invisible and passes through to corrupt the logical state). Real hardware has both kinds of error at comparable rates, so the bit-flip code on its own is useless in practice. The phase-flip code (ch. 117) flips the story — it detects Z errors but misses X ones. The Shor 9-qubit code (ch. 118) combines them: each of 3 "outer" qubits is independently protected by a 3-qubit bit-flip code, and together the outer-code structure provides phase protection. Nine physical qubits, one logical qubit, any single-qubit error corrected.

Error-type asymmetry of the 3-qubit bit-flip codeTwo panels side by side. Left panel titled X errors: shows a check mark and the text detected and corrected, with syndrome entries listing X0, X1, X2 and their respective syndromes. Right panel titled Z errors: shows a cross and the text invisible to the code, with syndrome entries listing Z0, Z1, Z2 all mapping to the same plus plus syndrome as no error. $X$ errors — detected $X_0$ syndrome $(-, -)$ → fix $X_0$ $X_1$ syndrome $(-, +)$ → fix $X_1$ $X_2$ syndrome $(+, -)$ → fix $X_2$ 4 error cases, 4 distinct syndromes $Z$ errors — invisible $Z_0$ syndrome $(+, +)$ → no action $Z_1$ syndrome $(+, +)$ → no action $Z_2$ syndrome $(+, +)$ → no action all Z errors produce the "no error" syndrome The bit-flip code corrects bit-flips perfectly — and sees nothing else.
The asymmetry of the bit-flip code. Every single-qubit $X$ error has a distinct syndrome and is exactly corrected; every single-qubit $Z$ error produces the "no error" syndrome and slips through to corrupt the logical state. The code's job is to catch bit-flips, nothing more. The phase-flip code (ch. 117) inverts this — catches $Z$ but misses $X$ — and Shor's 9-qubit code combines both.

What this shows. The 3-qubit bit-flip code is an incomplete quantum error-correcting code. It handles only one of the two fundamental error types. Understanding exactly what it misses — and why — is what motivates the phase-flip code and then Shor's 9-qubit code. The machinery of syndrome measurement is the same in all three; what changes is which syndromes you measure.

Why this matters. The 3-qubit bit-flip code is the first worked example of the idea that made large-scale quantum computing conceivable. Every later code — the phase-flip code, the Shor 9-qubit code, the Steane code, the surface code, the colour code — is a refinement of the same four-step template: encode into an entangled subspace, accept errors that knock you out of the subspace, measure parity-like operators to identify the error, apply the matching correction. Shor's 1995 paper was not just a technical construction; it was an existence proof. Once you see the bit-flip code work, the question changes from "is quantum error correction possible?" to "what is the optimal overhead?" — a very different, and much more tractable, question.

Common confusions

Going deeper

If you came for the encoding circuit, the syndrome table, the end-to-end correction cycle, and the X-only limitation, you have the core. The rest of this section covers the stabiliser formalism preview (the code space as the +1 simultaneous eigenspace of \{S_1, S_2\}), the effect on continuous X rotations, the generalisation to n-qubit repetition codes, and fault-tolerant syndrome extraction with ancilla qubits — the practical issues real implementations face.

Stabiliser formalism preview

The 3-qubit bit-flip code is the simplest stabiliser code. A stabiliser code is defined by a set of commuting Pauli operators (the stabilisers) whose simultaneous +1 eigenspace is the code space. For this code, the stabilisers are S_1 = Z_0 Z_1 and S_2 = Z_0 Z_2; the code space is the two-dimensional subspace of states that are +1 eigenstates of both — the span of |000\rangle and |111\rangle.

Errors are detected by measuring the stabilisers. An error E is detected iff it anticommutes with some stabiliser — because anticommuting means ES_1 = -S_1 E, so applying E to a +1 eigenstate gives a -1 eigenstate, which the syndrome measurement reveals. X_i anticommutes with Z_j Z_k whenever i \in \{j, k\} — detected. Z_i commutes with every Z_j Z_k — undetected.

The logical operators are Pauli operators that commute with every stabiliser (so they map the code space to itself) but are not themselves stabilisers. For this code, Z_L = Z_0 Z_1 Z_2 is the logical Z (since Z_L|000\rangle = +|000\rangle and Z_L|111\rangle = -|111\rangle, as Z|0\rangle = +|0\rangle and Z|1\rangle = -|1\rangle) and X_L = X_0 X_1 X_2 is the logical X (mapping |000\rangle \leftrightarrow |111\rangle). The full stabiliser formalism is developed in stabilizer formalism intro (ch. 119).

Continuous X errors and discretisation

Suppose a noisy gate applies the unitary U = \exp(-i\theta X_1) — a small-angle rotation about the X axis on qubit 1 — to the encoded state. Then

U|\psi_L\rangle \;=\; \cos\theta \,|\psi_L\rangle - i\sin\theta \,X_1 |\psi_L\rangle.

This is a superposition of the no-error state and the "X on qubit 1" state. When the syndrome is measured:

Either way, after correction, the state is |\psi_L\rangle exactly. The continuous error has been projected to one of two discrete outcomes, both of which the code handles. The same argument works for any single-qubit unitary that is a combination of I and X_i: the syndrome discretises it to a "no error" or "X on qubit i" outcome.

For arbitrary single-qubit unitaries involving Y or Z — which the bit-flip code cannot correct — the discretisation still happens (the state collapses onto \{I, X_i, Y_i, Z_i\} eigenspaces), but the Y_i and Z_i outcomes are not in the correctable set and are missed by the bit-flip code. Shor's 9-qubit code enlarges the correctable set to all single-qubit Paulis.

Generalisation to n-qubit repetition

Nothing about the 3-qubit construction is special to the number three. For any odd n, you can define an n-qubit bit-flip code with codewords |0\rangle_L = |0 \cdots 0\rangle (n zeros) and |1\rangle_L = |1 \cdots 1\rangle. The stabilisers are the n - 1 independent parity operators Z_0 Z_1, Z_0 Z_2, \ldots, Z_0 Z_{n-1} (or any maximally independent subset). The code corrects up to \lfloor (n-1)/2 \rfloor simultaneous X errors, with failure probability O(p^{(n+1)/2}) for small p.

The same caveat applies: even large n does not buy any protection against Z errors. Classical information theory happens to live on the bit-flip axis, but quantum mechanics is two-dimensional (any combination of X and Z axes). You cannot escape the need for the phase-flip code — or, more efficiently, the Shor-style concatenation that handles both.

Fault-tolerant syndrome extraction

The account in this article has glossed over a practical issue: you cannot directly "measure Z_0 Z_1" the way you measure a single qubit. In real hardware, you introduce an ancilla qubit in the |0\rangle state, apply two CNOTs (from each of the data qubits to the ancilla), and then measure the ancilla in the computational basis. The ancilla outcome is 0 if the two data qubits agree (parity +1) and 1 if they disagree (parity -1).

The tricky part: if the CNOT gates themselves are noisy, the syndrome extraction can propagate errors between qubits. A single physical error during syndrome extraction can produce a two-qubit error on the data, which the distance-3 code cannot correct. Fault-tolerant syndrome extraction uses specifically engineered ancilla layouts (cat states, Steane-style reflection, flag qubits) to prevent this error propagation.

For the bit-flip code, the simplest fault-tolerant scheme uses two independent ancillas per stabiliser: the first extracts the syndrome, the second catches any error introduced during the first extraction. If the two ancillas disagree, the syndrome is discarded and the measurement is repeated. Real hardware (IBM, Google, Quantinuum) implements such schemes for distance-3 and distance-5 surface codes; the 3-qubit bit-flip code is rarely run on its own, but its logic appears inside every code on modern quantum hardware.

Indian QEC research context

Indian quantum-error-correction research is a real and growing programme within the National Quantum Mission (2023). Active groups include:

Early NMR-based demonstrations of error-correcting codes (including the 3-qubit bit-flip code and small Steane-code experiments) were published by Indian groups in the 2000s; the work was important historically for showing QEC works outside theory, even before superconducting and trapped-ion platforms dominated.

Where this leads next

References

  1. Peter Shor, Scheme for reducing decoherence in quantum computer memory (1995), Physical Review A — arXiv:quant-ph/9508027.
  2. Daniel Gottesman, Stabilizer codes and quantum error correction (PhD thesis, 1997) — arXiv:quant-ph/9705052.
  3. John Preskill, Lecture Notes on Quantum Computation, Ch. 7 (quantum error correction, with the bit-flip code as opening example) — theory.caltech.edu/~preskill/ph229.
  4. Nielsen and Chuang, Quantum Computation and Quantum Information (2010), §10.1–10.2 — Cambridge University Press.
  5. Wikipedia, Quantum error correction — overview with explicit discussion of the bit-flip code.
  6. Qiskit Textbook, Introduction to Quantum Error Correction using Repetition Codes — runnable code for the 3-qubit bit-flip example.