A classical code can protect a string against bit flips. A quantum code must also protect relative phases, without measuring and destroying the encoded amplitudes. The CSS construction uses two compatible binary linear codes to separate these two tasks while preserving a quantum subspace.
Nested codes and encoded states
Definition 3.2.1
(Coset states of a nested pair)
Let be binary linear codes of dimensions . For each coset in , the coset state is
The CSS code space is the span of these states.
Replacing by another representative permutes the summands, so (1) depends only on the coset. Distinct cosets have disjoint computational-basis supports, so these states form an orthonormal family of size . Their span encodes logical qubits. Addition and inner products in this section are over .
For a binary vector , write and . The checks are
Theorem 3.2.2
(The checks cut out the code space)
The operators in (2) pairwise commute, and every coset state (1) has eigenvalue for each of them. The joint eigenspace of all the checks has dimension , so it equals the span of the coset states.
Proof
(Commutation, invariance and dimension count)
The Pauli commutation rule is . Since , every is orthogonal to every , so all checks commute. Applying permutes the terms of (1). Applying multiplies every term by , since . Hence all states in the encoded span have eigenvalue for every check.
Choose bases of and . Their checks are independent: a product can be a scalar identity only when . Every product of these checks is with no additional sign, and is absent. For an abelian stabilizer group without , the joint space of independent generators has dimension (this follows by taking the trace of their product of projectors). There are independent commuting checks, so their joint space has dimension . The coset states already have that dimension, so they span the entire code space.
Proof X-ray
Where each hypothesis enters the dimension count
The proof has three separate jobs, and each uses a different fact. Commutation uses only : if some were outside , there would be with , and then and would anticommute, so no common eigenvector of all checks could exist. Invariance uses the dual code for the checks: the phase is trivial because lies in , not in alone.
The non-obvious move is that the proof never verifies directly that the coset states span the joint eigenspace. It counts instead: the stabilizer group has elements and the formula gives the eigenspace dimension, which coincides with the number of orthonormal coset states. The count is valid only because is not in the group; if it were, the joint space would be zero. The argument closes because an orthonormal family inside a space of the same dimension must span it.
The coset-state description singles out the computational basis. A second description treats and symmetrically and makes the duality in (2) visible.
Concept lensAlgebraic
The same code seen after a Hadamard transform
Apply to (1). Using if and otherwise, and ,
This is a phase-weighted superposition over the dual code . Conjugation by exchanges and , so the checks become for and for . These are the checks (2) built from the nested pair , which encodes qubits, the same number as before.
Distances and what they protect
A Pauli error commutes with all checks precisely when and . It acts as a stabilizer, up to phase, precisely when and . The weights of the cheapest undetectable non-stabilizer errors define the two distances.
Definition 3.2.3
(X-type, Z-type and quantum distance)
Assume , so the encoded space is nontrivial. Let denote the least weight of a nontrivial -type logical operator and the analogous -type weight:
The quantum distance is .
Proposition 3.2.4
(Distance controls correctable errors)
Let be a nonnegative integer with . Then the CSS code corrects arbitrary errors on at most qubits.
Proof
(Normalizing Paulis of low weight are stabilizers)
Any nontrivial normalizing Pauli has either or , and its support is the union of the supports of and . Since and , its weight is at least or at least , hence at least . So a normalizing Pauli of weight less than is a stabilizer up to phase.
To verify the Knill–Laflamme condition, expand two errors supported on at most qubits in Pauli operators. Each product has weight at most . A Pauli term either anticommutes with some check , and then for the code projector , or it is a stabilizer up to phase and acts as a scalar. Thus is a scalar multiple of ; linearity covers arbitrary error operators.
The bound is tight in the other direction: a minimizing vector in (3) gives a pure or logical Pauli of exactly that weight, which acts nontrivially on the encoded state and cannot be detected by the checks.
Worked examples
Worked example 3.2.5
(The three-bit repetition code)
Take and . The encoded basis is . Here consists of even-weight vectors, so and can be used as checks. Formula (3) gives but , hence quantum distance . It corrects one bit flip with the usual recovery, but its distance does not guarantee correction of arbitrary one-qubit errors.
Worked example 3.2.6
(A nontrivial nested pair: the seven-qubit code)
Let be the binary matrix whose columns are the seven nonzero vectors of . Set and . Each row has four ones and two distinct rows overlap in two ones, so and . The rank of is three; hence , , and the construction encodes one qubit. There are independent checks, and matches .
No vector of weight one or two lies in : the columns are nonzero and distinct. Three columns sum to zero, giving a weight-three word in . Every nonzero row-space word has weight four, because a nonzero linear functional on is one on four vectors. Thus that weight-three word is not in . Moreover and , so . This is the seven-qubit CSS code and it corrects an arbitrary error on one qubit.
Worked example 3.2.7
(An edge case: equal codes encode no qubit)
Take . Then and there is a single coset state . The checks are (from ) and , (from , the even-weight vectors). That is independent checks on qubits, so the joint space has dimension , as the theorem predicts. Here is empty, so and are undefined: every normalizing Pauli is a stabilizer up to phase, so there is no logical operator whose weight could define a distance.
Common mistakes
The repetition code shows concretely why one classical distance cannot summarize a quantum code.
Counterexample mode
A classical distance alone is not quantum protection
Plausible claim: since the classical code has distance three, the repetition-code encoding corrects every single-qubit error. It does not. The operator commutes with both checks and , so no check detects it. On the code space it acts as , which changes the relative phase and is a weight-one logical operator. The claim is repaired by using . A large classical bit-flip distance does not by itself protect against phase errors.
Common mistake
(Taking the Z checks from C1 instead of its dual)
Using for is wrong. In the repetition example gives , which has eigenvalue on and on , so it does not fix the code space. The checks come from , which is orthogonal to all of and so acts trivially on every .
Common mistake
(Counting stabilizers as errors)
The -distance is a minimum over , not over all nonzero words of . For and , the word has weight one, but is itself a check, so it fixes every codeword and is harmless. The words in are and , so .
Practice with solutions
Quick check
(How many logical qubits are encoded when and ?)
Use the number of coset states.
Solution · Answer
Three. There are orthonormal coset states, which span a space of qubits.
Quick check
(Why must for the checks in (2) to commute?)
Compare an check and a check through the commutation rule.
Solution · Answer
It is sufficient because it makes every such inner product zero. Conversely, commutation for all pairs gives .
Quick check
(In the repetition example, what does do to the encoded basis?)
Write .
Solution · Answer
It swaps and , acting as logical .
Quick check
(Does distance guarantee correction of an arbitrary error on one qubit?)
Apply the distance criterion with .
Solution · Answer
Yes: , so the distance criterion applies.