- Stabilizer Generators [1], [2], [3]
- Logical Operators
- Example: Laflamme’s code [4], [5]
- Toric Code
- Errors [7]
- Error Correction
- Ground / Excited Atom States [6]
- Parity Measurement
- Logical Operators
- Appendix A: Spectral Theorem
- Appendix B: CNOT Eigenvalues and Eigenvectors
- Sources
1. Stabilizer Generators [1], [2], [3]
The Pauli group Pn on n qubits are all tensor products of the single-qubit Pauli operators {I, X, Y, Z}. A stabilizer group S is a subgroup of Pn satisfying
- Contains the identity operator
- All elements of S commute with each other
- Any product of two elements in S is in S
- It does not contain the negative identity operator
Generators: a minimal set of operators in S that can produce all the other elements, e.g. consider

where the index indicates the qubit, it operates on and fulfilling 1. to 4. One can obtain all elements by

alone, hence these are stabilizer generators with

In other words: the stabilizer generators define the syndrome measurements!
There is a one-to-one correspondence between stabilizer groups and the quantum error-correcting codes:
The codespace is defined uniquely by the set of all states such that Si|ψ> = |ψ> for all Si in S

The codewords (states) can be derived with an orthogonal basis of the codespace
Example: recall the three-qubit repetition code (9 Qubit Shor Code), where |000>, |111> is an orthonormal basis for the codewords defined by

2. Logical Operators
Now: how to operate on the stable, encoded logical qubits, without leaving the codespace?
In order to preserve the code space, these operators have to commute with all stabilizers, because otherwise they could e.g. change the syndrome and hence corrupting the original, encoded data
In general, for logical operators:
- They commute with all elements in S and leave the codespace invariant
- They are not in the stabilizer group
- Logical operators for the same logical qubit anticommute, i.e. act non-trivially on the codewords
An (easy) example is again the three-qubit repetition code: the logical operators are

So, every Pauli Operator on encoded qubits is either
- a logical operator
- or a stabilizer
- or an error (not commuting with at least one stabilizer and taking the state out of the codespace)
3. Example: Laflamme’s code [4], [5]
The following 5 qubit code is the smallest error correcting code capable of correcting arbitrary Pauli errors (i.e. unwanted applications of X, Y or Z gates on a single qubit)

These operators commute and are linearly independent, hence the code subspace has dimension

The logical basis states |0>L and |1>L of the 5-qubit error correcting code span the 2-dimensional codespace (embedded within the 32-dimensional Hilbert space of 5 physical qubits, i.e. the +1 eigenspace of the 4 stabilizer generators). The logical operators are

Note: an example of an error code is

commuting with all Si, but acting non-trivial on the codespace

And analogously:

Now encode a data qubit in an arbitrary state |ψ> = a|0> + b|1> to

Syndrome measurement circuit for a single qubit error:

Since there are 4 independent stabilizers, there are 16 possible syndromes, which can be corrected:


4. Toric Code
Consider a 2-dimensional discrete lattice LxL with periodic boundary conditions (hence the lattice can be thought as a surface of a doughnut, i.e. a torus) and on each edge of this lattice a qubit is placed, [6]

face operator Zf = applying Pauli Z operators to all qubits of a tile (I for all other qubits, red). Stabilizer generators are all the Z⨂ Z⨂ Z⨂ Z for all tiles
vertex operator Xv = product of Pauli X operators acting on the qubits on the edges of a vortex (I for all other qubits, blue). Stabilizer generators are all the X⨂ X⨂ X⨂ X for all vertices
Since the product of all Zf stabilizer generators yield I, and the same holds for the product of all Xv stabilizer generators, the toric code (derived from the abelian group of all Zf and Xv) with 2L*L physical qubits can encode 2 logical qubits (independent of L!):

the term in brackets being the number of stabilizer generators per operator type minus the constraint
Errors [7]
To be a valid stabilizer code:

- all Z operators commute with themselves, analogously all X; Z and X acting on different qubits commute, but also on the same qubit, since the overlap is always two qubits due to the periodic boundary conditions
- Stabilizer generators need to be a minimal set. Due to the two constraints of the product of all Xv and Zf respectively: remove any single X and single Z stabilizer (expressible through all the other Z or X operators), to build a minimal set
Consider a chain of X errors. The two Z stabilizer generators will measure the parity -1 at the ends of the chain because of the odd number of X errors in both faces. The actual error chain is not detected, since an even number of X errors in a face will give +1

Hence a closed loop of X errors is not detected, but there is a corresponding X operator in the stabilizer generators and hence this is not a physical error (the encoded logical state is not changed!)

There are (undetectable) closed X error loops which are not in the stabilizers! They represent non-trivial logical errors and are non-contractable loops on the torus surface, the shortest being of length L! Hence for 2L*L qubits, encoding 2 logical qubits, the toric code is called

Analogously: Z errors
Error Correction
X errors and Z errors can be detected and corrected independently. E.g. the error depicted here:

Only the two grey tiles are known to be errorous and are corrected by the X operators along the yellow line. Correcting means here: after applying the ‘yellow’ line, the still existing errors plus the corrected ones keep the encoded logical state unchanged!
Note: choosing the shortest path between two -1 syndrome measurements will not always correct the error at hand and there are different strategies to try to correct the situation (e.g. Edmonds (classical!) Blossom Algorithm, see e.g. [8])

Real physical errors are local, e.g. an atom interacting with its environment. But the logical errors span the entire lattice. Hence for a logical error to occur, L correlated errors forming a non-contractable loop have to arise independently! If the probability for an X error is p, the probability for a closed loop would be

which vanishes with lattice size!
Note: there is a finite fault-tolerance threshold pth for the toric code (and the surface code)
- If p < pth, then increasing L exponentially suppresses the logical error rate, p being the single qubit error rate
- If p > pth, the errors will overwhelm the correction code
For the surface code, pth is roughly 1% (one of the highest thresholds known for QEC codes and achievable with today’s hardware, see e.g. [9]: Google’s 3rd generation Sycamore processor)
The intuitive reason for the threshold existence is that random independent errors below some error density are unlikely to form large connected clusters but rather stay local (and are hence correctable).
Above the threshold, errors percolate (for directed percolation see e.g. [10]) and can form system-spanning chains, behaving like logical errors
The issue is, that the code is expensive:

Ground / Excited Atom States [6]
Consider

which is Hermitian and hence can be thought as an operator of a physical system. The eigenstates of the Hamiltonian correspond to energy levels
From the Spectral Theorem, e.g. [11] and appendix A: it exists a basis {|ψi>} of eigenstates diagonalizing H and each basis vector is an eigenstate of all face and vertex operators
Let xvi and zfi be the corresponding eigenvalues, then |ψi> is an eigenvector of H with eigenvalue

This expression becomes minimal if all zfi and xvi are +1, hence |ψi> belongs to the code space (!) and corresponds to a ground state of H!
Note: Errors (adding zfi or xvi that are -1, hence increasing the eigenvalue of H) correspond to excited states!
Parity Measurement
A Z error on a data qubit propagates backward through CNOT onto the ancilla as an X-eigenvalue flip, which is what the X-stabilizer measurement circuit exploits when reading out the syndrome
Start with, what happens to the control’s X-eigenvalue when the target carries an X-eigenvalue? CNOT for the X basis:

So after CNOT, the control qubit carries the target (X-) eigenvalue. Let’s do the second expression explicitly:

In general: the control’s X-eigenvalue after CNOT equals the product of the control’s with the target’s X-eigenvalue:

I.e: CNOT ‘copies’ X backward (target -> control) in the X basis
This is the Z-copy rule but mirrored: CNOT ‘copies’ Z forward (control -> target) in the Z basis:
The ancilla starts in |0> (Z-eigenstate, eigenvalue +1) and the CNOTs have the data qubits as controls and the ancilla as target; the data qubits each are in some Z-eigenstate |zi> in {|0>, |1>}
CNOT rule: | c,t > -> | c, c XOR t>, i.e. the target flips if the control is in |1> (Note: this is only true in the Z basis, if the control is in superposition, the result is an entangled Bell state and not a copy, consistent with the no-cloning theorem!)
Hence the ancilla (here the target!) accumulates the XOR of the control bits:

The ancilla qubit is in an eigenstate of Z, measuring gives either +1 (no Z error detected) or -1 (Z error detected)
If a Z error occurs, it flips the sign, but doesn’t change the Z-eigenvalue (state) when measured: Z|0> = +|0>, Z|1> = -|1>, i.e. the XOR parity is unchanged. Therefore a Z error is not detected by a Z-stabilizer! But by the X-stabilizer: X-error on a data qubit gives either X|0> = |1> or X|1> = |0>, hence changing the XOR parity accumulated on the ancilla!
Practical advantage of the toric code: stabilizer measurements only involve 4 neighboring qubits, no long-range interactions are required. For Z stabilizers, detecting X-errors, the parity measurement circuit looks like


Measuring the parity for

the ancilla qubit is |0> for parity +1 (no error detected) and |1> for -1 (error detected)


For the X stabilizer detecting Z errors the circuit looks like below, since an X-error on a data qubit flips the ancilla qubit via a CNOT gate (as seen before in detail)

Logical Operators
For completeness, what are the logical operators of the toric code? A logical operator is defined as an operator that:
- Commutes with all stabilizers → has trivial syndrome → is undetectable
- Does not belong to the stabilizer group → actually does something non-trivial to the logical state
This is exactly the definition of a worst-case error — one that the code cannot detect or correct
But: the logical operators are exactly the non-contractual loops mentioned earlier!

Zc1 be the operator acting with Z-operators on all qubits along the line c1, commuting with all tile operators.
Two qubits of the X operators of vertex V belong to c1. Zc1 commutes with Xv, because it picks up two -1 signs! But it doesn’t belong to the stabilizers
Analogously Zc2
Hence the two ‘line’ Z-operators act as logical operators on the two logical qubits |0>L and |1>L causing a phase shift for |1>L
Along the same argument regarding the blue dotted lines: Xc’1 and Xc’2 are logical operators acting on |0>L or |1>L by flipping the encoded state
5. Appendix A: Spectral Theorem
nxn matrix A: if Av = λv, v is an eigenvector of A and λ the corresponding eigenvalue; (A – λ I) v = 0 and since v ≠ 0: (A – λ I) not invertible and hence det (A – λ I) = 0
Notes:

Now a complex matrix is diagonizable if all its eigenvalues are different (in case of repeated eigenvalues it may still be possible, but not in general)
Spectral theorem: A nxn complex matrix A is Hermitian if

Then all eigenvalues of A are real and the corresponding eigenvectors build an orthogonal basis of

Be U a complex unitary matrix:

In other words: there is a unitary change of basis so that U is diagonal
Note: Solving the eigenvalue problem in quantum mechanics means finding the state (eigenfunction/-vector) the particle can occupy and the physical quantities (eigenvalues) it can possess in that state
6. Appendix B: CNOT Eigenvalues and Eigenvectors
Eigenstates of the Pauli X (bit-flip) operator in the |0>, |1> basis (also called Z basis) is

To find the eigenvalues: det(X−λI)=0:

Eigenvectors, ∣ψ> = a|0> + b|1>:
a) λ = +1: (X−I) ∣ψ> = 0, hence a = b; with normalizing:

b) λ = -1: (X+I) ∣ψ> = 0, hence a = -b; normalizing:

Behavior X operator:
- X|+⟩ = +|+⟩ (unchanged)
- X|−⟩ = −|−⟩ (phase flip)
- X|0⟩ = |1⟩ (bit flip)
- X|1⟩ = |0⟩ (bit flip)
Note: ∣+> = H∣0> and ∣−> = H∣1>, and in addition

i.e. H rotates the eigenstates of X onto the eigenstates of Z; |+>, |-> is also referred as X basis
7. Sources
- [1] Quantum Computation and Quantum Information, Nielsen, Chuang, Cambridge Press
- [2] ‚Stabilizer codes for quantum error correction‘ by Chelluri et al., 2025 (pennylane.ai/qml/demos/tutorial_stabilizer_codes)
- [3] ‚Quantum codesand quantum error correction‘ by christianb93, 2018 (github.com/christianb93/QuantumComputing/blob/master/QEC/QuantumErrorCorrection.pdf)
- [4] ‚Perfect Quantum Error Correction Code‘ by Laflamme et al., 1996 (arxiv.org/abs/quant-ph/9602019)
- [5] ‚Stabilizer Codes and Quantum Error Correction‘ by Gottesman, 1997 (arxiv.org/pdf/quant-ph/9705052)
- [6] ‚Quantum error correction: an introduction to toric codes‘ by christianb93, 2019 (leftasexercise.com/2019/03/25/qec-an-introduction-to-toric-codes/)
- [7] ‚Toric code‘ by IBM Learning, (quantum.cloud.ibm.com/learning/en/courses/foundations-of-quantum-error-correction/quantum-code-constructions/toric-code)
- [8] ‚PyMatching: A Python Package for Decoding Quantum Codes with Minimum-Weight Perfect Matching‘ by Higgott, 2022 (dl.acm.org/doi/full/10.1145/3505637)
- [9] ‚Suppressing quantum errors by scaling a surface code logical qubit‘ by Google Quantum AI, 2023 (research.google/blog/suppressing-quantum-errors-by-scaling-a-surface-code-logical-qubit/)
- [10] ‚Renormalized field theory of collapsing randomly branched polymers‘ by Janssen et al., 2009 (arxiv.org/pdf/0907.3430)
- [11] Vorlesungen über Physik – Band 3: Quantenmechanik, Feynman, Leigthon, Sands, Oldenbourg Verlag
Schreibe einen Kommentar