# How do we find the stabilizer generators for the three-qubit bit-flip code spanned by $|000\rangle$ and $|111\rangle$?

In Nielsen & Chuang's book "Quantum Computation and Quantum Information" section 10.5.6, page 467 there is the following statement

Consider the familiar three-qubit bit-flip code spanned by the states $$|000\rangle$$ and $$|111\rangle$$, with stabilizer generated by $$Z_{1}Z_{2}$$ and $$Z_{2}Z_{3}$$.

1. How do we find these stabilizer generators?

2. Is this stabilizer set is unique? ( code spanned by $$|000\rangle$$ and $$|111\rangle$$, have only $$Z_{1}Z_{2}$$ and $$Z_{2}Z_{3}$$ as generator stabilizer nothing else?)

Finding stabilizers

By definition, a stabilizer group of a subspace of the Hilbert space of $$n$$ qubits is a subgroup of the $$n$$-qubit Pauli group. It is easy to see that stabilizers can only have $$+1$$ and $$-1$$ phase. Therefore, there are $$2 \cdot 4^n$$ candidate operators that could be stabilizers for the subspace. This seems large, but in practice one can quickly eliminate a large set of possibilities and then check which remaining operators fix the vectors in the subspace. It is useful to know that a $$2^k$$-dimensional subspace has $$n-k$$ stabilizer generators. In particular, every stabilizer state defines a $$1$$-dimensional subspace and therefore has exactly $$n$$ stabilizer generators.

For example, the three-qubit bit-flip code encodes one logical qubit, so $$k=1$$ and we are looking for two stabilizer generators. We notice that any operator that acts as Pauli $$X$$ or Pauli $$Y$$ on any of the three qubits fails to fix $$|000\rangle$$. This observation immediately rules out $$112$$ of $$128$$ candidate operators leaving only

$$\begin{array}{cccc} III & IIZ & IZI & ZII \\ ZZI & ZIZ & ZZI & ZZZ \\ \end{array}$$

and their negations. The identity operator belongs to every subgroup of the Pauli group but is not a generator. Its negation has no eigenvalue $$1$$ so it is not a stabilizer of any state. Operators with an odd number of Pauli $$Z$$ stabilize $$|000\rangle$$, but fail to stabilize $$|111\rangle$$. Among the remaining operators all those with positive phase stabilize both states. Therefore, the stabilizer group of the three-qubit bit-flip code is $$S=\{III, IZZ, ZIZ, ZZI\}.$$Finally, we see that any two non-identity operators in $$S$$ generate $$S$$.

Note that this approach works for small $$n$$. However, in practice when $$n$$ is large we never write down individual states, because they are often exponentially large superpositions of computational basis states. In fact, the very objective of stabilizer formalism is to allow us not to do that. Therefore, for large $$n$$ stabilizer generators are used to provide initial description of a subspace or state and then are used directly in analysis to derive properties, design circuits, find transversal gates etc.

Uniqueness of stabilizers

Care should be taken to distinguish two concepts: stabilizer group and stabilizer generators. Stabilizer group of a subspace contains all $$n$$-qubit Pauli operators that fix vectors in that subspace. Therefore, it is unique. However, this group has many different sets of independent generators. Suppose that $$S$$ is generated by $$g_1, g_2, \dots, g_m$$ and that $$g$$ is any operator generated by $$g_2, \dots, g_m$$. Then the operators $$gg_1, g_2, \dots g_m$$ are generators of $$S$$. Therefore, a set of independent stabilizer generators is not unique.

For example, we saw earlier that the stabilizer group of the three-qubit bit-flip code has three different sets of generators

$$G_1 = \{IZZ, ZIZ\} \\ G_2 = \{ZIZ, ZZI\} \\ G_3 = \{ZZI, IZZ\}.$$