Shor Code
The Shor code protects one qubit using nine physical qubits arranged in three blocks of three. Checks within a block locate bit flips; checks between blocks locate phase flips. Together they correct an arbitrary error on any one physical qubit, including coherent noise and noise coupled to an environment. This is the code introduced by Shor (1995).
Its most instructive feature is degeneracy: a phase flip on any of the three qubits in the same block has exactly the same effect on the encoded state. Recovery can reverse that effect without learning which qubit flipped. The discussion below assumes ideal encoding, check measurements, and corrections; noisy operations require the additional methods of fault tolerance.
Required background. Three-Qubit Codes explains bit- and phase-repetition encoding. Stabilizer Formalism supplies commuting Pauli checks, their syndromes, and code projectors.
Three blocks of cat states
Section titled “Three blocks of cat states”Use blocks , , and , with qubit 1 on the left in tensor strings. Define the normalized states
The logical basis is
These states are orthogonal because . Encoding maps an unknown to the superposition . It does not make nine copies of the input.
To see the construction, first encode into the phase-repetition states and . Encode each of these three qubits using and . Thus becomes and becomes . The outer encoding protects phase information; the inner encoding adds protection against bit flips.
Each component repetition code has full Pauli distance one: it protects against one type of error while leaving the other type unprotected. Consequently, multiplying two claimed distances of three is not a valid proof. We will prove the distance of the combined code directly.
Eight checks and two logical operators
Section titled “Eight checks and two logical operators”Let , with analogous definitions for and . Choose the checks
The first six check whether neighboring bits agree within each block. The last two compare the eigenvalues of neighboring blocks. Although a single anticommutes with a single , an outer check overlaps each inner check at zero or two sites, so all eight commute. They are independent and stabilize both logical basis states. Their common eigenspace therefore has dimension , with projector
This separate choice of all- and all- generators makes the Shor code a CSS code. The stabilizer description follows the general construction in Gottesman (1997).
The six solid brackets indicate checks. Each dashed bracket indicates an on every qubit of its two blocks. The checks compare relations within and between blocks; they do not measure the logical amplitudes and . Brackets show operator support, not a measurement circuit.
For the chosen logical basis,
A physical exchanges and in its block. One in every block therefore exchanges the logical basis states, which explains the name . Conversely, has eigenvalues and on and , so acts as logical . Physical Pauli letters do not determine logical Pauli names; their action on the chosen basis does. The two representatives anticommute and commute with all checks.
Decoding with two repetition rules
Section titled “Decoding with two repetition rules”Write a syndrome bit as for a check result and for a result. Arrange the syndrome as the three inner pairs followed by the outer pair:
An or error changes the inner pair in its block. A or error changes the outer pair. Both decoding steps use the same small table:
| Pair | Inner correction within that block | Outer phase correction |
|---|---|---|
| None | None | |
| on the first qubit | in block | |
| on the second qubit | in block | |
| on the third qubit | in block |
For example, an at the second position anticommutes with both adjacent checks, giving . A phase flip in block anticommutes with both outer checks, also giving . The same binary pattern describes two different comparisons, so keep track of which pair was measured.
Apply the inner corrections in each block, then the outer correction. Call the resulting Pauli . This specifies a recovery for all 256 syndromes, including those caused by several errors. It guarantees success for arbitrary one-qubit noise; success for larger errors depends on their pattern.
A worked Y error
Section titled “A worked Y error”Suppose occurs. Its syndrome is
The inner step applies and the outer step applies . Since , their combined action leaves
Every code state is a eigenstate of , so recovery restores the original state up to an irrelevant phase. It need not literally apply the same Pauli that caused the error.
The syndrome projectors and recovery channel are
Each has syndrome and takes its sector back to the code space. Because the projectors sum to , this channel preserves trace on the whole nine-qubit space. The syndrome-measurement page explains the associated measurement instrument and why retaining or discarding the classical result matters.
Why indistinguishable errors can be corrected
Section titled “Why indistinguishable errors can be corrected”Within block , the stabilizers imply
Thus these errors have both the same syndrome and the same action on every encoded state. Correction by reverses any of them. The same reasoning applies to blocks and . This is degeneracy, rather than a failure to measure enough information.
The identity and 27 single-qubit Paulis occupy
different syndrome sectors: one for the identity, nine each for and , and three for the blockwise classes. Each sector has dimension two, so these errors occupy 44 of the 512 Hilbert-space dimensions. The code is not a perfect packing such as the five-qubit code.
More formally, order the error operators as , the nine , the nine , and the nine . The Knill–Laflamme condition is
Here
where is the all-ones matrix. Its off-diagonal entries express the equality of the three phase errors in each block. The matrix has rank 22; it need not be diagonal for correction to work.
This condition corrects the linear span of the listed operators. For instance, a rotation is a combination of and and is corrected for every , not merely to first order. An arbitrary one-qubit interaction with an environment likewise expands in . The environment coefficients can be unknown and nonorthogonal. Logical-state independence of ensures that recovery preserves superpositions and entanglement with an untouched reference. See Why Quantum Error Correction Is Possible for the general argument.
The correctable span can also contain coherent sums of operators on different sites. This does not imply that every operator acting simultaneously on two qubits is correctable.
Distance three and errors that imitate one another
Section titled “Distance three and errors that imitate one another”Distance concerns a Pauli that commutes with all checks but acts nontrivially on the logical qubit. Global Pauli phases are ignored in this statement; a scalar such as is not a nontrivial logical operation.
Represent a Pauli, up to phase, by bit strings , where records an component and a component. Commutation with the inner checks forces to be constant within each block. An operator of weight at most two must therefore have .
Let be the parity of its support in the three blocks. Commutation with the outer checks gives . Weight at most two rules out three odd parities, so all are even. The only nonidentity possibilities are two operators in a single block, and these are stabilizers. Thus no nontrivial logical Pauli has weight one or two. The displayed weight-three and prove .
Every error on one physical qubit is consequently correctable. Every Pauli of weight two satisfies the detection condition , but a stabilizer has and raises no alarm: it does no damage to the encoded state.
Other weight-two errors can imitate weight-one errors while acting differently on the code:
| Actual error | Same syndrome as | Residual after the stated recovery |
|---|---|---|
For example, causes the decoder to apply , leaving . This ambiguity is different from degeneracy: and act identically on the code, whereas and differ by a logical operation. Returning to the code space alone does not establish successful recovery.
Independent depolarizing noise
Section titled “Independent depolarizing noise”For a concrete error-rate calculation, take independent noise on each qubit with
Here is the probability of a nonidentity Pauli; complete depolarization occurs at . Use the recovery specified by the two repetition rules, including its action on syndromes from multiple errors. The resulting logical channel is a Pauli channel, but generally not a depolarizing channel: the code and decoder treat the two logical axes differently.
There are weight-two Pauli strings. Their residual logical classes are
| Residual class | Number | Contribution at order |
|---|---|---|
| No logical error | ||
| Zero | ||
Thus the probability of a nonidentity logical Pauli is
The 36 logical- failures have two bit-flip components in one block. The 108 logical- failures have phase-flip components in two different blocks. Exercise 7 derives these counts. In particular, an isotropic physical Pauli distribution can produce anisotropic logical noise.
An exact calculation at larger can enumerate the Pauli strings. If counts strings of weight with residual logical class , then
This expression also explains two checks: , and because uniform physical Paulis give equally many strings in each logical class. Neither the small- coefficient nor the exact finite-code result is a fault-tolerance threshold. Noisy check extraction, correlations, and repeated correction change the problem.
Exercises
Section titled “Exercises”1. Read the logical operators from the codewords
Section titled “1. Read the logical operators from the codewords”Prove that the codewords are orthonormal and stabilized by all eight checks. Explain why the physical product represents logical , and the physical product represents logical .
Solution
Each cat state is normalized and their overlap vanishes, so the tensor products are orthonormal. Adjacent checks give on both and . Also . Each outer check multiplies two equal block eigenvalues, giving for either logical codeword.
The operator exchanges all three cat signs, so it exchanges and . The operator multiplies by and by . These are exactly the actions defining logical and logical . Their overlap at qubit 1 contributes one anticommutation.
2. Reconstruct the concatenated checks
Section titled “2. Reconstruct the concatenated checks”Starting from outer phase repetition and inner bit repetition, derive the two six-qubit checks. Why does this construction still require a separate distance argument?
Solution
The outer checks are and . Inner bit repetition replaces the of each outer qubit by the product of three physical operators. This yields and . The six inner checks are the two adjacent pairs in each block.
Each repetition code separately has a weight-one logical Pauli on its unprotected axis and therefore full distance one. Its ability to correct a particular type of error is insufficient for multiplying full quantum-code distances. The direct commutation argument above establishes the combined code’s distance three.
3. Apply the syndrome rule
Section titled “3. Apply the syndrome rule”Find the syndromes and recovery residuals for , , and . Use the specified two-stage decoder.
Solution
The syndromes are
The corrections are , , and . They leave , , and , respectively. Each acts as a scalar on the code. The phase in the third result has no effect on the recovered density operator.
4. Understand the degenerate error matrix
Section titled “4. Understand the degenerate error matrix”Derive the nonzero entries and eigenvalues of in the Knill–Laflamme condition. What does a zero eigenvalue mean here?
Solution
Each Pauli squared gives , so each diagonal entry is one. Distinct errors with different syndromes give zero projected cross terms. The exceptions are errors within one block: their products are stabilizers, giving off-diagonal entries one. Therefore .
Each has eigenvalues . Thus has nineteen eigenvalues one, three eigenvalues three, and six zero eigenvalues. A null direction such as annihilates the code. It expresses redundant error descriptions, not a lost logical state.
5. Correct a finite coherent rotation
Section titled “5. Correct a finite coherent rotation”Apply to an encoded state, possibly entangled with a reference. Show that syndrome measurement and correction restore it for every angle.
Solution
Let include the untouched reference. The two terms lie in the zero syndrome and the syndrome, so their probabilities are and , independent of the logical state. The zero branch requires no correction. In the second branch, ; hence the factor in cancels the residual and the branch is proportional to .
After discarding the syndrome, the output is
Linearity extends the result to mixed reference-entangled inputs. No small-angle approximation has been used.
6. Separate harmless degeneracy from a logical mistake
Section titled “6. Separate harmless degeneracy from a logical mistake”Compare , , and . Does distance three imply that all weight-two errors cause logical failure?
Solution
is a stabilizer and needs no correction. The two inner bit flips produce pair in block , causing correction and leaving . The two phase flips produce outer pair , causing correction and leaving .
Distance three guarantees correction of all weight-one errors and excludes lower-weight nontrivial logical operators. It does not require every larger error to fail. Some are stabilizers, and others happen to be reversed by the chosen decoder. Here 180 of the 324 weight-two Pauli strings have identity residual logical class.
7. Count the leading logical noise
Section titled “7. Count the leading logical noise”Derive the 36 and 108 weight-two failures in the table. Explain why no logical appears at this order. For an optional computational extension, enumerate all Pauli strings and check the uniform-noise limit.
Solution
A logical needs two bit-flip components in one block. Choose the block, a pair of sites, and either or at each site:
A logical needs phase-flip components in two distinct blocks. Choose two blocks, a site in each, and either or at each site:
With only two affected qubits, the first event requires the same block and the second requires different blocks. They cannot occur together, so there is no logical at weight two. Each particular weight-two Pauli has probability . Higher weights enter at order , giving
For the extension, compute each string’s syndrome, apply the two correction rules, and classify the residual by its commutation with and . Each of the four logical classes contains 65,536 strings. At all strings are equally probable, so three quarters produce a nonidentity logical Pauli. This exact limit does not justify using the leading approximation at large .
References
Section titled “References”- D. Gottesman, Stabilizer Codes and Quantum Error Correction, Ph.D. thesis, California Institute of Technology, 1997, doi:10.7907/rzr7-dt72, arXiv:quant-ph/9705052.
- E. Knill and R. Laflamme, “Theory of quantum error-correcting codes,” Physical Review A 55, 900–911, 1997, doi:10.1103/PhysRevA.55.900.
- P. W. Shor, “Scheme for reducing decoherence in quantum computer memory,” Physical Review A 52, R2493–R2496, 1995, doi:10.1103/PhysRevA.52.R2493.