|q⟩ Bad Qubits

advanced · Physics · Stabilizer Formalism & CSS Codes

Measuring Stabilizers

A stabilizer code protects information without ever directly measuring the data. Instead we measure the stabilizer generators. Each measurement returns a ±1\pm 1 eigenvalue, and the pattern of results — the syndrome — tells us which error occurred, while leaving the encoded state intact.

Why measure stabilizers and not the data

Measuring a data qubit in the computational basis would collapse the superposition we are trying to protect. The trick of quantum error correction is to measure operators that commute with the encoded information and whose eigenvalues reveal only the error. The stabilizer generators are exactly such operators: they act as +1+1 on the codespace, so on an error-free state they return +1+1 and disturb nothing. An error EE shifts the eigenvalue of any generator it anticommutes with to 1-1, flagging the error without exposing the logical state.

The syndrome

For a code with generators g1,,grg_1, \dots, g_r and an error EE acting on a codeword ψ|\psi\rangle,

giEψ  =  ±Egiψ  =  ±Eψ,g_i \, E\,|\psi\rangle \;=\; \pm\, E\, g_i\,|\psi\rangle \;=\; \pm\, E\,|\psi\rangle,

with the sign equal to +1+1 if gig_i and EE commute and 1-1 if they anticommute. The syndrome is the bit string

s=(s1,,sr),si={0giE=Egi1giE=Egis = (s_1, \dots, s_r), \qquad s_i = \begin{cases} 0 & g_i E = E g_i \\ 1 & g_i E = -E g_i \end{cases}

It is a function of the error alone, not of ψ|\psi\rangle. Different correctable errors produce different syndromes, and a decoder maps the syndrome back to a recovery operation.

Measuring a stabilizer with an ancilla

We extract one syndrome bit per generator using an ancilla qubit. The standard circuit for a ZZ-type parity ZaZbZ_a Z_b is:

  1. Prepare an ancilla in 0|0\rangle.
  2. Apply CNOT\mathrm{CNOT} from data qubit aa to the ancilla, then from bb to the ancilla.
  3. Measure the ancilla in the computational basis.

Each CNOT XORs a data bit into the ancilla, so after both the ancilla holds the parity qaqbq_a \oplus q_b — outcome 00 means eigenvalue +1+1, outcome 11 means 1-1. Crucially, because the ancilla is controlled by the data, it learns only the parity, never the individual bit values, so the encoded superposition survives. (XX-type stabilizers are measured the same way after conjugating the ancilla with Hadamards, or equivalently using the ancilla as the control.)

A worked example: the bit-flip code

The three-qubit bit-flip code has stabilizers g1=Z0Z1g_1 = Z_0 Z_1 and g2=Z1Z2g_2 = Z_1 Z_2. The four single-qubit bit-flip errors give the syndromes:

| Error | Anticommutes with | Syndrome (s1,s2)(s_1, s_2) | | --- | --- | --- | | none | — | (0,0)(0,0) | | X0X_0 | g1g_1 | (1,0)(1,0) | | X1X_1 | g1,g2g_1, g_2 | (1,1)(1,1) | | X2X_2 | g2g_2 | (0,1)(0,1) |

Every distinct correctable error has a distinct syndrome, so the decoder simply inverts the table: syndrome (1,1)(1,1) means "flip qubit 1." This is the discrete, classical core of error correction.

Try it

Encode 0L=000|0_L\rangle = |000\rangle, inject a bit-flip XX on data qubit 11, then measure both stabilizers Z0Z1Z_0 Z_1 and Z1Z2Z_1 Z_2 onto two ancillas. Read out the syndrome — it should be 1111.

Run your code to see the quantum state.

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