|q⟩ Bad Qubits

advanced · Programming · Implementing the Surface Code

Plaquette and Vertex Stabilizers

Each tile of the surface-code lattice carries a stabilizer: a multi-qubit Pauli operator whose value the code measures every round. The two colours of tile correspond to the two species of check.

The two check types

Label the data qubits around an interior tile 1,2,3,41, 2, 3, 4. The two stabilizer types are

Av=X1X2X3X4(vertex, X-type),Bp=Z1Z2Z3Z4(plaquette, Z-type).A_v = X_1 X_2 X_3 X_4 \quad(\text{vertex, } X\text{-type}), \qquad B_p = Z_1 Z_2 Z_3 Z_4 \quad(\text{plaquette, } Z\text{-type}).

A ZZ-type plaquette measures the joint parity of its data qubits in the computational (ZZ) basis; it detects bit-flip (XX) errors. An XX-type vertex measures parity in the conjugate (XX) basis; it detects phase-flip (ZZ) errors. Together the two families catch any single-qubit Pauli error, because every Pauli is a product of XX and ZZ.

The protected code space is the simultaneous +1+1 eigenspace of all the stabilizers: a state ψ|\psi\rangle is a valid codeword exactly when Avψ=+ψA_v|\psi\rangle = +|\psi\rangle and Bpψ=+ψB_p|\psi\rangle = +|\psi\rangle for every tile.

Why the checks commute

We can only measure all these operators in one round without disturbing each other if they commute. A ZZ-type and an XX-type tile always share an even number of data qubits — in the surface code, either zero or two. On each shared qubit the local operators are XX and ZZ, which anticommute (XZ=ZXXZ = -ZX); two anticommutations cancel, so the full operators commute:

(X1X2)(Z1Z2)=(X1Z1)(X2Z2)=(Z1X1)(Z2X2)=(Z1Z2)(X1X2),(X_1X_2)(Z_1Z_2) = (X_1Z_1)(X_2Z_2) = (-Z_1X_1)(-Z_2X_2) = (Z_1Z_2)(X_1X_2),

so two shared qubits give two sign flips that cancel and [Av,Bp]=0[A_v, B_p] = 0. (Tiles that share no qubits commute trivially; sharing exactly one qubit would instead give a single sign flip and anticommutation, which is precisely why the lattice is arranged so overlaps are always even.)

Because they commute, the stabilizers can be assigned definite values simultaneously, and measuring them tells us about errors without revealing — or collapsing — the logical state.

A two-qubit example you can build

The smallest non-trivial stabilizer state lets us see the idea directly. Consider a single XX-type check X0X1X_0 X_1 on two data qubits. Its +1+1 eigenstate with the data also stabilized by Z0Z1Z_0 Z_1 is the Bell state

Φ+=00+112.|\Phi^+\rangle = \frac{|00\rangle + |11\rangle}{\sqrt{2}}.

Check it: X0X1Φ+=12(11+00)=+Φ+X_0X_1|\Phi^+\rangle = \tfrac{1}{\sqrt2}(|11\rangle + |00\rangle) = +|\Phi^+\rangle, and Z0Z1Φ+=12(00+11)=+Φ+Z_0Z_1|\Phi^+\rangle = \tfrac{1}{\sqrt2}(|00\rangle + |11\rangle) = +|\Phi^+\rangle. The state is a simultaneous +1+1 eigenstate of both an XX-type and a ZZ-type check — a one-line toy version of a codeword.

Try it

Prepare the state Φ+|\Phi^+\rangle on two qubits with a Hadamard followed by a CNOT. The grader checks the resulting state vector against the +1+1 eigenstate of X0X1X_0X_1 and Z0Z1Z_0Z_1.

Run your code to see the quantum state.

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