|q⟩ Bad Qubits

advanced · Physics · Stabilizer Formalism & CSS Codes

CSS Codes

The general stabilizer formalism is flexible but can be unwieldy. CSS codes, named for Calderbank, Shor, and Steane, are a structured subclass that builds a quantum code out of two classical linear codes. They separate XX-errors and ZZ-errors cleanly, inherit decades of classical coding theory, and include many of the most important quantum codes.

Recap: classical linear codes

A classical [n,k][n, k] binary linear code CC is a kk-dimensional subspace of F2n\mathbb{F}_2^n, specified by an (nk)×n(n-k) \times n parity-check matrix HH: a vector vv is a codeword iff Hv=0Hv = 0. The dual code CC^\perp is the set of vectors orthogonal to every codeword of CC. Its minimum distance dd — the smallest weight of a nonzero codeword — sets how many bit errors it corrects.

The CSS construction

Pick two classical codes CXC_X and CZC_Z with parity-check matrices HXH_X and HZH_Z, satisfying the CSS orthogonality condition

HXHZT=0(mod2).H_X\,H_Z^{\mathsf T} = 0 \pmod 2.

Then define a stabilizer code whose generators come in two flavors:

Because every generator is purely XX-type or purely ZZ-type, two same-type generators automatically commute. An XX-type and a ZZ-type generator commute iff the supporting rows of HXH_X and HZH_Z overlap in an even number of positions — which is exactly the condition HXHZT=0H_X H_Z^{\mathsf T} = 0. So the orthogonality condition is precisely what makes the stabilizer group abelian.

Code parameters

If HXH_X has rank rXr_X and HZH_Z has rank rZr_Z, the code uses rX+rZr_X + r_Z independent generators on nn qubits, encoding

k=nrXrZk = n - r_X - r_Z

logical qubits. The distance is governed by the classical codes: ZZ-errors are detected by the XX-stabilizers and corrected up to the distance properties of CXC_X, and vice versa for XX-errors.

Why CSS codes matter

CSS codes are the foundation of fault-tolerant quantum computing for several reasons:

Try it

Verify the CSS orthogonality condition for the Steane code, which sets HX=HZ=HH_X = H_Z = H where HH is the parity-check matrix of the classical [7,4][7,4] Hamming code. Compute HHTmod2H H^{\mathsf T} \bmod 2 and confirm it is the zero matrix — proving the stabilizer group is abelian.

Run your code to see the quantum state.

Sign in on the full site to ask questions and join the discussion.