Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Tutorial

Stabilizer Formalism

Abstract

The stabilizer formalism of quantum error correction.

Keywords:qubitsRepetition Codebit-flipsphase errors.

The stabilizer formalism is a method for creating error correcting codes using the Pauli-group. In addition to allowing certain errors to be detected and corrected, logical gates can also be performed in this framework.

Pauli-group

The generators of the qubit Pauli-group are

P1=⟨X,Z,iI⟩.\mathcal{P}_1 = \langle X, Z, i\mathbb{I} \rangle.

From these operators all elements of the one qubit Pauli-group can be generated. The Pauli-group is the set of Pauli-operators plus identity with all possible phases of {±1,±i}\{\pm 1, \pm i \}.

The nn-qubit Pauli-group , Pn\mathcal{P}_n, is then the nn-fold tensor product of elements in the one qubit Pauli-group. All elements in Pn\mathcal{P}_n either commute or anit-commute,

P1P2=(±)P2P1  ∀  P1,P2 ∈ Pn,P_1P_2 = (\pm)P_2P_1 ~~ \forall ~ ~ P_1, P_2~\in~\mathcal{P}_n,

All elements of the Pauli-group have eigenvalues {+1,−1}\{+1, -1\} or {+i,−i}\{+i, -i\}. Here, we mostly consider just the elements with eigenvalues {+1,−1}\{+1, -1\} (the Hermitian elements of the Pauli-group).

See the Pauli Group Page for more detail.

Stabilizer Codes

Definition

The stabilizers of an error correcting code are defined as

S={Pi∈Pn:Pi∣ψ⟩L=∣ψ⟩L ∀ ∣ψ⟩L∧[Pi,Pj]=0 ∀ (i,j)},\mathcal{S} = \big\{ P_i \in \mathcal{P}_n: P_i \ket{\psi}_L = \ket{\psi}_L~\forall~\ket{\psi}_L \wedge [P_i, P_j] = 0 ~ \forall ~ (i,j) \big\},

such that −I∉S-\mathbb{I} \notin \mathcal{S}. The stabilizers are therefore an Abelian subgroup of the nn-qubit Pauli-group, Pn\mathcal{P}_n, such that all logical states (states in the code space) are (+1)(+1) eigenstates of each stabilizer, that does not contain the negative identity operator.

The justification of these conditions are as follows:

  1. Pi∣ψ⟩L=∣ψ⟩L ∀ ∣ψ⟩LP_i \ket{\psi}_L = \ket{\psi}_L~\forall~\ket{\psi}_L:

    This avoids any logical information encoded in the code space being destroyed when a stablizer is measured on ∣ψ⟩L\ket{\psi}_L.

    Further Details

    A state, ∣ω⟩\ket{\omega} is said to be stabilized by an operator UU if U∣ω⟩=∣ω⟩U\ket{\omega} = \ket{\omega}, meaning ∣ω⟩\ket{\omega} is a (+1)(+1) eigenstate of UU.

    From the above definition of S\mathcal{S}, it can be seen that ∀ Pi∈S\forall~P_i \in \mathcal{S} all logical states ∣ψ⟩L\ket{\psi}_L are stabilized by PiP_i. Therefore, if one were to measure or apply PiP_i on any logical state ∣ψ⟩L\ket{\psi}_L they would return the state ∣ψ⟩L\ket{\psi}_L unchanged. This avoids any logical information encoded in the code space being destroyed when a stablizer is measured on ∣ψ⟩L\ket{\psi}_L. (Does it also prevent loss of logical information in general? I am currently not sure).

    One can reverse this definition, and defined the code space to be the subspace of the total Hilbert space that is stabilized by all elements of S\mathcal{S}. Phrased alternatively, the code space is defined as the intersection of all (+1)(+1) eigenspaces of the elements of S\mathcal{S}.

  2. [Pi,Pj]=0[P_i, P_j] = 0:

    If this condition is not met, only the trivial space can be stabilized.

    Proof

    Let Pi,Pj∈PnP_i, P_j \in \mathcal{P}_n such that [Pi,Pj]≠0[P_i, P_j] \neq 0. Moreover, assume they both stabilize ∣ψ⟩L\ket{\psi}_L such that

    Pi∣ψ⟩L=Pj∣ψ⟩L=∣ψ⟩L.P_i \ket{\psi}_L = P_j \ket{\psi}_L = \ket{\psi}_L.

    Firstly, note that given that all elements of Pn\mathcal{P}_n commute or anti-commute,

    [Pi,Pj]≠0  ⟹  PiPj+PjPi=0.[P_i, P_j] \neq 0 \implies P_iP_j + P_jP_i = 0.

    Secondly, the products, PiPjP_iP_j and PjPiP_jP_i also stabilize ∣ψ⟩L\ket{\psi}_L if PiP_i and PjP_j individually stabilize ∣ψ⟩L\ket{\psi}_L, such that

    PiPj∣ψ⟩L=∣ψ⟩L,PjPi∣ψ⟩L=∣ψ⟩L.\begin{align*} P_iP_j \ket{\psi}_L &= \ket{\psi}_L, \\ P_jP_i \ket{\psi}_L &= \ket{\psi}_L. \end{align*}

    Putting these facts together implies that

    PjPi∣ψ⟩L=−PiPj∣ψ⟩L,=−∣ψ⟩L,=∣ψ⟩L.\begin{align*} P_jP_i \ket{\psi}_L &= - P_iP_j \ket{\psi}_L, \\ &= - \ket{\psi}_L, \\ &= \ket{\psi}_L. \end{align*}

    This is only true if ∣ψ⟩L=0\ket{\psi}_L = 0, meaning that non-Abelian subgroups of Pn\mathcal{P}_n can only stabilize a trivial subspace.

    (Note, the equation ∣ψ⟩=−∣ψ⟩\ket{\psi}=-\ket{\psi} is about the physical equivalence of vectors in a Hilbert space, with this equation only being satasfied for the zero vector. It is not about whether two states are physically distinguishable under global phases.)

  3. −I∉S- \mathbb{I} \notin \mathcal{S}:

    If this condition is not met, only the trivial space can be stabilized.

    Proof

    All states are stabilized by I\mathbb{I},

    (I)∣ψ⟩L=∣ψ⟩L.(\mathbb{I} ) \ket{\psi}_L = \ket{\psi}_L.

    Hence, I∈S\mathbb{I} \in \mathcal{S} for all possible S\mathcal{S}.

    If one assumes that −I∈S-\mathbb{I} \in \mathcal{S}, then one needs

    (−I)∣ψ⟩L=∣ψ⟩L,\big( - \mathbb{I} \big) \ket{\psi}_L = \ket{\psi}_L,

    by definition of S\mathcal{S}. Combining these two facts implys that

    ∣ψ⟩L=−∣ψ⟩L,\ket{\psi}_L = - \ket{\psi}_L,

    which is only true if ∣ψ⟩L=0\ket{\psi}_L = 0, meaning that S\mathcal{S} would only stabilize a trivial subspace.

The Role of the Stabilizers

The stabilizers are used to separate a Hilbert space into a series of orthogonal subspaces, as per the structure of QEC codes.

Each stabliser, PiP_i, is an element of the Pauli-group and can therefore be written as

Pi=Π+i−Π−i,P_i = \Pi^i_{+} - \Pi^i_{-},

where Π+i\Pi^i_{+} is the projector onto the +1 eigenspace of PiP_i and Π−i\Pi^i_{-} the projector onto the -1 eigenspace of PiP_i. One can then defined the code space via the projector

ΠCL=∩i=0∣S∣Π+i,\Pi_{\mathfrak{C}_L} = \cap_{i=0}^{\vert \mathcal{S} \vert} \Pi^i_{+},

which is the projector onto the intersection of all the positive eigenspaces of the stabilizers.

The intersection of all the different combinations of the positive and negative eigenspaces of the stabilizers are all pairwise orthogonal, and they define each of the orthogonal subspaces of the QEC code.

An error that maps the code space to one of these orthogonal subspaces can therefore be detected by measuring the observable who’s eigenspaces are exactly these orthogonal subspaces.

Stabilizer Generators

The stabilizers form an (abelian) subgroup of the nn-qubit Pauli-group. Hence, they can be represented in terms of a set of independent generators 💭.

The code space of a stabilizer code can then be defined from the stabilizer generators only.

To see this, let S=⟨S~⟩\mathcal{S} = \langle \tilde{S} \rangle where S~={S1,S2,…,Sm}\tilde{S} = \big\{ S_1, S_2, \ldots, S_m \big\} for Si∈Pn∀ iS_i \in \mathcal{P}_n \forall~i. If

Si∣ψ⟩L=∣ψ⟩L  and  Sj∣ψ⟩L=∣ψ⟩LS_i \vert \psi \rangle_L = \vert \psi \rangle_L ~ ~ {\rm and} ~ ~ S_j \vert \psi \rangle_L = \vert \psi \rangle_L

then

SiSj∣ψ⟩L=Si∣ψ⟩L=∣ψ⟩L.S_i S_j \vert \psi \rangle_L = S_i \vert \psi \rangle_L = \vert \psi \rangle_L.

Hence, any state in the +1 eigenspace of both SiS_i and SjS_j is also in the +1 eigenspace of their product SiSjS_iS_j. Therefore, the simultaneous +1 eigenspace of the generators is the simultaneous +1 eigenspace of the stabilizers, and hence, is the code space.

Moreover, only the stabilizer generators need to be measured, as the measurements of all other stabilizers can be calculated in post-processing from the measurement outcomes of the generators.

Proof

Let SiS_i and SjS_j be stabilizer generators, such that Si,Sj∈PnS_i, S_j \in \mathcal{P}_n and [Si,Sj]=0[S_i, S_j]=0. Moreover, let

Si∣ψ⟩L=α∣ψ⟩L  and  Sj∣ψ⟩L=β∣ψ⟩L,S_i \vert \psi \rangle_L = \alpha \vert \psi \rangle_L ~ ~ {\rm and} ~ ~ S_j \vert \psi \rangle_L = \beta \vert \psi \rangle_L,

where α,β∈{0,1}\alpha, \beta \in \{0,1\}.

The eigenvalue of the stabilizer SiSj=SjSiS_iS_j=S_jS_i is then

SiSj∣ψ⟩L=Si(β∣ψ⟩L)=β(Si∣ψ⟩L)=βα∣ψ⟩L.\begin{align*} S_iS_j \vert \psi \rangle_L &= S_i (\beta \vert \psi \rangle_L) \\ &= \beta (S_i \vert \psi \rangle_L) \\ &= \beta \alpha \vert \psi \rangle_L. \end{align*}

Hence, the eigenvalue of SiSjS_iS_j is just the product of the eigenvalues of SiS_i and SjS_j.

Number of Logical Qubits

If a code on nn physical qubits has mm stabilizer generators, then the number of logical qubits, kk, is given by

k=n−m.k = n - m.
Proof

Each stabilizer generator is an element of the Pauli-group, meaning its +1 and -1 eigenspaces evenly split the Hilbert space.

Given a Hilbert space of nn-qubits, its dimension is 2n2^n. The dimension of the +1 eigenspace of a stabilizer generator is therefore 2n/2=2n−12^n/2 = 2^{n-1}. Hence, the constraint of a stabilizer generator can be thought of as removing one qubit from the Hilbert space.

We now aim to show that each additional stabilizer generator removes one further qubit from the Hilbert space.

Let SiS_i and SjS_j be stabilizer generators, such that Si,Sj∈PnS_i, S_j \in \mathcal{P}_n and [Si,Sj]=0[S_i, S_j]=0. Both SiS_i and SjS_j can be decomposed in their eigenbasis as

Si=Π+i−Π−iSj=Π+j−Π−j,\begin{align*} S_i &= \Pi^i_{+} - \Pi^i_{-} \\ S_j &= \Pi^j_{+} - \Pi^j_{-}, \end{align*}

where

Π±α=I±Sα2.\Pi^\alpha_{\pm} = \frac{\mathbb{I} \pm S_\alpha}{2}.

As [Si,Sj]=0[S_i, S_j]=0, the projector onto simultaneous +1 eigenspace is given by

Π+jΠ+i=Π+iΠ+j.\Pi^j_{+}\Pi^i_{+} = \Pi^i_{+}\Pi^j_{+}.

The dimension of a projector is then given by its trace, meaning the dimension of this projector is therefore

tr[Π+jΠ+i]=tr[(I+Sj2)(I+Si2)]=14tr[I+Si+Sj+SjSi]=2n4,\begin{align*} {\rm tr}\big[ \Pi^j_{+}\Pi^i_{+} \big] &= {\rm tr}\bigg[ \bigg( \frac{\mathbb{I} + S_j}{2} \bigg) \bigg( \frac{\mathbb{I} + S_i}{2} \bigg) \bigg] \\ &= \frac{1}{4} \textrm{tr} \big[ \mathbb{I} + S_i + S_j + S_j S_i \big] \\ &= \frac{2^n}{4}, \end{align*}

where we have used the fact that the trace of non-identity elements of the Pauli-group is zero, and SiSj≠IS_i S_j \neq \mathbb{I} as SiS_i and SjS_j are independent stabilizer generators.

Hence, the addition of another constraint of a stabilizer generator half’s the size of the simultaneous +1 eigenspace.

This can be generalized to rr independent commuting stabilizers, with each additional stabilizer generator halving the size of the simultaneous +1 eigenspace. Therefore, given mm stabilizer generators, the size of the simultaneous +1 eigenspace is

2n2m=2n−m,\frac{2^n}{2^m} = 2^{n-m},

which is a space capable of encoding k=n−mk=n-m qubits.

Logical Operators

A logical operator is an operator that acts on encoded states in the same way as it would act on a physical state. This means all expected commutations relations must hold.

The possible logical operators of a stabilizer code are

N(S)∖S,N(\mathcal{S}) \setminus \mathcal{S},

where N(S)N(\mathcal{S}) is the normalizer of S\mathcal{S}.

All elements of the Pauli-group commute or anti-commute, and the stabilizer generators never include −I-\mathbb{I}. Hence, the normalizer of S\mathcal{S} is equal to the centralizer of SS.

The possible logical operators are therefore the elements of the Pauli-group that mutually commute with all elements of S\mathcal{S} but are not in S\mathcal{S}.

This definition ensures that states acted upon by a logical operator remain within the code space.

Proof

Let ∣ψ⟩L\vert \psi \rangle_L be an arbitrary state in the code space i.e., the +1 eigenspace of all stabilizers S\mathcal{S}, and let S∈SS \in \mathcal{S}. Hence, S∣ψ⟩L=∣ψ⟩LS \vert \psi \rangle_L = \vert \psi \rangle_L.

Now, let U∈N(S)∖SU \in N(\mathcal{S}) \setminus \mathcal{S}. We now aim to show that U∣ψ⟩LU \vert \psi \rangle_L remains inside the code space.

This is actually easy to see as

S(U∣ψ⟩L)=U(S∣ψ⟩L)=U∣ψ⟩L,\begin{align*} S(U \vert \psi \rangle_L) &= U (S \vert \psi \rangle_L) \\ &= U \vert \psi \rangle_L, \end{align*}

as [U,S]=0[U,S]=0. Hence, if ∣ψ⟩L\vert \psi \rangle_L was in the +1 eigenspace of SS, so is U∣ψ⟩LU \vert \psi \rangle_L.

The above was true for an arbitrary stabilizer and, given all stabilizers commute, will generalize to the application of any number of stabilizers.

Hence, if ∣ψ⟩L\vert \psi \rangle_L is in the simultaneous +1 eigenspace of all stabilizers, then so is U∣ψ⟩LU \vert \psi \rangle_L.

Uniqueness

Logical operators are not unique, as any logical operator multiplied by a stabilizer will perform the same logical operation.

To see this, let S∈SS \in \mathcal{S}, U∈N(S)∖SU \in N(\mathcal{S}) \setminus S and assume ∣ψ⟩L\vert \psi \rangle_L is an arbitrary state in the code space. Then

U(S∣ψ⟩L)=U∣ψ⟩L,U (S \vert \psi \rangle_L) = U \vert \psi \rangle_L,

meaning USUS and UU have the same effect on the logical state.

To capture this, logical operators are formally represented by cosets of S\mathcal{S} insides N(S)N(\mathcal{S}). Given a U∈N(H)U \in N(\mathcal{H}), the left coset

{US:S∈S},\big\{ US : S \in \mathcal{S} \big\},

forms a set of equivalent logical operators. If U∈SU \in \mathcal{S}, then the coset is equal to S\mathcal{S} with the logical operator being the identity.

As a result of this, logical operators are studied via the quotient group of N(S)N(\mathcal{S}) with respect to SS, i.e., N(S)/SN(\mathcal{S}) / \mathcal{S}. This quotient group combines together all the operators in N(S)N(\mathcal{S}) that perform the same logical operator and treats them equivalently. Relationships between these set of operators (that perform the same logical operator) can then be studied.

Code Distance

The distance of an error correcting code is the minimum number of errors that can occur without the error being detected by the code.

For a stabilizer code, the distance is given by the minimum weight of an element in N(S)∖SN(\mathcal{S}) \setminus \mathcal{S}.

Justification

Errors are considered to be individual Pauli-errors acting on the qubits, with the weight of a Pauli-string - the number of qubits on which the string acts non-trivially - corresponding to the number of errors that given Pauli-string will have caused. For example,

X1X2X5X_1X_2X_5

corresponds to an XX error on qubits 1,21,2 and 5. That is 3 errors, equal to the weight of the string.

Elements of N(S)∖SN(\mathcal{S}) \setminus \mathcal{S} are the logical operators of the stabilizer code i.e., the Pauli-string that keep states within the code space but act non-trivially on them.

Hence, if an error E∈N(S)∖SE \in N(\mathcal{S}) \setminus \mathcal{S} occurs, it will go undetected, as the state will remain in the code space but an unknown operation will have been applied.

Therefore, the minimum weight of an element in N(S)∖SN(\mathcal{S}) \setminus \mathcal{S} will be the distance of the code.

Measuring Stabilizer

All elements of Pn\mathcal{P}_n are unitary. If P∈PnP \in \mathcal{P}_n is also Hermitian, then any stabilizer PP can be measured on the logic state indirectly, with the measurement outcome stored in an ancilla 💭.

A schematic of the circuit used to measure the stabilizer P on the logical state \ket{\psi}_L.

A schematic of the circuit used to measure the stabilizer PP on the logical state ∣ψ⟩L\ket{\psi}_L.

Assume that P∈PnP \in \mathcal{P}_n is a stabilizer of the logical state ∣ψ⟩L\ket{\psi}_L such that P∣ψ⟩L=∣ψ⟩LP \ket{\psi}_L = \ket{\psi}_L. Let EE be some correctable error that has occurred on the logical state, such that P(E∣ψ⟩L)=E∣ψ⟩LP ( E \ket{\psi}_L) = E \ket{\psi}_L or P(E∣ψ⟩L)=−E∣ψ⟩LP ( E \ket{\psi}_L) = - E \ket{\psi}_L, depending on whether E∣ψ⟩LE \ket{\psi}_L is in the positive or negative eigenspace of PP.

The input state into the circuit is E∣ψ⟩L∣0⟩AE\ket{\psi}_L \ket{0}_A, where AA labels the ancillary space and the LL subscript now doubles as a label for the space of the logical state.

The output state is then

12(IL⊗IA+PL⊗IA)E∣ψ⟩L∣0⟩A+12(IL⊗IA−PL⊗IA)E∣ψ⟩L∣1⟩A.\frac{1}{2} \big( \mathbb{I}_L \otimes \mathbb{I}_A + P_L \otimes \mathbb{I}_A) E \ket{\psi}_L \ket{0}_A + \frac{1}{2} \big( \mathbb{I}_L \otimes \mathbb{I}_A - P_L \otimes \mathbb{I}_A) E \ket{\psi}_L \ket{1}_A.
Proof

The input state to the circuit is

E∣ψ⟩L⊗∣0⟩A.E\ket{\psi}_L \otimes \ket{0}_A.

The controlled stabilizer gate can be written as

PLCA=IL⊗∣0⟩⟨0∣A+PL⊗∣1⟩⟨1∣A.P_LC_A = \mathbb{I}_L \otimes \ket{0}\bra{0}_A + P_L \otimes \ket{1}\bra{1}_A.

The output state of the circuit is then

(I⊗H)PLCA(I⊗H)(E∣ψ⟩L⊗∣0⟩A)=(I⊗H)(IL⊗∣0⟩⟨0∣A+PL⊗∣1⟩⟨1∣A)(E∣ψ⟩L⊗∣+⟩)=12(I⊗H)(E∣ψ⟩L⊗∣0⟩+PE∣ψ⟩L⊗∣1⟩)=12(E∣ψ⟩L⊗∣+⟩+PE∣ψ⟩L⊗∣−⟩).\begin{align*} &(\mathbb{I} \otimes H) P_L C_A (\mathbb{I} \otimes H) \big(E\ket{\psi}_L \otimes \ket{0}_A \big) \\ =& (\mathbb{I} \otimes H)\big(\mathbb{I}_L \otimes \ket{0}\bra{0}_A + P_L \otimes \ket{1}\bra{1}_A \big)\big(E \ket{\psi}_L \otimes \ket{+} \big) \\ =& \frac{1}{\sqrt{2}}(\mathbb{I} \otimes H) \big( E\ket{\psi}_L \otimes \ket{0} + PE\ket{\psi}_L \otimes \ket{1} \big) \\ =& \frac{1}{\sqrt{2}}\big( E\ket{\psi}_L \otimes \ket{+} + PE\ket{\psi}_L \otimes \ket{-} \big).\\ \end{align*}

Expanding ∣+⟩\ket{+} and ∣−⟩\ket{-} in the computational basis and factorising completes the proof.

Therefore, if P(E∣ψ⟩L)=E∣ψ⟩LP ( E \ket{\psi}_L) = E \ket{\psi}_L, the second term will go to zero and the output state becomes

E∣ψ⟩L∣0⟩A,E \ket{\psi}_L \ket{0}_A,

such that if one measures ZZ on the ancilla they will get the outcome +1 (syndrome bit 0) with certainty.

If P(E∣ψ⟩L)=−E∣ψ⟩LP ( E \ket{\psi}_L) = - E \ket{\psi}_L, the first term will go to zero and the output state becomes

E∣ψ⟩L∣1⟩A,E \ket{\psi}_L \ket{1}_A,

such that a ZZ measurement performed on the ancilla now gives the outcome -1 (syndrome bit 1) with certainty.

By performing the above circuit and measuring the ancilla one can therefore determine if the logical state is in the +1 or -1 eigenspace of the stabilizer PP.

This is an example of generalised measurement and Naimark’s dilation theorem.

Parity Measurements Circuits

When discussing the 2-bit repetition code it was noted that the measurement of the stabilizer was akin to performing a parity check on the qubits. Specifically, a logical qubit was encoded into space Span{∣00⟩,∣11⟩}{\rm Span}\{ \ket{00}, \ket{11}\} such that

∣ψ⟩L=α∣00⟩+β∣11⟩,  ∣α∣2+∣β∣2=1.\ket{\psi}_L = \alpha \ket{00} + \beta \ket{11}, ~ ~ \vert \alpha \vert^2 + \vert \beta \vert^2=1.

It was then seen that it was possible to perform error detection on the set of errors {I,X1,X2}\{\mathbb{I}, X_1, X_2 \} by measuring the stabilizer Z1⊗Z2Z_1 \otimes Z_2. If I\mathbb{I} occurs, the state stays in the code space and measuring the stabilizer gives the output +1 (syndrome bit 0). If either an X1X_1 or X2X_2 occurs, the state is mapped into the space Span{∣01⟩,∣10⟩}{\rm Span}\{ \ket{01}, \ket{10} \}, and a measurement of the stabilizer gives the output -1 (syndrome bit 1).

A simpler circuit can be used for measuring stabilizers that perform a parity check. The circuit for performing the parity check in the 2-bit repetition code is shown in the below figure.

A circuit that checks the parity of two qubits and stores the result in an ancilla. L_1 and L_2 are used to label the two physical qubits used to create the single logical qubit.

A circuit that checks the parity of two qubits and stores the result in an ancilla. L1L_1 and L2L_2 are used to label the two physical qubits used to create the single logical qubit.

Firstly, the parity of two bits, i1,i2∈{0,1}i_1, i_2 \in \{0,1\}, is given by i1⊕i2i_1 \oplus i_2. This will be zero if both bits are zero or both bits are one. If the bits differ, it will be one.

Now, note that the action of a CNOT gate on some arbitrary computational basis state can be written as

C1X2∣i1i2⟩=∣i1(i2⊕i1)⟩,  i1,i2 ∈ {0,1}.C_1X_2 \ket{i_1i_2} = \ket{i_1(i_2 \oplus i_1)}, ~ ~ i_1, i_2~\in~\{0,1\}.

This works because a CNOT gate applies an XX gate to the second qubit if the first qubit is i1=1i_1 = 1. This XX gate will flip the second qubit, which can be done by adding 1 to it. Hence, if i1=0i_1 = 0 nothing is added to the second qubit and it remains i2i_2. If i1=1i_1=1 then 1 is added to i2i_2, flipping it.

From here, consider that if it is not known if an error has occurred on an arbitrary qubit encoded into the code space, Span{∣00⟩,∣11⟩}{\rm Span}\{\ket{00}, \ket{11}\}, the state can be written as

α∣i1i2⟩+β∣(i1⊕1)(i2⊕1)⟩.\alpha \ket{i_1 i_2} + \beta \ket{(i_1 \oplus 1)(i_2 \oplus 1)}.

The input into the circuit is then

(α∣i1i2⟩+β∣(i1⊕1)(i2⊕1)⟩)⊗∣0⟩A.\begin{align*} \big( \alpha \ket{i_1 i_2} + \beta \ket{(i_1 \oplus 1)(i_2 \oplus 1)} \big) \otimes \ket{0}_A. \end{align*}

The action of the first CNOT gate is then

C2XA(α∣i1i2⟩⊗∣0⟩A+β∣(i1⊕1)(i2⊕1)⟩⊗∣0⟩A)=α∣i1i2⟩⊗∣0⊕i2⟩A+β∣(i1⊕1)(i2⊕1)⟩⊗∣(i2⊕1)⟩A=α∣i1i2⟩⊗∣i2⟩+β∣(i1⊕1)(i2⊕1)⟩⊗∣(i2⊕1)⟩A,\begin{align*} &C_2X_A \big( \alpha \ket{i_1 i_2} \otimes \ket{0}_A + \beta \ket{(i_1 \oplus 1)(i_2 \oplus 1)} \otimes \ket{0}_A \big) \\ =&\alpha \ket{i_1 i_2} \otimes \ket{0 \oplus i_2}_A + \beta \ket{(i_1 \oplus 1)(i_2 \oplus 1)} \otimes \ket{(i_2 \oplus 1)}_A \\ =& \alpha \ket{i_1 i_2} \otimes \ket{i_2} + \beta \ket{(i_1 \oplus 1)(i_2 \oplus 1)} \otimes \ket{(i_2 \oplus 1)}_A, \end{align*}

as 0⊕i2=i20 \oplus i_2 = i_2. The action of the second CNOT gate is then

C1XA(α∣i1i2⟩⊗∣i2⟩+β∣(i1⊕1)(i2⊕1)⟩⊗∣(i2⊕1)⟩A)=α∣i1i2⟩⊗∣i2⊕i1⟩+β∣(i1⊕1)(i2⊕1)⟩⊗∣(i2⊕1)⊕(i1⊕1)⟩A=α∣i1i2⟩⊗∣i2⊕i1⟩+β∣(i1⊕1)(i2⊕1)⟩⊗∣i2⊕i1⟩A,\begin{align*} &C_1X_A \big( \alpha \ket{i_1 i_2} \otimes \ket{i_2} + \beta \ket{(i_1 \oplus 1)(i_2 \oplus 1)} \otimes \ket{(i_2 \oplus 1)}_A \big) \\ =&\alpha \ket{i_1 i_2} \otimes \ket{i_2 \oplus i_1} + \beta \ket{(i_1 \oplus 1)(i_2 \oplus 1)} \otimes \ket{(i_2 \oplus 1) \oplus (i_1 \oplus 1)}_A \\ =& \alpha \ket{i_1 i_2} \otimes \ket{i_2 \oplus i_1} + \beta \ket{(i_1 \oplus 1)(i_2 \oplus 1)} \otimes \ket{i_2 \oplus i_1}_A, \end{align*}

as 1⊕1=01 \oplus 1 = 0. Hence, if ZZ is measured on the computational basis then the parity is output with certainty.

Virtual Paulis

Stabilzers can also be formalised in terms of virtual Paulis.

Here, 2n2n elements of Pn\mathcal{P}_n are chosen, {Xj′,Zj′}j∈{1,n}\{X'_j, Z'_j \}_{j \in \{1,n\}}, such that the single-qubit commutation relations are obeyed as expected.

The stabilzer group can then be chosen to be

S=⟨Z1′,Z2′,…Zm′⟩,\mathcal{S} = \langle Z'_1, Z_2', \ldots Z_m' \rangle,

where m≤nm \leq n. These are independent, mutually commuting, and do not contain −I-\mathbb{I}.

The normaliser of this stabilzer group is then

N(S)=⟨iI,S,Zm+1′,Zm+2′,…,Zn′,Xm+1′,Xm+2′…,Xn′⟩,N(\mathcal{S}) = \langle i\mathbb{I}, \mathcal{S}, Z'_{m+1}, Z'_{m+2}, \ldots, Z'_{n}, X'_{m+1}, X'_{m+2} \ldots, X'_{n} \rangle,

which are the logical operators of the code.

More Details

As detailed here, the eigenbasis of these stabilzers can be labeled by bit-strings b=b1b2...bn∈{0,1}n\bm{b} = b_1b_2...b_n \in \{0,1\}^n, such that

Zj′∣b1b2b3…bn⟩=(−1)bj∣b1b2b3…bn⟩,Xj′∣b1b2b3…bn⟩=(−1)bj∣b1b2b3…bj−1(bj⊕1)bj+1…bn⟩.\begin{align*} Z'_j \ket{b_1b_2b_3 \ldots b_n} &= (-1)^{b_j} \ket{b_1b_2b_3 \ldots b_n}, \\ X'_j \ket{b_1b_2b_3 \ldots b_n} &= (-1)^{b_j} \ket{b_1b_2b_3 \ldots b_{j-1}(b_j \oplus 1)b_{j+1} \ldots b_n}. \end{align*}

As the code space is defined as the +1 eigenspace of the stabilzers, using this basis the code space can be defined as the space spanned by the states

{∣0man−m⟩:a∈{0,1}n−m}\big\{ \ket{\bm{0}_m \bm{a}_{n-m}} : a \in \{0,1\}^{n-m} \big\}

where 0m\bm{0}_m is the zero bit-string of length mm.

Consistency check:

  • There are 2n−m2^{n-m} possible code-words, meaning k=n−mk=n-m qubits can be encoded.

  • Elements in the normaliser act only on the final n−mn-m bits, and hence manipulate the code words (and hence the logical information) without effecting the first mm bits, keeping the state in the code space.

If a correctable error acts on the encoded state, it will map the first mm zeros bits to some other mm bit-string. This will then be the syndrome of the error correcting code, which will be extracted when the mm stabilzer generators are measured.