# Stabilizer code

In quantum computing and quantum communication, a stabilizer code is a class of quantum codes for performing quantum error correction. The toric code, and surface codes more generally, are types of stabilizer codes considered very important for the practical realization of quantum information processing.

## Conceptual background

Quantum error-correcting codes restore a noisy, decohered quantum state to a pure quantum state. A stabilizer quantum error-correcting code appends ancilla qubits to qubits that we want to protect. A unitary encoding circuit rotates the global state into a subspace of a larger Hilbert space. This highly entangled, encoded state corrects for local noisy errors. A quantum error-correcting code makes quantum computation and quantum communication practical by providing a way for a sender and receiver to simulate a noiseless qubit channel given a noisy qubit channel whose noise conforms to a particular error model. The first quantum error-correcting codes are strikingly similar to classical block codes in their operation and performance.
The stabilizer theory of quantum error correction allows one to import some classical binary or quaternary codes for use as a quantum code. However, when importing the classical code, it must satisfy the dual-containing (or self-orthogonality) constraint. Researchers have found many examples of classical codes satisfying this constraint, but most classical codes do not. Nevertheless, it is still useful to import classical codes in this way (though, see how the entanglement-assisted stabilizer formalism overcomes this difficulty).

## Mathematical background

The stabilizer formalism exploits elements of the Pauli group $\Pi$ in formulating quantum error-correcting codes. The set $\Pi =\left\{I,X,Y,Z\right\}$ consists of the Pauli operators:
    $I\equiv {\begin{bmatrix}1&0\\0&1\end{bmatrix}},\ X\equiv {\begin{bmatrix}0&1\\1&0\end{bmatrix}},\ Y\equiv {\begin{bmatrix}0&-i\\i&0\end{bmatrix}},\ Z\equiv {\begin{bmatrix}1&0\\0&-1\end{bmatrix}}.$
The above operators act on a single qubit – a state represented by a vector in a two-dimensional Hilbert space. Operators in $\Pi$ have eigenvalues $\pm 1$ and either commute or anti-commute. The set $\Pi ^{n}$ consists of $n$-fold tensor products of Pauli operators:
    $\Pi ^{n}=\left\{{\begin{array}{c}e^{i\phi }A_{1}\otimes \cdots \otimes A_{n}:\forall j\in \left\{1,\ldots ,n\right\}A_{j}\in \Pi ,\ \ \phi \in \left\{0,\pi /2,\pi ,3\pi /2\right\}\end{array}}\right\}.$
Elements of $\Pi ^{n}$ act on a quantum register of $n$ qubits. We occasionally omit tensor product symbols in what follows so that
    $A_{1}\cdots A_{n}\equiv A_{1}\otimes \cdots \otimes A_{n}.$
The $n$-fold Pauli group $\Pi ^{n}$ plays an important role for both the encoding circuit and the error-correction procedure of a quantum stabilizer code over $n$ qubits.

## Definition

Let us define an $\left[n,k\right]$ stabilizer quantum error-correcting code to encode $k$ logical qubits into $n$ physical qubits. The rate of such a code is $k/n$. Its stabilizer ${\mathcal {S}}$ is an abelian subgroup of the $n$-fold Pauli group $\Pi ^{n}$. ${\mathcal {S}}$ does not contain the operator $-I^{\otimes n}$. The simultaneous $+1$-eigenspace of the operators constitutes the codespace. The codespace has dimension $2^{k}$ so that we can encode $k$ qubits into it. The stabilizer ${\mathcal {S}}$ has a minimal representation in terms of $n-k$ independent generators
    $\left\{g_{1},\ldots ,g_{n-k}\ |\ \forall i\in \left\{1,\ldots ,n-k\right\},\ g_{i}\in {\mathcal {S}}\right\}.$
The generators are independent in the sense that none of them is a product of any other two (up to a global phase). The operators $g_{1},\ldots ,g_{n-k}$ function in the same way as a parity check matrix does for a classical linear block code.

## Stabilizer error-correction conditions

One of the fundamental notions in quantum error correction theory is that it suffices to correct a discrete error set with support in the Pauli group $\Pi ^{n}$. Suppose that the errors affecting an encoded quantum state are a subset ${\mathcal {E}}$ of the Pauli group $\Pi ^{n}$:
    ${\mathcal {E}}\subset \Pi ^{n}.$
Because ${\mathcal {E}}$ and ${\mathcal {S}}$ are both subsets of $\Pi ^{n}$, an error $E\in {\mathcal {E}}$ that affects an encoded quantum state either commutes or anticommutes with any particular element $g$ in ${\mathcal {S}}$. The error $E$ is correctable if it anticommutes with an element $g$ in ${\mathcal {S}}$. An anticommuting error $E$ is detectable by measuring each element $g$ in ${\mathcal {S}}$ and computing a syndrome $\mathbf {r}$ identifying $E$. The syndrome is a binary vector $\mathbf {r}$ with length $n-k$ whose elements identify whether the error $E$ commutes or anticommutes with each $g\in {\mathcal {S}}$. An error $E$ that commutes with every element $g$ in ${\mathcal {S}}$ is correctable if and only if it is in ${\mathcal {S}}$. It corrupts the encoded state if it commutes with every element of ${\mathcal {S}}$ but does not lie in ${\mathcal {S}}$. So we compactly summarize the stabilizer error-correcting conditions: a stabilizer code can correct any errors $E_{1},E_{2}$ in ${\mathcal {E}}$ if
    $E_{1}^{\dagger }E_{2}\notin {\mathcal {Z}}\left({\mathcal {S}}\right)$
or
    $E_{1}^{\dagger }E_{2}\in {\mathcal {S}}$
where ${\mathcal {Z}}\left({\mathcal {S}}\right)$ is the centralizer of ${\mathcal {S}}$ (i.e., the subgroup of elements that commute with all members of ${\mathcal {S}}$, also known as the commutant).

## Simple example of a stabilizer code

A simple example of a stabilizer code is a three qubit $\left[[3,1,3\right]]$ stabilizer code. It encodes $k=1$ logical qubit into $n=3$ physical qubits and protects against a single-bit flip error in the set $\left\{X_{i}\right\}$. This does not protect against other Pauli errors such as phase flip errors in the set $\left\{Y_{i}\right\}$.or $\left\{Z_{i}\right\}$. This has code distance $d=3$. Its stabilizer consists of $n-k=2$ Pauli operators:
    ${\begin{array}{ccc}g_{1}&=&Z&Z&I\\g_{2}&=&I&Z&Z\\\end{array}}$
If there are no bit-flip errors, both operators $g_{1}$ and $g_{2}$ commute, the syndrome is +1,+1, and no errors are detected.
If there is a bit-flip error on the first encoded qubit, operator $g_{1}$ will anti-commute and $g_{2}$ commute, the syndrome is -1,+1, and the error is detected. If there is a bit-flip error on the second encoded qubit, operator $g_{1}$ will anti-commute and $g_{2}$ anti-commute, the syndrome is -1,-1, and the error is detected. If there is a bit-flip error on the third encoded qubit, operator $g_{1}$ will commute and $g_{2}$ anti-commute, the syndrome is +1,-1, and the error is detected.

## Example of a stabilizer code

An example of a stabilizer code is the five qubit $\left[[5,1,3\right]]$ stabilizer code. It encodes $k=1$ logical qubit into $n=5$ physical qubits and protects against an arbitrary single-qubit error. It has code distance $d=3$. Its stabilizer consists of $n-k=4$ Pauli operators:
    ${\begin{array}{ccccccc}g_{1}&=&X&Z&Z&X&I\\g_{2}&=&I&X&Z&Z&X\\g_{3}&=&X&I&X&Z&Z\\g_{4}&=&Z&X&I&X&Z\end{array}}$
The above operators commute. Therefore, the codespace is the simultaneous +1-eigenspace of the above operators. Suppose a single-qubit error occurs on the encoded quantum register. A single-qubit error is in the set $\left\{X_{i},Y_{i},Z_{i}\right\}$ where $A_{i}$ denotes a Pauli error on qubit $i$. It is straightforward to verify that any arbitrary single-qubit error has a unique syndrome. The receiver corrects any single-qubit error by identifying the syndrome via a parity measurement and applying a corrective operation.

## Relation between Pauli group and binary vectors

A simple but useful mapping exists between elements of $\Pi$ and the binary vector space $\left(\mathbb {Z} _{2}\right)^{2}$. This mapping gives a simplification of quantum error correction theory. It represents quantum codes with binary vectors and binary operations rather than with Pauli operators and matrix operations respectively.
We first give the mapping for the one-qubit case. Suppose $\left[A\right]$ is a set of equivalence classes of an operator $A$ that have the same phase:
    $\left[A\right]=\left\{\beta A\ |\ \beta \in \mathbb {C} ,\ \left\vert \beta \right\vert =1\right\}.$
Let $\left[\Pi \right]$ be the set of phase-free Pauli operators where $\left[\Pi \right]=\left\{\left[A\right]\ |\ A\in \Pi \right\}$. Define the map $N:\left(\mathbb {Z} _{2}\right)^{2}\rightarrow \Pi$ as
    $00\to I,\,\,01\to X,\,\,11\to Y,\,\,10\to Z$
Suppose $u,v\in \left(\mathbb {Z} _{2}\right)^{2}$. Let us employ the shorthand $u=\left(z|x\right)$ and $v=\left(z^{\prime }|x^{\prime }\right)$ where $z$, $x$, $z^{\prime }$, $x^{\prime }\in \mathbb {Z} _{2}$. For example, suppose $u=\left(0|1\right)$. Then $N\left(u\right)=X$. The map $N$ induces an isomorphism $\left[N\right]:\left(\mathbb {Z} _{2}\right)^{2}\rightarrow \left[\Pi \right]$ because addition of vectors in $\left(\mathbb {Z} _{2}\right)^{2}$ is equivalent to multiplication of Pauli operators up to a global phase:
    $\left[N\left(u+v\right)\right]=\left[N\left(u\right)\right]\left[N\left(v\right)\right].$
Let $\odot$ denote the symplectic product between two elements $u,v\in \left(\mathbb {Z} _{2}\right)^{2}$:
    $u\odot v\equiv zx^{\prime }-xz^{\prime }.$
The symplectic product $\odot$ gives the commutation relations of elements of $\Pi$:
    $N\left(u\right)N\left(v\right)=\left(-1\right)^{\left(u\odot v\right)}N\left(v\right)N\left(u\right).$
The symplectic product and the mapping $N$ thus give a useful way to phrase Pauli relations in terms of binary algebra. The extension of the above definitions and mapping $N$ to multiple qubits is straightforward. Let $\mathbf {A} =A_{1}\otimes \cdots \otimes A_{n}$ denote an arbitrary element of $\Pi ^{n}$. We can similarly define the phase-free $n$-qubit Pauli group $\left[\Pi ^{n}\right]=\left\{\left[\mathbf {A} \right]\ |\ \mathbf {A} \in \Pi ^{n}\right\}$ where
    $\left[\mathbf {A} \right]=\left\{\beta \mathbf {A} \ |\ \beta \in \mathbb {C} ,\ \left\vert \beta \right\vert =1\right\}.$
The group operation $\ast$ for the above equivalence class is as follows:
    $\left[\mathbf {A} \right]\ast \left[\mathbf {B} \right]\equiv \left[A_{1}\right]\ast \left[B_{1}\right]\otimes \cdots \otimes \left[A_{n}\right]\ast \left[B_{n}\right]=\left[A_{1}B_{1}\right]\otimes \cdots \otimes \left[A_{n}B_{n}\right]=\left[\mathbf {AB} \right].$
The equivalence class $\left[\Pi ^{n}\right]$ forms a commutative group under operation $\ast$. Consider the $2n$-dimensional vector space
    $\left(\mathbb {Z} _{2}\right)^{2n}=\left\{\left(\mathbf {z,x} \right):\mathbf {z} ,\mathbf {x} \in \left(\mathbb {Z} _{2}\right)^{n}\right\}.$
It forms the commutative group $(\left(\mathbb {Z} _{2}\right)^{2n},+)$ with operation $+$ defined as binary vector addition. We employ the notation $\mathbf {u} =\left(\mathbf {z} |\mathbf {x} \right),\mathbf {v} =\left(\mathbf {z} ^{\prime }|\mathbf {x} ^{\prime }\right)$ to represent any vectors $\mathbf {u,v} \in \left(\mathbb {Z} _{2}\right)^{2n}$ respectively. Each vector $\mathbf {z}$ and $\mathbf {x}$ has elements $\left(z_{1},\ldots ,z_{n}\right)$ and $\left(x_{1},\ldots ,x_{n}\right)$ respectively with similar representations for $\mathbf {z} ^{\prime }$ and $\mathbf {x} ^{\prime }$. The symplectic product $\odot$ of $\mathbf {u}$ and $\mathbf {v}$ is
    $\mathbf {u} \odot \mathbf {v\equiv } \sum _{i=1}^{n}z_{i}x_{i}^{\prime }-x_{i}z_{i}^{\prime },$
or
    $\mathbf {u} \odot \mathbf {v\equiv } \sum _{i=1}^{n}u_{i}\odot v_{i},$
where $u_{i}=\left(z_{i}|x_{i}\right)$ and $v_{i}=\left(z_{i}^{\prime }|x_{i}^{\prime }\right)$. Let us define a map $\mathbf {N} :\left(\mathbb {Z} _{2}\right)^{2n}\rightarrow \Pi ^{n}$ as follows:
    $\mathbf {N} \left(\mathbf {u} \right)\equiv N\left(u_{1}\right)\otimes \cdots \otimes N\left(u_{n}\right).$
Let
    $\mathbf {X} \left(\mathbf {x} \right)\equiv X^{x_{1}}\otimes \cdots \otimes X^{x_{n}},\,\,\,\,\,\,\,\mathbf {Z} \left(\mathbf {z} \right)\equiv Z^{z_{1}}\otimes \cdots \otimes Z^{z_{n}},$
so that $\mathbf {N} \left(\mathbf {u} \right)$ and $\mathbf {Z} \left(\mathbf {z} \right)\mathbf {X} \left(\mathbf {x} \right)$ belong to the same equivalence class:
    $\left[\mathbf {N} \left(\mathbf {u} \right)\right]=\left[\mathbf {Z} \left(\mathbf {z} \right)\mathbf {X} \left(\mathbf {x} \right)\right].$
The map $\left[\mathbf {N} \right]:\left(\mathbb {Z} _{2}\right)^{2n}\rightarrow \left[\Pi ^{n}\right]$ is an isomorphism for the same reason given as in the previous case:
    $\left[\mathbf {N} \left(\mathbf {u+v} \right)\right]=\left[\mathbf {N} \left(\mathbf {u} \right)\right]\left[\mathbf {N} \left(\mathbf {v} \right)\right],$
where $\mathbf {u,v} \in \left(\mathbb {Z} _{2}\right)^{2n}$. The symplectic product captures the commutation relations of any operators $\mathbf {N} \left(\mathbf {u} \right)$ and $\mathbf {N} \left(\mathbf {v} \right)$:
    $\mathbf {N\left(\mathbf {u} \right)N} \left(\mathbf {v} \right)=\left(-1\right)^{\left(\mathbf {u} \odot \mathbf {v} \right)}\mathbf {N} \left(\mathbf {v} \right)\mathbf {N} \left(\mathbf {u} \right).$
The above binary representation and symplectic algebra are useful in making the relation between classical linear error correction and quantum error correction more explicit.
By comparing quantum error correcting codes in this language to symplectic vector spaces, we can see the following. A symplectic subspace corresponds to a direct sum of Pauli algebras (i.e., encoded qubits), while an isotropic subspace corresponds to a set of stabilizers.