# Stabilizer Measurements¶

Stabilizer codes are a large and important family of quantum error-correcting codes. These codes are defined as joint eigenspaces of a collection of operators known as stabilizers. The eigenvalues of the stabilizers are used to detect and diagnose errors. Therefore, many quantum error-correction protocols make stabilizer measurements to obtain these eigenvalues. One way to implement a stabilizer measurement is to use extra qubits, known as syndrome qubits, to detect errors on data qubits that are part of your computation. Stabilizer measurements can identify a collective property of a set of data qubits; one such property is the qubits’ parity.

Consider the quantum bit-flip code again. The bit-flip code is a stabilizer code, and one choice for its stabilizers is $$Z\otimes Z\otimes I$$ and $$I\otimes Z\otimes Z$$. A valid codeword is a $$+1$$ eigenstate of these stabilizer operators. For $$Z$$-type operators such as these, the stabilizer enforces that the parity of the first two qubits is even, and the parity of the second two qubits is even. The stabilizer measurement tells us whether the parity has changed, which we can use to diagnose the error.

In quantum codes such as the surface code, there are $$Z$$-type and $$X$$-type stabilizers to measure. The $$X$$-type stabilizers simply enforce a parity constraint in the $$\{|+\rangle,|-\rangle\}$$ basis. For example, the states $$|++\rangle$$ and $$|--\rangle$$ are $$+1$$ eigenstates of $$X\otimes X$$. The $$Z$$-type stabilizers in the bulk of the surface code have the form $$Z\otimes Z\otimes Z\otimes Z$$ and detect bit-flip errors on the four data qubits that are involved. The $$X$$-type stabilizers in the bulk have the form $$X\otimes X\otimes X\otimes X$$ and detect phase-flip errors. These stabilizer measurements are implemented by computing the associated bit-flip or phase-flip parities into a syndrome qubit.

In the Composer, we can test such stabilizer measurements using $$Q_2$$ as a syndrome qubit, and $$Q_0$$, $$Q_1$$, $$Q_3$$, and $$Q_4$$ as data qubits. The $$Z$$-type parity check is performed using a CNOT gate from each data qubit to the syndrome qubit. The $$X$$-type parity check is simply the conjugate of the $$Z$$-type check, obtained by applying Hadamard gates to the input and output data qubits. In a fault-tolerant implementation of the circuits, the order of gates is important to limit the spread of errors.

The scores below prepare different states of input parity. See if the processor returns the proper parity measurements.

When we ran these experiments we got Plaquette Z 0000 Open in composer

Plaquette Z 0001 Open in composer

Plaquette Z 0010 Open in composer

Plaquette Z 0011 Open in composer

Plaquette Z 0100 Open in composer

Plaquette Z 0101 Open in composer

Plaquette Z 0110 Open in composer

Plaquette Z 0111 Open in composer

Plaquette Z 1000 Open in composer

Plaquette Z 1001 Open in composer

Plaquette Z 1010 Open in composer

Plaquette Z 1011 Open in composer

Plaquette Z 1100 Open in composer

Plaquette Z 1101 Open in composer

Plaquette Z 1110 Open in composer

Plaquette Z 1111 Open in composer

Plaquette X +-+- Open in composer