Skip to main content
KetQat

Appearance

Topic · intermediate

Stabilizer Codes

Quantum codes defined as the joint +1 eigenspace of a commuting group of Pauli operators. The formalism turns code design, syndrome extraction, distance and Clifford simulation into linear algebra over the binary field.

ExpositionMachine-checkedUpdated 2026-12-01 · last verified 2026-12-01

AI-assisted text, machine-checked, not yet reviewed by a person. Citations resolve and an automated pass compared the statements with the cited sources. That is not peer review; check the sources for anything you depend on.

Overview

A stabilizer code stores kk logical qubits in nn physical qubits as the common +1+1 eigenspace of n−kn - k commuting, independent Pauli operators. These operators, the stabilizer generators, play the role of the parity checks of a classical linear code: measuring them yields a syndrome that identifies an error without revealing the encoded state. Almost every code used in practice — the Shor, Steane and five-qubit codes, surface codes, color codes and quantum LDPC codes — is a stabilizer code.

The formalism was developed by Gottesman and, in the language of binary symplectic geometry, by Calderbank, Rains, Shor and Sloane. Its value is that the general theory of quantum error correction becomes concrete: the Knill–Laflamme conditions become commutation checks, the code distance becomes a minimum weight, and circuits of Clifford gates acting on such codes can be simulated efficiently on a classical computer.

Intuition

Start with the three-qubit bit-flip code, spanned by ∣000⟩\ket{000} and ∣111⟩\ket{111}. Both states are left unchanged by Z1Z2Z_1 Z_2 and by Z2Z3Z_2 Z_3, and they are the only states (up to superposition) with that property. So the code can be defined by these two operators instead of by its basis states. An error X1X_1 anticommutes with Z1Z2Z_1 Z_2 and commutes with Z2Z3Z_2 Z_3; after the error, measuring the two operators gives (−1,+1)(-1, +1), which points to qubit 1. The measurement only asks "which of the commuting checks did the error flip?", a question with the same answer for every encoded state, so it does not disturb the superposition.

Three observations make this a general method.

  • Commuting checks have joint eigenspaces. Any set of commuting Pauli operators can be measured together, and each independent check halves the space: n−kn - k checks on nn qubits leave 2k2^k dimensions.
  • Pauli errors either commute or anticommute with each check. So each check reports one bit, and an error's syndrome is a linear function of the error.
  • Some errors are invisible. A Pauli operator that commutes with every check but is not itself a product of checks changes the encoded information undetectably. Such operators are the logical operators, and the smallest number of qubits one acts on is the distance.

The lesson The stabilizer formalism works through these ideas with circuits; The repetition code is the simplest instance.

Prerequisites

The Knill–Laflamme conditions and code parameters from Quantum Error Correction; linear codes, parity-check matrices and dual codes from Classical Error-Correcting Codes; linear algebra over F2\F_2.

Mathematical Definitions

Everything rests on the Pauli group and its identification, modulo phases, with the binary vector space F22n\F_2^{2n}, in which commutation is measured by the symplectic inner product.

DefinitionPauli group and its binary representationEstablished definition

The single-qubit Pauli matrices are

I=(1001),X=(0110),Y=(0−ii0),Z=(100−1),I = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}, \quad X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \quad Y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}, \quad Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix},

with XY=iZXY = iZ, YZ=iXYZ = iX, ZX=iYZX = iY, and any two distinct non-identity Pauli matrices anticommute. The nn-qubit Pauli group is

Pn={ ic P1⊗P2⊗⋯⊗Pn  :  c∈{0,1,2,3}, Pj∈{I,X,Y,Z} },\mathcal{P}_n = \bigl\{\, i^{c}\, P_1 \otimes P_2 \otimes \cdots \otimes P_n \;:\; c \in \{0,1,2,3\},\ P_j \in \{I, X, Y, Z\} \,\bigr\},

a group of order 4n+14^{n+1} under matrix multiplication. Subscripts name the qubit acted on: XjX_j is XX on qubit jj and II elsewhere. The support of P=icP1⊗⋯⊗PnP = i^c P_1 \otimes \cdots \otimes P_n is { j:Pj≠I }\{\, j : P_j \ne I \,\} and its weight wt⁡(P)\operatorname{wt}(P) is the size of the support.

Binary representation. For a,b∈F2na, b \in \F_2^n put XaZb=⨂jXajZbjX^{a} Z^{b} = \bigotimes_{j} X^{a_j} Z^{b_j}. Every element of Pn\mathcal{P}_n equals icXaZbi^{c} X^{a} Z^{b} for a unique c∈Z4c \in \Z_4 and a unique pair (a,b)(a, b), and the map

Pn→F22n,icXaZb↦(a∣b)\mathcal{P}_n \to \F_2^{2n}, \qquad i^{c} X^{a} Z^{b} \mapsto (a \mid b)

is a surjective group homomorphism with kernel {±I,±iI}\{\pm I, \pm iI\}. It identifies Pn/{±I,±iI}\mathcal{P}_n / \{\pm I, \pm iI\} with F22n\F_2^{2n}: multiplying Pauli operators adds their vectors. On one qubit, I↦(0∣0)I \mapsto (0 \mid 0), X↦(1∣0)X \mapsto (1 \mid 0), Z↦(0∣1)Z \mapsto (0 \mid 1) and Y=iXZ↦(1∣1)Y = iXZ \mapsto (1 \mid 1). The weight of PP is the symplectic weight of its vector.

Commutation. For P↦uP \mapsto u and Q↦vQ \mapsto v,

PQ=(−1)⟨u,v⟩s QP,P Q = (-1)^{\langle u, v \rangle_s}\, Q P ,

where ⟨⋅,⋅⟩s\langle \cdot, \cdot \rangle_s is the symplectic inner product. Indeed XaZbX^{a} Z^{b} and Xa′Zb′X^{a'} Z^{b'} differ by commuting ZbZ^{b} past Xa′X^{a'} and Zb′Z^{b'} past XaX^{a}, which costs a sign (−1)b⋅a′(-1)^{b \cdot a'} and (−1)b′⋅a(-1)^{b' \cdot a} respectively. Any two Pauli operators therefore either commute or anticommute.

A list of mm Pauli operators is written as an m×2nm \times 2n binary matrix whose rows are their vectors, the check matrix; signs are recorded separately. Every element of Pn\mathcal{P}_n is unitary, and it is Hermitian exactly when its phase is ±1\pm 1 in the form ±P1⊗⋯⊗Pn\pm P_1 \otimes \cdots \otimes P_n, in which case it squares to II. This representation is the one used by Gottesman and by Calderbank, Rains, Shor and Sloane; a textbook treatment is section 10.5 of Nielsen and Chuang.

DefinitionStabilizer codeEstablished definition

A stabilizer group on nn qubits is a subgroup SS of the Pauli group Pn\mathcal{P}_n that is abelian and does not contain −I-I. The stabilizer code of SS is

C(S)={ ∣ψ⟩∈(C2)⊗n  :  s∣ψ⟩=∣ψ⟩  for every s∈S }.C(S) = \bigl\{\, \ket{\psi} \in (\C^2)^{\otimes n} \;:\; s \ket{\psi} = \ket{\psi} \ \text{ for every } s \in S \,\bigr\} .

Because −I∉S-I \notin S, every element of SS has the form ±P1⊗⋯⊗Pn\pm P_1 \otimes \cdots \otimes P_n (an element ±iP\pm i P would square to −I-I), so it is Hermitian with eigenvalues ±1\pm 1. A set g1,…,grg_1, \dots, g_r of generators is independent if no gjg_j is a product of the others; equivalently, their binary vectors are linearly independent in F22n\F_2^{2n}. Then ∣S∣=2r\abs{S} = 2^{r}, and with r=n−kr = n - k the code has dimension 2k2^{k} (dimension theorem): it is an [[n,k]][[n, k]] code.

Syndrome. For a Pauli operator EE, the syndrome with respect to the generators is the vector σ(E)∈F2 n−k\sigma(E) \in \F_2^{\,n-k} with gjE=(−1)σj(E)Egjg_j E = (-1)^{\sigma_j(E)} E g_j. If ∣ψ⟩∈C(S)\ket{\psi} \in C(S) then E∣ψ⟩E\ket{\psi} is an eigenvector of every gjg_j with eigenvalue (−1)σj(E)(-1)^{\sigma_j(E)}, so measuring the generators reveals σ(E)\sigma(E) and nothing about ∣ψ⟩\ket{\psi}.

Normalizer and logical operators. The centralizer Z(S)={ P∈Pn:Ps=sP for all s∈S }Z(S) = \{\, P \in \mathcal{P}_n : P s = s P \text{ for all } s \in S \,\} is the set of Pauli operators with zero syndrome. Since two Pauli operators commute or anticommute, and −s∉S-s \notin S for s∈Ss \in S, it equals the normalizer N(S)={ P:PSP†=S }N(S) = \{\, P : P S P\dagg = S \,\}; both names are used. Elements of N(S)N(S) map C(S)C(S) to itself. Those in SS, up to phase, act trivially on it; those in N(S)∖⟨iI⟩SN(S) \setminus \langle iI \rangle S are nontrivial logical operators: they preserve the code space and act on it as a non-identity operator. The quotient N(S)/⟨iI⟩SN(S) / \langle iI \rangle S is isomorphic to the kk-qubit Pauli group modulo phases, and one can choose logical operators Xˉ1,Zˉ1,…,Xˉk,Zˉk\bar X_1, \bar Z_1, \dots, \bar X_k, \bar Z_k in N(S)N(S) that obey the commutation relations of X1,Z1,…,Xk,ZkX_1, Z_1, \dots, X_k, Z_k.

Distance. For k≥1k \ge 1 the distance dd of the code is the minimum weight of an element of N(S)∖⟨iI⟩SN(S) \setminus \langle iI \rangle S; the distance theorem shows that this agrees with the general definition of the distance of a quantum code. The code is degenerate if SS contains a non-identity element of weight less than dd. The parameters are written [[n,k,d]][[n, k, d]].

In the binary representation, SS becomes an isotropic subspace S⊆F22n\mathcal{S} \subseteq \F_2^{2n} of dimension n−kn - k and N(S)N(S) becomes its symplectic complement S⊥s\mathcal{S}^{\perp_s}, of dimension n+kn + k. A matrix whose rows span S\mathcal{S} is a check matrix of the code. The formalism is due to Gottesman and, in the language of orthogonal geometry, to Calderbank, Rains, Shor and Sloane.

DefinitionClifford groupEstablished definition

The Clifford group on nn qubits is

Cn={ U∈U(2n)  :  UPnU†=Pn }/ U(1),\mathcal{C}_n = \bigl\{\, U \in \mathrm{U}(2^n) \;:\; U \mathcal{P}_n U\dagg = \mathcal{P}_n \,\bigr\} \big/ \, \mathrm{U}(1) ,

the normalizer of the Pauli group in the unitary group, with unitaries that differ by a global phase identified. Its elements are Clifford gates, and a circuit made of them is a Clifford circuit.

Generators. With H=12(111−1)H = \tfrac{1}{\sqrt 2}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}, S=diag⁡(1,i)S = \operatorname{diag}(1, i) and CNOT\mathrm{CNOT}, the conjugation rules are

gate X↦X \mapsto Z↦Z \mapsto
HH ZZ XX
SS YY ZZ
CNOTc→t\mathrm{CNOT}_{c \to t} Xc↦XcXtX_c \mapsto X_c X_t, Xt↦XtX_t \mapsto X_t Zc↦ZcZ_c \mapsto Z_c, Zt↦ZcZtZ_t \mapsto Z_c Z_t

and every element of Cn\mathcal{C}_n is a product of HH, SS and CNOT\mathrm{CNOT} gates on the nn qubits, up to a global phase (Gottesman; section 10.5.2 of Nielsen and Chuang). The CNOT row shows how errors spread: an XX error on the control is copied to the target, and a ZZ error on the target is copied to the control.

Symplectic action. A Clifford gate UU maps XaZbX^{a} Z^{b} to ±Xa′Zb′\pm X^{a'} Z^{b'} (up to the phase convention for YY), and (a∣b)↦(a′∣b′)(a \mid b) \mapsto (a' \mid b') is a linear map of F22n\F_2^{2n} that preserves the symplectic inner product, because conjugation preserves commutation. This gives a surjective homomorphism from Cn\mathcal{C}_n onto the symplectic group Sp(2n,2)\mathrm{Sp}(2n, 2) whose kernel consists of the Pauli operators themselves; a Clifford gate is therefore specified, up to phase, by a 2n×2n2n \times 2n binary symplectic matrix together with 2n2n sign bits (Calderbank, Rains, Shor and Sloane; Dehaene and De Moor).

Uses. Clifford gates map stabilizer groups to stabilizer groups, so they map stabilizer codes to stabilizer codes and stabilizer states to stabilizer states; every stabilizer code has an encoding circuit made of Clifford gates (Gottesman). The Clifford group is the second level of the Clifford hierarchy, and Clifford circuits alone are classically simulable by the Gottesman–Knill theorem.

A stabilizer state is the case k=0k = 0: a single state fixed by nn independent commuting Pauli operators. Mixtures of such states and the operations that preserve them are the free objects of the resource theory of magic (stabilizer operations).

Theorems

The first result is the counting that justifies calling the code [[n,k]][[n, k]].

TheoremDimension of a stabilizer codeEstablished result

Let SS be a stabilizer group on nn qubits with independent generators g1,…,gn−kg_1, \dots, g_{n-k}. For each σ∈F2 n−k\sigma \in \F_2^{\,n-k} let

Vσ={ ∣ψ⟩:gj∣ψ⟩=(−1)σj∣ψ⟩  for j=1,…,n−k }.V_\sigma = \bigl\{\, \ket{\psi} : g_j \ket{\psi} = (-1)^{\sigma_j} \ket{\psi} \ \text{ for } j = 1, \dots, n-k \,\bigr\} .

Then dim⁡Vσ=2k\dim V_\sigma = 2^{k} for every σ\sigma, the subspaces VσV_\sigma are mutually orthogonal, and

(C2)⊗n=⨁σ∈F2 n−kVσ.(\C^2)^{\otimes n} = \bigoplus_{\sigma \in \F_2^{\,n-k}} V_\sigma .

In particular the stabilizer code C(S)=V0C(S) = V_0 has dimension 2k2^k and encodes kk qubits, and a Pauli operator EE with syndrome σ(E)\sigma(E) maps V0V_0 unitarily onto Vσ(E)V_{\sigma(E)}. The orthogonal projector onto C(S)C(S) is the stabilizer-code projector.

The statement is in Gottesman and, for the code space, Proposition 10.5 of Nielsen and Chuang.

Holds when
  • S≤PnS \le \mathcal{P}_n is abelian and −I∉S-I \notin S.
  • SS is generated by n−kn - k independent elements g1,…,gn−kg_1, \dots, g_{n-k}, 0≤k≤n0 \le k \le n.
Proof · Proof of the dimension of a stabilizer code

Put r=n−kr = n - k.

Step 1: the generators are commuting Hermitian involutions. Each gjg_j lies in SS, which does not contain −I-I. An element of Pn\mathcal{P}_n with phase ±i\pm i squares to −I-I, so gj=±P1⊗⋯⊗Png_j = \pm P_1 \otimes \cdots \otimes P_n, which is Hermitian with gj2=Ig_j^2 = I. Hence Πj±=12(I±gj)\Pi_j^{\pm} = \tfrac12 (I \pm g_j) are the projectors onto the ±1\pm 1 eigenspaces of gjg_j, and since the gjg_j commute these projectors commute.

Step 2: the syndrome projectors. The projector onto VσV_\sigma is

Πσ=∏j=1rI+(−1)σjgj2=12r∑x∈F2r(−1)σ⋅x g1x1g2x2⋯grxr.\Pi_\sigma = \prod_{j=1}^{r} \frac{I + (-1)^{\sigma_j} g_j}{2} = \frac{1}{2^{r}} \sum_{x \in \F_2^{r}} (-1)^{\sigma \cdot x}\, g_1^{x_1} g_2^{x_2} \cdots g_r^{x_r} .

For σ≠σ′\sigma \ne \sigma' some factor appears as Πj+\Pi_j^{+} in one product and Πj−\Pi_j^{-} in the other, and Πj+Πj−=0\Pi_j^{+} \Pi_j^{-} = 0, so ΠσΠσ′=0\Pi_\sigma \Pi_{\sigma'} = 0. Summing over σ\sigma, each factor contributes Πj++Πj−=I\Pi_j^{+} + \Pi_j^{-} = I, so ∑σΠσ=I\sum_\sigma \Pi_\sigma = I. This gives the orthogonal direct sum.

Step 3: non-identity products are traceless. Let x≠0x \ne 0 and s=g1x1⋯grxrs = g_1^{x_1} \cdots g_r^{x_r}. Its binary vector is ∑jxjvj\sum_j x_j v_j, where vjv_j is the vector of gjg_j, and this is nonzero because the vjv_j are linearly independent. So s=±P1⊗⋯⊗Pns = \pm P_1 \otimes \cdots \otimes P_n with at least one Pm≠IP_m \ne I, and Tr⁡s=±∏mTr⁡Pm=0\tr s = \pm \prod_m \tr P_m = 0 because Tr⁡X=Tr⁡Y=Tr⁡Z=0\tr X = \tr Y = \tr Z = 0. For x=0x = 0 the product is II, with trace 2n2^n.

Step 4: count. Taking the trace of the expansion in Step 2,

dim⁡Vσ=Tr⁡Πσ=12r 2n=2 n−r=2k.\dim V_\sigma = \tr \Pi_\sigma = \frac{1}{2^{r}}\, 2^{n} = 2^{\,n-r} = 2^{k} .

Step 5: Pauli errors permute the syndrome spaces. If E∈PnE \in \mathcal{P}_n has syndrome σ(E)\sigma(E), then gjE=(−1)σj(E)Egjg_j E = (-1)^{\sigma_j(E)} E g_j, so for ∣ψ⟩∈V0\ket{\psi} \in V_0 we get gjE∣ψ⟩=(−1)σj(E)E∣ψ⟩g_j E \ket{\psi} = (-1)^{\sigma_j(E)} E \ket{\psi}. Thus the unitary EE maps V0V_0 into Vσ(E)V_{\sigma(E)}, and since both have dimension 2k2^k it maps it onto. Every syndrome occurs: by linear independence the map v↦(⟨v,vj⟩s)jv \mapsto (\langle v, v_j \rangle_s)_j from F22n\F_2^{2n} to F2r\F_2^{r} is surjective, so for every σ\sigma there is a Pauli operator with syndrome σ\sigma. This last fact is not needed for the dimension count but confirms that no VσV_\sigma is special.

The dimension 2k2^k is stated in Section 3.2 of Gottesman; the trace computation above is a standard way to prove it. Compare the proof of Proposition 10.5 in Nielsen and Chuang.

EquationProjector onto a stabilizer codeEstablished result
P  =  ∏j=1n−kI+gj2  =  1∣S∣∑s∈SsP \;=\; \prod_{j=1}^{n-k} \frac{I + g_j}{2} \;=\; \frac{1}{\abs{S}} \sum_{s \in S} s

The second equality is the expansion of the product, in which each subset of generators contributes one group element, and every element of SS arises from exactly one subset. Taking the trace gives Tr⁡P=2k\tr P = 2^k (see the dimension theorem). The formula is used to evaluate PEPP E P in the Knill–Laflamme conditions: for a Pauli operator EE, PEP=0P E P = 0 when EE anticommutes with some element of SS, and PEP=EPP E P = E P when it commutes with all of them. It also shows that PP commutes with every element of the normalizer of SS, since conjugation by such an element permutes the terms of the sum (Gottesman).

Holds when
  • S≤PnS \le \mathcal{P}_n abelian, −I∉S-I \notin S, with independent generators g1,…,gn−kg_1, \dots, g_{n-k}, so ∣S∣=2 n−k\abs{S} = 2^{\,n-k}.

The second translates the Knill–Laflamme conditions into the language of the normalizer. It is the reason a stabilizer code's distance can be read off from its check matrix.

TheoremError correction and distance of stabilizer codesEstablished result

Let C(S)C(S) be a stabilizer code with stabilizer group SS, normalizer N(S)N(S) and k≥1k \ge 1, and write ⟨iI⟩S\langle iI \rangle S for SS together with its multiples by ±1,±i\pm 1, \pm i.

  1. Single operators. For E∈PnE \in \mathcal{P}_n, PEPP E P is proportional to PP if and only if E∉N(S)∖⟨iI⟩SE \notin N(S) \setminus \langle iI \rangle S. More precisely, PEP=0P E P = 0 if E∉N(S)E \notin N(S), PEP=λPP E P = \lambda P with ∣λ∣=1\abs{\lambda} = 1 if E∈⟨iI⟩SE \in \langle iI \rangle S, and PEPP E P is not a multiple of PP otherwise.
  2. Correctable sets. A set {Ea}⊆Pn\{E_a\} \subseteq \mathcal{P}_n is correctable (satisfies the Knill–Laflamme conditions) if and only if Ea†Eb∉N(S)∖⟨iI⟩SE_a\dagg E_b \notin N(S) \setminus \langle iI \rangle S for all a,ba, b.
  3. Distance. The distance of C(S)C(S) equals
d=min⁡{ wt⁡(E)  :  E∈N(S)∖⟨iI⟩S }.d = \min \bigl\{\, \operatorname{wt}(E) \;:\; E \in N(S) \setminus \langle iI \rangle S \,\bigr\} .
  1. Syndrome decoding. Let t=⌊(d−1)/2⌋t = \lfloor (d-1)/2 \rfloor. The recovery that measures the syndrome σ\sigma and applies a fixed Pauli operator RσR_\sigma of minimum weight among those with syndrome σ\sigma returns every state E∣ψ⟩E \ket{\psi}, ∣ψ⟩∈C(S)\ket{\psi} \in C(S), wt⁡(E)≤t\operatorname{wt}(E) \le t, to ∣ψ⟩\ket{\psi} up to a global phase.

Item 3 is how distances of stabilizer codes are defined and computed in practice (Gottesman; Theorem 10.8 and the surrounding discussion in Nielsen and Chuang). Item 4 needs no knowledge of which error occurred beyond its syndrome: two errors of weight at most tt with the same syndrome differ by an element of ⟨iI⟩S\langle iI \rangle S.

Holds when
  • C(S)C(S) is an [[n,k]][[n, k]] stabilizer code with k≥1k \ge 1 and projector PP.
  • The errors EaE_a are elements of the Pauli group Pn\mathcal{P}_n; general errors are handled by linearity.
  • Distance is meant in the general sense, the smallest support of an operator EE with PEPP E P not proportional to PP.
Proof · Proof of the error-correction condition for stabilizer codes

Let g1,…,gn−kg_1, \dots, g_{n-k} be independent generators of SS and P=∏j12(I+gj)P = \prod_j \tfrac12 (I + g_j) the code projector.

Item 1. Case E∉N(S)E \notin N(S). Then EE anticommutes with some generator gg. Since gP=Pg=Pg P = P g = P,

PEP=PEgP=−PgEP=−PEP,P E P = P E g P = - P g E P = - P E P ,

so PEP=0P E P = 0.

Case E∈N(S)E \in N(S). Then EE commutes with every generator, hence with PP, so PEP=EPP E P = E P. If E=λsE = \lambda s with s∈Ss \in S and ∣λ∣=1\abs{\lambda} = 1, then EP=λPE P = \lambda P.

Case E∈N(S)∖⟨iI⟩SE \in N(S) \setminus \langle iI \rangle S. In the binary representation the vector ee of EE lies in S⊥s\mathcal{S}^{\perp_s} but not in S\mathcal{S}, where S\mathcal{S} is the span of the generator vectors. Because the symplectic form is nondegenerate, (S⊥s)⊥s=S(\mathcal{S}^{\perp_s})^{\perp_s} = \mathcal{S}, so there is a vector q∈S⊥sq \in \mathcal{S}^{\perp_s} with ⟨e,q⟩s=1\langle e, q \rangle_s = 1. Let QQ be a Pauli operator with vector qq. Then Q∈N(S)Q \in N(S), so QQ commutes with PP, and QE=−EQQ E = - E Q. Suppose PEP=cPP E P = c P. Then

cP=PEP=PQ†QEP=−PQ†EQP=−Q†(PEP)Q=−c Q†PQ=−cP,c P = P E P = P Q\dagg Q E P = - P Q\dagg E Q P = - Q\dagg (P E P) Q = - c\, Q\dagg P Q = - c P ,

so c=0c = 0 and EP=PEP=0E P = P E P = 0. But EE is unitary and P≠0P \ne 0, so EP≠0E P \ne 0, a contradiction. Hence PEPP E P is not a multiple of PP.

Item 2. By item 1 applied to E=Ea†Eb∈PnE = E_a\dagg E_b \in \mathcal{P}_n, the condition PEa†EbP=cabPP E_a\dagg E_b P = c_{ab} P holds for every pair exactly when no product Ea†EbE_a\dagg E_b lies in N(S)∖⟨iI⟩SN(S) \setminus \langle iI \rangle S. The Knill–Laflamme theorem turns this into correctability.

Item 3. Let d′d' be the minimum weight in N(S)∖⟨iI⟩SN(S) \setminus \langle iI \rangle S; it exists because k≥1k \ge 1 makes this set nonempty. A minimum-weight element EE is an operator on d′d' qubits with PEP∝̸PP E P \not\propto P by item 1, so the distance is at most d′d'. Conversely, let FF be any operator supported on a set AA of fewer than d′d' qubits. The Pauli operators supported in AA span all operators on AA, so F=∑αfαEαF = \sum_\alpha f_\alpha E_\alpha with each EαE_\alpha a Pauli operator of weight less than d′d'. No such EαE_\alpha lies in N(S)∖⟨iI⟩SN(S) \setminus \langle iI \rangle S, so by item 1 each PEαPP E_\alpha P is a multiple of PP, and so is PFPP F P. Hence the distance is at least d′d'.

Item 4. Let wt⁡(E)≤t\operatorname{wt}(E) \le t and σ=σ(E)\sigma = \sigma(E). The fixed correction RσR_\sigma has syndrome σ\sigma and weight at most wt⁡(E)≤t\operatorname{wt}(E) \le t, by minimality. Then Rσ†ER_\sigma\dagg E has zero syndrome, so it lies in N(S)N(S), and its weight is at most 2t≤d−1<d2t \le d - 1 < d, so by item 3 it lies in ⟨iI⟩S\langle iI \rangle S. Measuring the generators on E∣ψ⟩E \ket{\psi} yields σ\sigma with certainty and leaves the state unchanged (dimension theorem, step 5), and Rσ†E∣ψ⟩=λ∣ψ⟩R_\sigma\dagg E \ket{\psi} = \lambda \ket{\psi} with ∣λ∣=1\abs{\lambda} = 1. Applying Rσ†R_\sigma\dagg (a Pauli operator, equal to RσR_\sigma up to phase) therefore restores ∣ψ⟩\ket{\psi} up to a global phase. Since the Pauli operators of weight at most tt form a correctable set by item 2, the Knill–Laflamme theorem extends correctability to every noise map whose operation elements are linear combinations of them.

This is the standard argument of Gottesman; see also Theorem 10.8 of Nielsen and Chuang.

Under the identification of {I,X,Z,Y}\{I, X, Z, Y\} with the four elements of F4\F_4, qubit stabilizer codes are exactly the self-orthogonal additive codes over F4\F_4. This is the main route from classical algebraic codes to quantum ones.

TheoremStabilizer codes are self-orthogonal additive codes over GF(4)Established result

Define ϕ:F22n→F4n\phi : \F_2^{2n} \to \F_4^n by ϕ(a∣b)=a+ω b\phi(a \mid b) = a + \omega\, b. On a single qubit this labels the Pauli matrices as I↦0, X↦1, Z↦ω, Y↦ωˉI \mapsto 0,\ X \mapsto 1,\ Z \mapsto \omega,\ Y \mapsto \bar\omega.

  1. Dictionary. ϕ\phi is an isomorphism of F2\F_2-vector spaces. It carries the symplectic weight to the Hamming weight and the symplectic inner product to the trace-Hermitian inner product: ⟨u,v⟩s=⟨ϕ(u),ϕ(v)⟩tr\langle u, v \rangle_s = \langle \phi(u), \phi(v) \rangle_{\mathrm{tr}}.
  2. Stabilizer codes. Let SS be the stabilizer of an [[n,k,d]][[n, k, d]] stabilizer code, k≥1k \ge 1, and C⊆F4nC \subseteq \F_4^n the image under ϕ\phi of its binary representation. Then CC is an additive code with 2 n−k2^{\,n-k} elements, C⊆C⊥trC \subseteq C^{\perp_{\mathrm{tr}}}, the normalizer of SS corresponds to C⊥trC^{\perp_{\mathrm{tr}}}, which has 2 n+k2^{\,n+k} elements, and
d  =  min⁡{ wt⁡(v)  :  v∈C⊥tr∖C }.d \;=\; \min \bigl\{\, \operatorname{wt}(v) \;:\; v \in C^{\perp_{\mathrm{tr}}} \setminus C \,\bigr\} .

Conversely every additive code C⊆C⊥trC \subseteq C^{\perp_{\mathrm{tr}}} with 2 n−k2^{\,n-k} elements arises in this way from a stabilizer group, unique up to the signs of its generators. 3. Linear codes. If CC is F4\F_4-linear, then C⊥tr=C⊥hC^{\perp_{\mathrm{tr}}} = C^{\perp_h}, the Hermitian dual. Hence a linear [n,k′,d′]4[n, k', d']_4 code DD with D⊥h⊆DD^{\perp_h} \subseteq D yields an [[ n,  2k′−n,  d ]][[\,n,\; 2k' - n,\; d\,]] stabilizer code with d=min⁡wt⁡(D∖D⊥h)≥d′d = \min \operatorname{wt}(D \setminus D^{\perp_h}) \ge d', provided 2k′>n2k' > n.

This is the formulation of Calderbank, Rains, Shor and Sloane. Any of the six bijections between {X,Y,Z}\{X, Y, Z\} and the nonzero elements of F4\F_4 would serve in item 1, because the trace-Hermitian form only records whether two symbols are distinct and nonzero. The labelling above is one common convention; the literature is not uniform, so check the convention before comparing generator matrices.

Holds when
  • Qubit stabilizer codes with k≥1k \ge 1 logical qubits; the distance statement uses the characterisation of the distance by the normalizer.
  • F4={0,1,ω,ωˉ}\F_4 = \{0, 1, \omega, \bar\omega\} with ωˉ=ω2=ω+1\bar\omega = \omega^2 = \omega + 1, and the trace-Hermitian form ⟨u,v⟩tr=Tr⁡∑iuivˉi\langle u, v \rangle_{\mathrm{tr}} = \tr \sum_i u_i \bar v_i.
Proof · Proof of the correspondence between stabilizer codes and additive codes over GF(4)

1. Dictionary. Since {1,ω}\{1, \omega\} is a basis of F4\F_4 over F2\F_2, the map (a∣b)↦a+ωb(a \mid b) \mapsto a + \omega b is an F2\F_2-linear bijection, and its ii-th coordinate ai+ωbia_i + \omega b_i is nonzero exactly when (ai,bi)≠(0,0)(a_i, b_i) \ne (0,0), so weights correspond. Both forms are sums over coordinates, so it suffices to compare them for n=1n = 1. With a,b,a′,b′∈F2a, b, a', b' \in \F_2, using ωˉ=ω2\bar\omega = \omega^2 and ωωˉ=1\omega \bar\omega = 1,

(a+ωb) (a′+ωb′)‾=(a+ωb)(a′+ωˉb′)=aa′+bb′+ωˉ ab′+ω a′b.(a + \omega b)\, \overline{(a' + \omega b')} = (a + \omega b)(a' + \bar\omega b') = a a' + b b' + \bar\omega\, a b' + \omega\, a' b .

Taking the trace, with Tr⁡(1)=0\tr(1) = 0 and Tr⁡(ω)=Tr⁡(ωˉ)=1\tr(\omega) = \tr(\bar\omega) = 1, gives ab′+a′ba b' + a' b, the symplectic product of (a∣b)(a \mid b) and (a′∣b′)(a' \mid b').

2. Stabilizer codes. The binary representation of SS is an isotropic subspace W⊆F22nW \subseteq \F_2^{2n} of dimension n−kn - k: it is a subspace because the representation is a homomorphism, it has 2n−k2^{n-k} elements because the only scalar in SS is the identity, and it is isotropic because SS is abelian and commutation is measured by the symplectic form. By item 1, C=ϕ(W)C = \phi(W) is additive with 2n−k2^{n-k} elements and C⊆C⊥trC \subseteq C^{\perp_{\mathrm{tr}}}. A Pauli operator commutes with all of SS exactly when its vector lies in W⊥sW^{\perp_s}, so the normalizer corresponds to ϕ(W⊥s)=C⊥tr\phi(W^{\perp_s}) = C^{\perp_{\mathrm{tr}}}, of size 22n−(n−k)2^{2n - (n-k)}. The distance of the code is the least weight of a Pauli operator in the normalizer that is not, up to phase, in SS (distance of a stabilizer code), which translates to the displayed formula.

Conversely, given CC, let W=ϕ−1(C)W = \phi^{-1}(C), choose a basis w1,…,wn−kw_1, \dots, w_{n-k} of WW and let gjg_j be either of the two Hermitian Pauli operators with vector wjw_j. The gjg_j commute because WW is isotropic. A product of a nonempty subset of them has a nonzero vector, hence is not ±I\pm I; so the group they generate does not contain −I-I and is a stabilizer group with n−kn - k independent generators. Different sign choices give the 2n−k2^{n-k} groups whose code spaces are the joint eigenspaces of g1,…,gn−kg_1, \dots, g_{n-k}.

3. Linear codes. Let CC be F4\F_4-linear. The inclusion C⊥h⊆C⊥trC^{\perp_h} \subseteq C^{\perp_{\mathrm{tr}}} holds because Tr⁡(0)=0\tr(0) = 0. For the reverse, let v∈C⊥trv \in C^{\perp_{\mathrm{tr}}} and u∈Cu \in C, and put x=⟨u,v⟩hx = \langle u, v \rangle_h. Then Tr⁡(x)=0\tr(x) = 0, and since ωu∈C\omega u \in C also Tr⁡(ωx)=Tr⁡⟨ωu,v⟩h=0\tr(\omega x) = \tr \langle \omega u, v \rangle_h = 0. The elements of trace zero are 00 and 11, and Tr⁡(ω⋅1)=1\tr(\omega \cdot 1) = 1, so x=0x = 0. Hence v∈C⊥hv \in C^{\perp_h}.

Now let DD be linear of dimension k′k' with D⊥h⊆DD^{\perp_h} \subseteq D and put C=D⊥hC = D^{\perp_h}, a linear code of dimension n−k′n - k' with C⊥tr=C⊥h=D⊇CC^{\perp_{\mathrm{tr}}} = C^{\perp_h} = D \supseteq C. Then ∣C∣=4 n−k′=2 n−(2k′−n)\abs{C} = 4^{\,n-k'} = 2^{\,n - (2k' - n)}, so item 2 gives a stabilizer code with k=2k′−nk = 2k' - n logical qubits and distance min⁡wt⁡(D∖D⊥h)\min \operatorname{wt}(D \setminus D^{\perp_h}), which is at least the minimum distance d′d' of DD.

Finally, the dynamics of stabilizer states under Clifford circuits is classically tractable.

TheoremGottesman–Knill theoremEstablished result

Let a circuit on nn qubits begin in ∣0⟩⊗n\ket{0}^{\otimes n} and consist of mm operations, each a Clifford gate on at most two qubits, a measurement of ZZ on one qubit, or a Clifford gate applied conditionally on earlier outcomes. Then a classical algorithm samples the outcomes of all measurements with exactly the probabilities given by quantum mechanics, using O(n)O(n) elementary operations per gate and O(n3)O(n^3) per measurement, so O(mn3)O(m n^3) in total.

At every stage the state is a stabilizer state: the unique state fixed by an abelian group S≤PnS \le \mathcal{P}_n with nn independent generators and −I∉S-I \notin S (a stabilizer code with k=0k = 0). The algorithm stores the nn generators as a binary n×2nn \times 2n matrix with nn sign bits, the stabilizer tableau, and every measurement outcome is either deterministic or uniformly random.

The theorem is due to Gottesman, who credits Knill (Gottesman); it is section 10.5.4 of Nielsen and Chuang. Aaronson and Gottesman add the nn destabilizer generators to the tableau, which removes the Gaussian elimination and brings the cost of a measurement down to O(n2)O(n^2) at the price of doubling the storage. They also show that simulating stabilizer circuits is complete for the classical complexity class ⊕L\oplus\mathrm{L}, so it is believed to be strictly weaker than general polynomial-time classical computation.

Holds when
  • The circuit acts on nn qubits initialised in ∣0⟩⊗n\ket{0}^{\otimes n}.
  • Its operations are Clifford gates (HH, SS, CNOT, or any gate given by its action on Pauli operators), measurements of single-qubit ZZ (equivalently, of any Pauli operator), and gates chosen as functions of earlier outcomes.
  • Simulation means sampling the joint distribution of measurement outcomes exactly, given access to unbiased random bits.
Proof · Proof of the Gottesman–Knill theorem

Stabilizer states are determined by their generators. If SS is abelian, −I∉S-I \notin S and SS has nn independent generators, the dimension theorem with k=0k = 0 says that SS fixes a one-dimensional subspace, so it determines a unique state ∣ψS⟩\ket{\psi_S} up to phase. Moreover the normalizer equals ⟨iI⟩S\langle iI \rangle S: in the binary representation, the span S\mathcal{S} of the generators is isotropic of dimension nn, and S⊥s\mathcal{S}^{\perp_s} has dimension 2n−n=n2n - n = n and contains S\mathcal{S}, so S⊥s=S\mathcal{S}^{\perp_s} = \mathcal{S}. Hence a Pauli operator that commutes with all of SS is λs\lambda s for some s∈Ss \in S, and since −I∉S-I \notin S only one of ±s\pm s lies in SS.

Initial state. ∣0⟩⊗n\ket{0}^{\otimes n} is stabilized by Z1,…,ZnZ_1, \dots, Z_n.

Gates. If g∣ψ⟩=∣ψ⟩g \ket{\psi} = \ket{\psi} then (UgU†) U∣ψ⟩=U∣ψ⟩(U g U\dagg)\, U\ket{\psi} = U \ket{\psi}, so U∣ψ⟩U\ket{\psi} is the stabilizer state with generators UgjU†U g_j U\dagg. These are again Pauli operators, independent and commuting because conjugation is an automorphism. For a gate on at most two qubits, each UgjU†U g_j U\dagg differs from gjg_j only on those qubits and in its sign, and the new entries and sign follow from a fixed table (for HH, SS, CNOT, the table in the Clifford group record). Updating all nn generators costs O(n)O(n).

Measurement of ZaZ_a, random case. Suppose some generator, say g1g_1, anticommutes with ZaZ_a. Multiplying every other generator that anticommutes with ZaZ_a by g1g_1 gives a generating set g1,g2′,…,gn′g_1, g_2', \dots, g_n' of the same group in which only g1g_1 anticommutes with ZaZ_a; this costs O(n)O(n) per generator, O(n2)O(n^2) in all. Then

⟨ψ∣Za∣ψ⟩=⟨ψ∣Zag1∣ψ⟩=−⟨ψ∣g1Za∣ψ⟩=−⟨ψ∣Za∣ψ⟩,\bra{\psi} Z_a \ket{\psi} = \bra{\psi} Z_a g_1 \ket{\psi} = - \bra{\psi} g_1 Z_a \ket{\psi} = - \bra{\psi} Z_a \ket{\psi} ,

so ⟨ψ∣Za∣ψ⟩=0\bra{\psi} Z_a \ket{\psi} = 0 and each outcome (−1)μ(-1)^{\mu}, μ∈{0,1}\mu \in \{0,1\}, has probability 12\tfrac12. The post-measurement state is proportional to 12(I+(−1)μZa)∣ψ⟩\tfrac12 (I + (-1)^{\mu} Z_a) \ket{\psi}. It is fixed by (−1)μZa(-1)^{\mu} Z_a and, because gj′g_j' commutes with ZaZ_a, by every gj′g_j'. These nn operators commute, are independent (the gj′g_j' are independent, and the vector of ZaZ_a is not in their span because ZaZ_a anticommutes with g1g_1 whereas every element of ⟨g2′,…,gn′⟩⊆S\langle g_2', \dots, g_n' \rangle \subseteq S commutes with g1g_1), and their group does not contain −I-I because they fix a nonzero vector. So the simulator draws a fair random bit μ\mu and replaces g1g_1 by (−1)μZa(-1)^{\mu} Z_a.

Measurement of ZaZ_a, deterministic case. Suppose ZaZ_a commutes with every generator. By the first paragraph ϵZa∈S\epsilon Z_a \in S for exactly one ϵ∈{+1,−1}\epsilon \in \{+1, -1\}, so Za∣ψ⟩=ϵ∣ψ⟩Z_a \ket{\psi} = \epsilon \ket{\psi} and the outcome is ϵ\epsilon with certainty; the state does not change. To find ϵ\epsilon, solve ∑jxjvj=ea\sum_j x_j v_j = e_a over F2\F_2 for the binary vector eae_a of ZaZ_a by Gaussian elimination, O(n3)O(n^3) operations, then multiply the generators gjg_j with xj=1x_j = 1 in order, tracking the overall phase; each product of two Pauli operators and its phase costs O(n)O(n), so this step costs O(n2)O(n^2). The resulting product is ϵZa\epsilon Z_a.

Classical control and sampling. A conditional gate is simulated by evaluating the condition on the outcomes already sampled and applying the gate update if required. Processing the operations in order, each measurement outcome is drawn from its exact conditional distribution given all previous outcomes, so the joint distribution of the sampled outcomes is the quantum one. The total cost is O(n)O(n) per gate and O(n3)O(n^3) per measurement.

Measuring a general Pauli operator QQ reduces to the same two cases with QQ in place of ZaZ_a: it is random exactly when QQ anticommutes with a generator. The argument is that of Gottesman, presented as in section 10.5 of Nielsen and Chuang; Aaronson and Gottesman replace the Gaussian elimination by maintaining destabilizer generators, which gives O(n2)O(n^2) per measurement.

Worked Examples

Syndrome decoding in the five-qubit code

Quantum codeFive-qubit codeEstablished definition

Stabilizer. Qubits 1,…,51, \dots, 5; generators

g1=X Z Z X I,g2=I X Z Z X,g3=X I X Z Z,g4=Z X I X Z.\begin{aligned} g_1 &= X\,Z\,Z\,X\,I, &\qquad g_2 &= I\,X\,Z\,Z\,X, \\ g_3 &= X\,I\,X\,Z\,Z, &\qquad g_4 &= Z\,X\,I\,X\,Z . \end{aligned}

Each is the cyclic shift of the previous one by one position, and the fifth shift Z Z X I XZ\,Z\,X\,I\,X equals the product g1g2g3g4g_1 g_2 g_3 g_4. Every pair of generators has non-identity Pauli matrices that differ on exactly two qubits, so every pair commutes; for instance g1g_1 and g2g_2 differ on qubits 2 and 4. The four binary vectors are linearly independent, so k=5−4=1k = 5 - 4 = 1. All 15 non-identity elements of the stabilizer group have weight 4. (Pairwise commutation, independence, the weight distribution and the distance below were checked by direct computation.)

Logical operators. Xˉ=X⊗5\bar X = X^{\otimes 5} and Zˉ=Z⊗5\bar Z = Z^{\otimes 5} commute with every generator and anticommute with each other. Lower-weight representatives exist: Z⊗5g1g3=−Z I X X IZ^{\otimes 5} g_1 g_3 = - Z\,I\,X\,X\,I, so Z I X X IZ\,I\,X\,X\,I acts on the code space as −Zˉ-\bar Z.

Parameters. [[5,1,3]][[5, 1, 3]]. No Pauli operator of weight 1 or 2 commutes with all four generators except the identity, and Z I X X IZ\,I\,X\,X\,I is a nontrivial logical operator of weight 3.

Syndromes. Writing the syndrome as (σ1σ2σ3σ4)(\sigma_1 \sigma_2 \sigma_3 \sigma_4) with σj=1\sigma_j = 1 when the error anticommutes with gjg_j:

qubit 1 2 3 4 5
XX 0001 1000 1100 0110 0011
ZZ 1010 0101 0010 1001 0100
YY 1011 1101 1110 1111 0111

The 15 single-qubit errors have the 15 distinct nonzero syndromes, so the code is perfect: it meets the quantum Hamming bound 2k(1+3n)≤2n2^{k}(1 + 3n) \le 2^{n} with equality, 2⋅16=32=252 \cdot 16 = 32 = 2^5. It also meets the quantum Singleton bound, n−k=4=2(d−1)n - k = 4 = 2(d-1), and is non-degenerate.

Properties. No element of the stabilizer group other than II is purely XX-type or purely ZZ-type, so this stabilizer is not of CSS form; by the quantum Singleton bound no code with n<5n < 5 encodes a qubit with distance 3. The stabilizer is invariant under cyclic shifts of the qubits. Under the GF(4) correspondence the stabilizer is closed under the relabelling X→Z→Y→XX \to Z \to Y \to X, which is multiplication by ω\omega, so it is an F4\F_4-linear code with 424^2 elements (Calderbank, Rains, Shor and Sloane); both facts were checked by enumerating the 16 group elements.

History. Found independently by Laflamme, Miquel, Paz and Zurek and by Bennett, DiVincenzo, Smolin and Wootters. The cyclic generators above are the form used by Gottesman and by Nielsen and Chuang.

Suppose the state ∣ψ⟩∈C(S)\ket{\psi} \in C(S) suffers the error E=Y3E = Y_3. Its binary vector is (00100∣00100)(00100 \mid 00100). Against g1=XZZXIg_1 = XZZXI, with vector (10010∣01100)(10010 \mid 01100), the symplectic product is a⋅b′+a′⋅b=1+0=1a \cdot b' + a' \cdot b = 1 + 0 = 1, so σ1=1\sigma_1 = 1. Repeating for the other generators gives the syndrome 11101110, which the table assigns to Y3Y_3 alone among single-qubit errors. The decoder applies Y3Y_3 and the state is restored. If instead two errors occurred, say X1Z2X_1 Z_2, the syndrome is 0001+0101=01000001 + 0101 = 0100, the syndrome of Z5Z_5. The decoder applies Z5Z_5, and the net operator Z5X1Z2Z_5 X_1 Z_2 commutes with every generator. It is not in the stabilizer (every nontrivial stabilizer element has weight 4), so it is a nontrivial logical operator of weight 3: a logical error, as the distance d=3d = 3 predicts for a weight-2 error.

Counting the Steane code

Quantum codeSteane codeEstablished definition

Classical code. Let HH be the parity-check matrix of the Hamming code [7,4,3][7, 4, 3] whose jj-th column is the binary expansion of jj:

H=(000111101100111010101).H = \begin{pmatrix} 0 & 0 & 0 & 1 & 1 & 1 & 1 \\ 0 & 1 & 1 & 0 & 0 & 1 & 1 \\ 1 & 0 & 1 & 0 & 1 & 0 & 1 \end{pmatrix} .

Its row space is the [7,3,4][7, 3, 4] simplex code C⊥C^\perp, contained in the Hamming code CC.

Stabilizer. One XX-type and one ZZ-type generator for each row of HH:

g1X=I I I X X X X,g2X=I X X I I X X,g3X=X I X I X I X,g1Z=I I I Z Z Z Z,g2Z=I Z Z I I Z Z,g3Z=Z I Z I Z I Z.\begin{aligned} g_1^X &= I\,I\,I\,X\,X\,X\,X, & g_2^X &= I\,X\,X\,I\,I\,X\,X, & g_3^X &= X\,I\,X\,I\,X\,I\,X, \\ g_1^Z &= I\,I\,I\,Z\,Z\,Z\,Z, & g_2^Z &= I\,Z\,Z\,I\,I\,Z\,Z, & g_3^Z &= Z\,I\,Z\,I\,Z\,I\,Z . \end{aligned}

An XX-type and a ZZ-type generator overlap on an even number of qubits (two, or four for gjX,gjZg_j^X, g_j^Z), because any two rows of HH are orthogonal over F2\F_2 and each row has even weight; so all six commute. They are independent, so k=7−6=1k = 7 - 6 = 1. The stabilizer group has 21 elements of weight 4 and 42 of weight 6. (These facts and the distance were checked by direct computation.)

Code states.

∣0ˉ⟩=18∑c∈C⊥∣c⟩,∣1ˉ⟩=X⊗7∣0ˉ⟩=18∑c∈C⊥∣c⊕1111111⟩.\ket{\bar 0} = \frac{1}{\sqrt 8} \sum_{c \in C^\perp} \ket{c}, \qquad \ket{\bar 1} = X^{\otimes 7} \ket{\bar 0} = \frac{1}{\sqrt 8} \sum_{c \in C^\perp} \ket{c \oplus 1111111} .

Logical operators. Xˉ=X⊗7\bar X = X^{\otimes 7} and Zˉ=Z⊗7\bar Z = Z^{\otimes 7}; weight-3 representatives are X1X2X3X_1 X_2 X_3 and Z1Z2Z3Z_1 Z_2 Z_3, since 11100001110000 is a Hamming codeword not in C⊥C^\perp.

Parameters. [[7,1,3]][[7, 1, 3]], non-degenerate. The syndrome of the ZZ-type checks on an XX error at qubit jj is the column jj of HH, the binary expansion of jj, and likewise for the XX-type checks on a ZZ error; a YY error lights both. All 21 single-qubit errors have distinct nonzero syndromes.

Properties. It is the CSS code of the pair (C,C)(C, C) with C⊥⊆CC^\perp \subseteq C (CSS codes). Bitwise CNOT between two blocks implements the logical CNOT, and bitwise HH implements the logical HH because the XX and ZZ checks are identical. Since every word of C⊥C^\perp has weight 0 or 4 and every word of its complement has weight 3 or 7, the bitwise phase gate S⊗7S^{\otimes 7} multiplies ∣0ˉ⟩\ket{\bar 0} by 1 and ∣1ˉ⟩\ket{\bar 1} by −i-i: it implements the logical Sˉ†\bar S\dagg, and (S†)⊗7(S\dagg)^{\otimes 7} implements Sˉ\bar S. So the whole logical Clifford group is transversal (Gottesman). It is the smallest member of the triangular two-dimensional color codes; see the transversal Clifford theorem.

History. Introduced by Steane (see also), alongside the general construction of Calderbank and Shor. A textbook treatment is in chapter 10 of Nielsen and Chuang.

Here n=7n = 7 and there are six generators, so dim⁡C(S)=27−6=2\dim C(S) = 2^{7-6} = 2. The projector is the average of the 26=642^6 = 64 stabilizer elements; the 63 non-identity elements are traceless, so Tr⁡P=27/64=2\tr P = 2^7 / 64 = 2, as the dimension theorem says. Since the XX-type checks equal the ZZ-type checks, an XX error and a ZZ error are decoded independently by the classical Hamming decoder: the syndrome of Z5Z_5 under the three XX-type checks is the fifth column of HH, 101101, the binary expansion of 5.

A degenerate code

Quantum codeShor nine-qubit codeEstablished definition

Code states. Group the qubits into blocks {1,2,3}\{1,2,3\}, {4,5,6}\{4,5,6\}, {7,8,9}\{7,8,9\} and put ∣±3⟩=(∣000⟩±∣111⟩)/2\ket{\pm_3} = (\ket{000} \pm \ket{111}) / \sqrt 2. Then

∣0ˉ⟩=∣+3⟩∣+3⟩∣+3⟩,∣1ˉ⟩=∣−3⟩∣−3⟩∣−3⟩.\ket{\bar 0} = \ket{+_3} \ket{+_3} \ket{+_3} , \qquad \ket{\bar 1} = \ket{-_3} \ket{-_3} \ket{-_3} .

The outer layer is the three-qubit phase-flip code across blocks and the inner layer is the three-qubit bit-flip repetition code inside each block.

Stabilizer. Eight generators:

Z1Z2, Z2Z3, Z4Z5, Z5Z6, Z7Z8, Z8Z9,X1X2X3X4X5X6,X4X5X6X7X8X9.\begin{gathered} Z_1 Z_2,\ Z_2 Z_3,\ Z_4 Z_5,\ Z_5 Z_6,\ Z_7 Z_8,\ Z_8 Z_9, \\ X_1 X_2 X_3 X_4 X_5 X_6, \qquad X_4 X_5 X_6 X_7 X_8 X_9 . \end{gathered}

Each ZZ-type generator meets each XX-type generator in zero or two qubits, so all commute; the eight are independent, so k=9−8=1k = 9 - 8 = 1. The stabilizer group contains 9 elements of weight 2 (the products ZiZjZ_i Z_j within a block). (Pairwise commutation, independence, the weight distribution and the distance were checked by direct computation.)

Logical operators. With the code states above, Xˉ=Z1Z4Z7\bar X = Z_1 Z_4 Z_7, which maps ∣0ˉ⟩\ket{\bar 0} to ∣1ˉ⟩\ket{\bar 1}, and Zˉ=X1X2X3\bar Z = X_1 X_2 X_3, which has eigenvalue +1+1 on ∣0ˉ⟩\ket{\bar 0} and −1-1 on ∣1ˉ⟩\ket{\bar 1}. Equivalent representatives are Z⊗9Z^{\otimes 9} and X⊗9X^{\otimes 9}. Some authors exchange the names of the two code states, which exchanges these roles.

Parameters. [[9,1,3]][[9, 1, 3]], degenerate. A bit flip XjX_j is located by the two ZZ-type checks of its block. A phase flip ZjZ_j changes the sign of its block, which is detected by the two XX-type checks; Z1Z_1, Z2Z_2 and Z3Z_3 have the same syndrome and act identically on the code space, because Z1Z2Z_1 Z_2 and Z2Z3Z_2 Z_3 are stabilizers. Of the 27 single-qubit errors, the 18 of type XX and YY have distinct syndromes and the 9 of type ZZ share 3 syndromes, giving 21 distinct nonzero syndromes in all.

Properties. It is a CSS code and the simplest example of code concatenation. It is degenerate, so it is not bounded by the quantum Hamming bound argument for non-degenerate codes, although with these parameters it satisfies the bound anyway.

History. Introduced by Shor as the first code protecting a qubit against arbitrary single-qubit errors. The stabilizer description is in Gottesman and section 10.2 of Nielsen and Chuang.

The errors Z1Z_1 and Z2Z_2 have the same syndrome and Z1Z2∈SZ_1 Z_2 \in S, so a decoder that answers "Z1Z_1" when Z2Z_2 happened still succeeds. This is the degeneracy permitted by item 2 of the distance theorem: the product of two errors may lie in the stabilizer.

Algorithms and Implementations

Syndrome extraction. A generator gg is measured with one ancilla prepared in ∣+⟩\ket{+}, a controlled-PjP_j from the ancilla to each qubit jj in the support of g=P1⊗⋯⊗Png = P_1 \otimes \cdots \otimes P_n, and a final measurement of the ancilla in the XX basis. The circuit below measures g1=XZZXIg_1 = X Z Z X I of the five-qubit code.

Quantum circuit on 6 wires (q0, q1, q2, q3, q4, a). step 1: H on a. step 2: CNOT, control a, target q0. step 3: CZ on a and q1. step 4: CZ on a and q2. step 5: CNOT, control a, target q3. step 6: H on a. step 7: measure a.q0q1q2q3q4aHH
Measuring the five-qubit-code generator XZZXI on qubits q0 to q4 with an ancilla a

The ancilla's outcome bit is σ1\sigma_1. A single fault on the ancilla can spread to several data qubits through these controlled gates, which is why fault-tolerant syndrome extraction needs extra structure (see Fault-Tolerant Quantum Computing).

Encoding. Every stabilizer code has an encoding circuit made of Clifford gates. Gaussian elimination on the check matrix brings it to a standard form, from which Gottesman and Cleve and Gottesman read off encoders using O(n(n−k))O(n(n-k)) gates, that is, O(n)O(n) gates per stabilizer generator. More generally, any Clifford circuit can be synthesised from its symplectic matrix (Dehaene and De Moor; Aaronson and Gottesman).

Simulation. Tableau simulators following Aaronson and Gottesman are the standard tool for estimating logical error rates of stabilizer codes under Pauli noise; the lesson on syndrome extraction with Stim uses one.

Applications

  • Code construction. Classical self-orthogonal codes over F2\F_2 or F4\F_4 give stabilizer codes directly (CSS codes; Calderbank, Rains, Shor and Sloane). Gottesman constructed distance-3 codes [[2m,2m−m−2,3]][[2^m, 2^m - m - 2, 3]], m≥3m \ge 3, which saturate the quantum Hamming bound: kk is the largest value it allows for n=2mn = 2^m.
  • Fault tolerance. Syndrome measurement, logical Pauli frames and transversal Clifford gates are all expressed in this formalism; see Logical Gates.
  • Generalisations. Gauge qubits give subsystem codes; sparse check matrices give quantum LDPC codes.

Computational Complexity

Deciding whether a stabilizer code has a nontrivial logical operator of weight at most ww contains, as the special case of CSS codes, the minimum-distance problem for classical linear codes, which is NP-hard. Decoding is also hard in the worst case: Hsieh and Le Gall proved that finding the most likely error for a general stabilizer code is NP-hard (NP-hardness of decoding), and degenerate maximum-likelihood decoding is harder still (#P-completeness of degenerate decoding). Distances of large families are therefore established by structure (topology, expansion) rather than by search. By contrast, simulating Clifford circuits is easy, by the Gottesman–Knill theorem.

Limitations and Common Pitfalls

  • Signs matter. If the chosen generators multiply to −I-I, the "code" is the zero space. Independence of the binary vectors guarantees −I∉S-I \notin S only when every generator is Hermitian; check signs explicitly when building codes.
  • A logical representative's weight is not the distance. X⊗5X^{\otimes 5} has weight 5 but the five-qubit code has distance 3, because the minimum is taken over the whole coset of the logical operator. Conversely, low-weight stabilizers indicate degeneracy, not low distance.
  • Centralizer versus normalizer. For Pauli stabilizer groups not containing −I-I the two coincide, so the literature uses both names; they differ for more general groups.
  • Non-Pauli noise. The code still corrects any noise in the linear span of the correctable Pauli errors, including coherent rotations. What fails is the efficient simulation: the Gottesman–Knill theorem needs Pauli noise, and decoders tuned to a Pauli model may be suboptimal for coherent noise. Leakage out of the qubit space is outside the span of Pauli errors altogether.
  • Gottesman–Knill is not a statement about entanglement. Stabilizer states can be highly entangled and still be simulable; the obstacle to classical simulation is non-Clifford operations (magic states).
  • Conventions for YY and for logical operators vary. Some authors write Y=XZY = XZ rather than iXZiXZ, and the names Xˉ\bar X, Zˉ\bar Z of the Shor code are exchanged between sources; compare the sign and labelling conventions before comparing check matrices.

Gottesman remains the most complete account; Gottesman's later introduction and chapter 10 of Nielsen and Chuang are standard textbook routes.

Mentioned in

Open in the knowledge graph

Contributions about this record

Nobody has published a contribution about it yet.

Publish a result, reproduction or commentPropose a correction to this page

References

  1. Daniel Gottesman (1997). Stabilizer Codes and Quantum Error Correction. PhD thesis, California Institute of Technology. arXiv:quant-ph/9705052
  2. A. R. Calderbank, E. M. Rains, P. W. Shor, N. J. A. Sloane (1997). Quantum Error Correction and Orthogonal Geometry. Physical Review Letters 78, 405-408. doi:10.1103/PhysRevLett.78.405arXiv:quant-ph/9605005
  3. A. R. Calderbank, E. M. Rains, P. W. Shor, N. J. A. Sloane (1998). Quantum error correction via codes over GF(4). IEEE Transactions on Information Theory 44 (4), 1369-1387. doi:10.1109/18.681315arXiv:quant-ph/9608006
  4. Peter W. Shor (1995). Scheme for reducing decoherence in quantum computer memory. Physical Review A 52, R2493-R2496. doi:10.1103/PhysRevA.52.R2493
  5. Andrew Steane (1996). Multiple Particle Interference and Quantum Error Correction. Proceedings of the Royal Society A 452, 2551. doi:10.1098/rspa.1996.0136arXiv:quant-ph/9601029
  6. Raymond Laflamme, Cesar Miquel, Juan Pablo Paz, Wojciech H. Zurek (1996). Perfect Quantum Error Correcting Code. Physical Review Letters 77, 198-201. doi:10.1103/PhysRevLett.77.198arXiv:quant-ph/9602019
  7. Charles H. Bennett, David P. DiVincenzo, John A. Smolin, William K. Wootters (1996). Mixed-state entanglement and quantum error correction. Physical Review A 54, 3824-3851. doi:10.1103/PhysRevA.54.3824
  8. Daniel Gottesman (1996). Class of quantum error-correcting codes saturating the quantum Hamming bound. Physical Review A 54, 1862-1868. doi:10.1103/PhysRevA.54.1862arXiv:quant-ph/9604038
  9. Richard Cleve, Daniel Gottesman (1997). Efficient computations of encodings for quantum error correction. Physical Review A 56, 76-82. doi:10.1103/PhysRevA.56.76arXiv:quant-ph/9607030
  10. Daniel Gottesman (1998). The Heisenberg Representation of Quantum Computers. arXiv:quant-ph/9807006
  11. Scott Aaronson, Daniel Gottesman (2004). Improved simulation of stabilizer circuits. Physical Review A 70, 052328. doi:10.1103/PhysRevA.70.052328arXiv:quant-ph/0406196
  12. Jeroen Dehaene, Bart De Moor (2003). Clifford group, stabilizer states, and linear and quadratic operations over GF(2). Physical Review A 68, 042318. doi:10.1103/PhysRevA.68.042318arXiv:quant-ph/0304125
  13. Daniel Gottesman (2009). An Introduction to Quantum Error Correction and Fault-Tolerant Quantum Computation. arXiv:0904.2557
  14. Michael A. Nielsen, Isaac L. Chuang (2010). Quantum Computation and Quantum Information (10th Anniversary Edition). Cambridge University Press. doi:10.1017/CBO9780511976667
  15. Min-Hsiu Hsieh, Francois Le Gall (2011). NP-hardness of decoding quantum error-correction codes. Physical Review A 83, 052331. doi:10.1103/PhysRevA.83.052331arXiv:1009.1319
  16. Andrew M. Steane (1996). Error Correcting Codes in Quantum Theory. Physical Review Letters 77, 793-797. doi:10.1103/PhysRevLett.77.793
  17. A. R. Calderbank, Peter W. Shor (1996). Good quantum error-correcting codes exist. Physical Review A 54, 1098-1105. doi:10.1103/PhysRevA.54.1098
  18. Daniel Gottesman (1998). Theory of fault-tolerant quantum computation. Physical Review A 57, 127-137. doi:10.1103/PhysRevA.57.127arXiv:quant-ph/9702029

Contributors

  • KetQat maintainers · @ketqatConceptualization; Supervision (CRediT roles)
  • Claude (AI drafting assistant)Writing, original draft (CRediT roles)

Review history

  1. Automated source check · Pass with notes · 2026-12-01 · Independent automated verification pass (AI, not the drafting session)

    Topic's own text checked (embedded records carry their own review states): intuition on the three-qubit code, the five-qubit worked example (Y_3 symplectic product and syndrome 1110, X_1 Z_2 giving syndrome 0100 = Z_5 and a weight-3 logical) and the Steane counting (tr P = 2, Z_5 syndrome 101) recomputed with the numpy scripts used for the code records; ancilla extraction circuit checked; encoder cost compared with Cleve-Gottesman, arXiv quant-ph/9607030 abstract (O(n d) gates for d generators); Gottesman family compared with arXiv quant-ph/9604038 abstract and the bound recomputed for m = 3..7; complexity remarks consistent with Hsieh-Le Gall (title/metadata) and classical NP-hardness of minimum distance; references' metadata checked.

    The Gottesman (1996) family [[2^m, 2^m - m - 2, 3]] was said to 'come close to' the quantum Hamming bound; the paper constructs codes saturating it, and k = 2^m - m - 2 is exactly the largest k the bound allows (checked for m = 3..7). Reworded to 'saturate'.

Revision history

  1. 2026-12-01Content release 2.1.0: 35 more topics, an independent source check of every record, intake hardening (#17)80537b7e
  2. 2026-11-30KetQat Commons: free learning paths, knowledge records, research problems, literature intake (#14)571c9b10

Current revision 7e2967450bf48b08. Source file knowledge/records/topic/stabilizer-codes.md in the content repository (readable there once it is public).