I'm working through Mike and Ike (Nielsen and Chuang) for self-study, and I'm reading about stabilizer codes in Chapter 10. I'm an electrical engineer with somewhat of a background in classical information theory, but I'm by no means an expert in algebraic coding theory. My abstract algebra is essentially just a little more than what's in the appendix.

I think I totally understand the Calderbank-Shor-Steane construction, where two linear classical codes are used to construct a quantum code. The Steane code is constructed using $C_1$ (the code for qbit flips) as the [7,4,3] Hamming code, and $C_2^{\perp}$ (the code for phase flips) as the same code. The parity check matrix the [7,4,3] code is: \begin{bmatrix} 0&0&0&1&1&1&1 \\ 0&1&1&0&0&1&1 \\ 1&0&1&0&1&0&1 \end{bmatrix}.

The stabilizer generators for the Steane code can be written as:

\begin{array} {|r|r|} \hline Name & Operator \\ \hline g_1 & IIIXXXX \\ \hline g_2 & IXXIIXX \\ \hline g_3 & XIXIXIX \\ \hline g_4 & IIIZZZZ \\ \hline g_5 & IZZIIZZ \\ \hline g_6 & ZIZIZIZ \\ \hline \end{array} where for the sake of my sanity $IIIXXXX = I \otimes I\otimes I\otimes X \otimes X \otimes X \otimes X$ and so on.

It's pointed out in the book that the $X$s and $Z$s are in the same positions as the $1$s in the original parity check code. Exercise 10.32 asks to verify that the codewords for the Steane code are stabilized by this set. I could obviously plug this in and check it by hand. However, it's stated that with the observation of the similarities between the parity check matrix and the generator the exercise is "self-evident".

I've seen this fact noted in other places (http://www-bcf.usc.edu/~tbrun/Course/lecture21.pdf), but I'm missing some kind of (probably obvious) intuition. I think I'm missing some further connection from the classical codewords to the quantum codes other than how they're used in the indexing of basis elements in the construction of the code (i.e. Section 10.4.2).


3 Answers 3


There are a few conventions and intuition here, which perhaps it would help to have spelled out — $\def\ket#1{\lvert#1\rangle}\def\bra#1{\!\langle#1\rvert}$

  • Sign bits versus {0,1} bits

    The first step is to make what is sometimes called the 'great notational shift', and think of bits (even classical bits) as being encoded in signs. This is productive to do if what you're mostly interested in is the parities of bit strings, because bit-flips and sign-flips basically act the same way. We map $0 \mapsto +1$ and $1 \mapsto -1$, so that for instance the sequence of bits $(0,0,1,0,1)$ would be represented by the sequence of signs $(+1,+1,-1,+1,-1)$.

    Parities of sequences of bits then corresponds to products of sequences of signs. For instance, just as we would recognise $0 \oplus 0 \oplus 1 \oplus 0 \oplus 1 = 0$ as a parity computation, we may recognise $(+1)\cdot(+1)\cdot(-1)\cdot(+1)\cdot(-1) = +1$ as representing the same parity computation using the sign convention.

    Exercise. Compute the 'parity' of $(-1,-1,+1,-1)$ and of $(+1,-1,+1,+1)$. Are these the same?

  • Parity checks using sign bits

    In the {0,1}-bit convention, parity checks have a nice representation as a dot-product of two boolean vectors, so that we can realise complicated parity computations as linear transformations. By shifting to sign-bits, we have inevitably lost the connection to linear algebra on a notational level, because we're taking products instead of sums. On a computational level, because this is only a shift in notation, we don't really have to worry too much. But on a pure mathematical level, we now have to think again a little about what we're doing with parity check matrices.

    When we use sign bits, we may still represent a 'parity check matrix' as a matrix of 0s and 1s, instead of signs ±1. Why? One answer is that a row vector describing a parity check of bits is of a different type than the sequence of bits themselves: it describes a function on data, not the data itself. The array of 0s and 1s now just requires a different interpretation — instead of linear coefficients in a sum, they correspond to exponents in a product. If we have sign bits $(s_1, s_2, \ldots, s_n) \in \{-1,+1\}^n$, and we want to compute a parity check given by a row-vector $(b_1, b_2, \ldots, b_n) \in \{0,1\}$, the parity check is then computed by $$ (s_1)^{b_1} \cdot (s_2)^{b_2} \cdot [\cdots] \cdot (s_n)^{b_n} \in \{-1,+1\},$$ where recall that $s^0 = 1$ for all $s$. As with {0,1}-bits, you can think of the row $(b_1,b_2,\ldots,b_n)$ as just representing a 'mask' which determines which bits $s_j$ make a non-trivial contribution to the parity computation.

    Exercise. Compute the result of the parity check $(0,1,0,1,0,1,0)$ on $(+1,-1,-1,-1,-1,+1,-1)$.

  • Eigenvalues as parities.

    The reason why we would want to encode bits in signs in quantum information theory is because of the way that information is stored in quantum states — or more to the point, the way that we can describe accessing that information. Specifically, we may talk a lot about the standard basis, but the reason why it is meaningful is because we can extract that information by measurement of an observable.

    This observable could just be the projector $\ket{1}\bra{1}$, where $\ket{0}$ has eigenvalue 0 and $\ket{1}$ has eigenvalue 1, but it is often helpful to prefer to describe things in terms of the Pauli matrices. In this case, we would talk about the standard basis as the eigenbasis of the $Z$ operator, in which case we have $\ket{0}$ as the +1-eigenvector of Z and $\ket{1}$ as the −1-eigenvector of Z.

    So: we have the emergence of sign-bits (in this case, eigenvalues) as representing the information stored in a qubit. And better still, we can do this in a way which is not specific to the standard basis: we can talk about information stored in the 'conjugate' basis, just by considering whether the state is an eigenstate of $X$, and what eigenvalue it has. But more than this, we can talk about the eigenvalues of a multi-qubit Pauli operator as encoding parities of multiple bits — the tensor product $Z \otimes Z$ represents a way of accessing the product of the sign-bits, that is to say the parity, of two qubits in the standard basis. In this sense, the eigenvalue of a state with respect to a multi-qubit Pauli operator — if that eigenvalue is defined (i.e. in the case that the state is an eigenvalue of the Pauli operator) — is in effect the outcome of a parity calculation of information stored in some choice of basis for each of the qubits.

    Exercise. What is the parity of the state $\ket{11}$ with respect to $Z \otimes Z$? Does this state have a well-defined parity with respect to $X \otimes X$?

    Exercise. What is the parity of the state $\ket{+-}$ with respect to $X \otimes X$? Does this state have a well-defined parity with respect to $Z \otimes Z$?

    Exercise. What is the parity of $\ket{\Phi^+} = \tfrac{1}{\sqrt 2}\bigl(\ket{00} + \ket{11}\bigr)$ with respect to $Z \otimes Z$ and $X \otimes X$?

  • Stabiliser generators as parity checks.

    We are now in a position to appreciate the role of stabiliser generators as being analogous to a parity check matrix. Consider the case of the 7-qubit CSS code, with generators

    \begin{array} {|r|ccccccc|} \hline \scriptstyle\text{Generator} & & & & \!\!\!\!\!\!\!\!\!\scriptstyle\text{Tensor factors}\!\!\!\!\!\!\!\!\! & & & \\[-0.5ex] & \scriptstyle1 & \scriptstyle2 & \scriptstyle3 & \scriptstyle4 & \scriptstyle5 & \scriptstyle6 & \scriptstyle7 \\ \hline \hline g_1 & & & & X & X & X & X \\ \hline g_2 & & X & X & & & X & X \\ \hline \hline g_3 & X & & X & & X & & X \\ \hline g_4 & & & & Z & Z & Z & Z \\ \hline g_5 & & Z & Z & & & Z & Z \\ \hline g_6 & Z & & Z & & Z & & Z \\ \hline \end{array} I've omitted the identity tensor factors above, as one might sometimes omit the 0s from a {0,1} matrix, and for the same reason: in a given stabiliser operator, the identity matrix corresponds to a tensor factor which is not included in the 'mask' of qubits for which we are computing the parity. For each generator, we are only interested in those tensor factors which are being acted on somehow, because those contribute to the parity outcome.

    Now, the 'codewords' (the encoded standard basis states) of the 7-qubit CSS code are given by $$ \begin{align} \ket{0_L} \propto{}&{} \ket{0000000} + \ket{0001111} + \ket{0110011} + \ket{0111100} \\&+ \ket{1010101} + \ket{1011010} + \ket{1100110} + \ket{1101001} = \sum_{y \in C} \ket{y}, \\[1ex] \ket{1_L} \propto{}&{} \ket{1111111} + \ket{1110000} + \ket{1001100} + \ket{1000011} \\&+ \ket{0101010} + \ket{0100101} + \ket{0011001} + \ket{0010110} = \sum_{y \in C} \ket{y \oplus 1111111}, \end{align} $$ where $C$ is the code generated by the bit-strings $0001111$, $0110011$, and $1010101$. Notably, these bit-strings correspond to the positions of the $X$ operators in the generators $g_1$, $g_2$, and $g_3$. While those are stabilisers of the code (and represent parity checks as I've suggested above), we can also consider their action as operators which permute the standard basis. In particular, they will permute the elements of the code $C$, so that the terms involved in $\ket{0_L}$ and $\ket{1_L}$ will just be shuffled around.

    The generators $g_4$, $g_5$, and $g_6$ above are all describing the parities of information encoded in standard basis states. The encoded basis states you are given are superpositions of codewords drawn from a linear code, and those codewords all have even parity with respect to the parity-check matrix from that code. As $g_4$ through $g_6$ just describe those same parity checks, it follows that the eigenvalue of the encoded basis states is $+1$ (corresponding to even parity).

    This is the way in which

    'with the observation about the similarities between the parity check matrix and the generator the exercise is "self evident"'

    — because the stabilisers either manifestly permute the standard basis terms in the two 'codewords', or manifestly are testing parity properties which by construction the codewords will have.

  • Moving beyond codewords

    The list of generators in the table you provide represent the first steps in a powerful technique, known as the stabiliser formalism, in which states are described using no more or less than the parity properties which are known to hold of them.

    Some states, such as standard basis states, conjugate basis states, and the perfectly entangled states $\ket{\Phi^+} \propto \ket{00} + \ket{11}$ and $\ket{\Psi^-} \propto \ket{01} - \ket{10}$ can be completely characterised by their parity properties. (The state $\ket{\Phi^+}$ is the only one which is a +1-eigenvector of $X \otimes X$ and $Z \otimes Z$; the state $\ket{\Psi^-}$ is the only one which is a −1-eigenvector of both these operators.) These are known as stabiliser states, and one can consider how they are affected by unitary transformations and measurements by tracking how the parity properties themselves transform. For instance, a state which is stabilised by $X \otimes X$ before applying a Hadamard on qubit 1, will be stabilised by $Z \otimes X$ afterwards, because $(H \otimes I)(X \otimes X)(H \otimes I) = Z \otimes X$. Rather than transform the state, we transform the parity property which we know to hold of that state.

    You can use this also to characterise how subspaces characterised by these parity properties will transform. For instance, given an unknown state in the 7-qubit CSS code, I don't know enough about the state to tell you what state you will get if you apply Hadamards on all of the qubits, but I can tell you that it is stabilised by the generators $g_j' = (H^{\otimes 7}) g_j (H^{\otimes 7})$, which consist of \begin{array} {|r|ccccccc|} \hline \scriptstyle\text{Generator} & & & & \!\!\!\!\!\!\!\!\!\scriptstyle\text{Tensor factors}\!\!\!\!\!\!\!\!\! & & & \\[-0.5ex] & \scriptstyle1 & \scriptstyle2 & \scriptstyle3 & \scriptstyle4 & \scriptstyle5 & \scriptstyle6 & \scriptstyle7 \\ \hline \hline g'_1 & & & & Z & Z & Z & Z \\ \hline g'_2 & & Z & Z & & & Z & Z \\ \hline \hline g'_3 & Z & & Z & & Z & & Z \\ \hline g'_4 & & & & X & X & X & X \\ \hline g'_5 & & X & X & & & X & X \\ \hline g'_6 & X & & X & & X & & X \\ \hline \end{array} This is just a permutation of the generators of the 7-qubit CSS code, so I can conclude that the result is also a state in that same code.

    There is one thing about the stabiliser formalism which might seem mysterious at first: you aren't really dealing with information about the states that tells you anything about how they expand as superpositions of the standard basis. You're just dealing abstractly with the generators. And in fact, this is the point: you don't really want to spend your life writing out exponentially long superpositions all day, do you? What you really want are tools to allow you to reason about quantum states which require you to write things out as linear combinations as rarely as possible, because any time you write something as a linear combination, you are (a) making a lot of work for yourself, and (b) preferring some basis in a way which might prevent you from noticing some useful property which you can access using a different basis.

    Still: it is sometimes useful to reason about 'encoded states' in error correcting codes — for instance, in order to see what effect an operation such as $H^{\otimes 7}$ might have on the codespace of the 7-qubit code. What should one do instead of writing out superpositions?

    The answer is to describe these states in terms of observables — in terms of parity properties — to fix those states. For instance, just as $\ket{0}$ is the +1-eigenstate of $Z$, we can characterise the logical state $\ket{0_L}$ of the 7-qubit CSS code as the +1-eigenstate of $$ Z_L = Z \otimes Z \otimes Z \otimes Z \otimes Z \otimes Z \otimes Z$$ and similarly, $\ket{1_L}$ as the −1-eigenstate of $Z_L$. (It is important that $Z_L = Z^{\otimes 7}$ commutes with the generators $\{g_1,\ldots,g_6\}$, so that it is possible to be a +1-eigenstate of $Z_L$ at the same time as having the parity properties described by those generators.) This also allows us to move swiftly beyond the standard basis: using the fact that $X^{\otimes 7}$ anti commutes with $Z^{\otimes 7}$ the same way that $X$ anti commutes with $Z$, and also as $X^{\otimes 7}$ commutes with the generators $g_i$, we can describe $\ket{+_L}$ as being the +1-eigenstate of $$ X_L = X \otimes X \otimes X \otimes X \otimes X \otimes X \otimes X,$$ and similarly, $\ket{-_L}$ as the −1-eigenstate of $X_L$. We may say that the encoded standard basis is, in particular, encoded in the parities of all of the qubits with respect to $Z$ operators; and the encoded 'conjugate' basis is encoded in the parities of all of the qubits with respect to $X$ operators.

    By fixing a notion of encoded operators, and using this to indirectly represent encoded states, we may observe that $$ (H^{\otimes 7}) \,X_L\, (H^{\otimes 7}) = Z_L, \quad (H^{\otimes 7}) \,Z_L\, (H^{\otimes 7}) = X_L, $$ which is the same relation as obtains between $X$ and $Z$ with respect to conjugation by Hadamards; which allows us to conclude that for this encoding of information in the 7-qubit CSS code, $H^{\otimes 7}$ not only preserves the codespace but is an encoded Hadamard operation.

Thus we see that the idea of observables as a way of describing information about a quantum states in the form of sign bits — and in particular tensor products as a way of representing information about parities of bits — plays a central role in describing how the CSS code generators represent parity checks, and also in how we can describe properties of error correcting codes without reference to basis states.

  • 1
    $\begingroup$ After having read this I still don't get how it is obvious that X4X5X6X7 (I take this example) stabilize the code space. In your answer you seemed to use the fact you know what the code space looks like noticing that X4X5X6X7 applied on $|0_L\rangle$ gives $|1_L\rangle$. What perturbs me is that if we talked about Z4Z5Z6Z7 operators, I would directly see the link with parity check matrix as their eigenvalues give the parity of the bits 4 to 7 exactly like the first line of parity check matrix. But the X operator are not diagonal in the 0/1 basis. So I don't get... $\endgroup$ Commented Aug 1, 2019 at 14:18
  • 1
    $\begingroup$ While it isn't ideal to fuss with the state-vectors for the code-words, from the expansion above we can see that $X_4 X_5 X_6 X_7$ permutes the standard basis components of $|0_L\rangle$, and similarly for the standard-basis components of $|1_L\rangle$. While this picture involves non-trivial transformations of parts of the state, the overall effect is stabilisation. To see how to see the $X$ stabilisers as parity-checks, the way you do with $Z$-stabilisers, maybe you could consider the effect of the $X$ stabilisers of $| {+}_L \rangle$ and $|{-}_L \rangle$, and in the conjugate basis. $\endgroup$ Commented Aug 5, 2019 at 11:00
  • $\begingroup$ Thank you for your answer. Ok so to be sure: do you agree that if we don't look at the basis of the code space but only at the parity check matrix and the generators, the only thing we can directly understand is the fact the $Z$ generator can be read in the parity check matrix. But for the $X$ generator even if appears they follow a similar structure it is not obvious to understand why without further calculation ? Because in the Nielsen&Chuang the way it is presented is as if it was obvious. So I wondered if I missed something ? $\endgroup$ Commented Aug 27, 2019 at 17:00

One way that you could construct what the codeword is is to project on the $+1$ eigenspace of the generators, $$ |C_1\rangle=\frac{1}{2^6}\left(\prod_{i=1}^6(\mathbb{I}+g_i)\right)|0000000\rangle. $$ Concentrate, to start with, one the first 3 generators $$ (\mathbb{I}+g_1)(\mathbb{I}+g_2)(\mathbb{I}+g_3). $$ If you expand this out, you'll see that it creates all the terms in the group ($\mathbb{I},g_1,g_2,g_3,g_1g_2,g_1g_3,g_2g_3,g_1g_2g_3)$. Corresponding it to binary strings, the action of multiplying two terms (since $X^2=\mathbb{I}$) is just like addition modulo 2. So, contained within the code are all of the words generated by the parity check matrix (and this is a group, with group operation of addition modulo 2).

Now, if you multiply by one of the $X$ stabilizers, that's like doing the addition modulo 2 on the corresponding bit strings. But, because we've already generated the group, by definition every group element is mapped to another (unique) group element. In other words, if I do $$ g_1\times\{\mathbb{I},g_1,g_2,g_3,g_1g_2,g_1g_3,g_2g_3,g_1g_2g_3\}=\{g_1\mathbb{I},g_1g_2,g_1g_3,g_2,g_3,g_1g_2g_3,g_2g_3\}, $$ I get back the set I started with (using $g_1^2=\mathbb{I}$, and the commutation of the stabilizers), and therefore I'm projecting onto the same state. Hence, the state is stabilized by $g_1$ to $g_3$.

You can effectively make the same argument for $g_4$ to $g_6$. I prefer to think about first applying a Hadamard to every qubit, so the Xs are changed to Zs and vice versa. The set of stabilizers are unchanged, so the code is unchanged, but the Z stabilizer is mapped to an X stabilizer, about which we have already argued.


What follows perhaps doesn't exactly answer your question, but instead aims to provide some background to help it become as 'self-evident' as your sources claim.

The $Z$ operator has eigenstates $|0\rangle$ (with eigenvalue $+1$) and $|1\rangle$ (with eigenvalue $-1$). The $ZZ$ operator on two qubits therefore has eigenstates $$ |00\rangle, |01\rangle, |10\rangle, |11\rangle $$. The eigenvalues for these depend on the parity of the bit strings. For example, with $|00\rangle$ we multiply the $+1$ eigenvalues of the individual $Z$ operators to get $+1$. For $|11\rangle$ we multiply the $-1$ eigenvalues together and also get $+1$ for $ZZ$. So both these even parity bit strings have eigenvalue $+1$, as does any superposition of them. For both odd parity states ($|01\rangle$ and $|10\rangle$) we must multiply a $+1$ with a $-1$, and get a $-1$ eigenvalue for $ZZ$.

Note also that superpositions of bit strings with fixed parity (such as some $\alpha |00\rangle + \beta |00\rangle$) are also eigenstates, and have the eigenvalue associated with their parity. So measuring $ZZ$ would not collapse such a superposition.

This analysis remains valid as we go to higher number of qubits. So if we want to know about the parity of qubits 1, 3, 5, and 7 (to pick a pertinent example), we could use the operator $ZIZIZIZ$. If we measure this and get the outcome $+1$, we know that this subset of qubits has a state represented by an even parity bit string, or a superposition thereof. If we get $-1$, we know that it is an odd parity state.

This allows us to write the [7,4,3] Hamming code using the notation of quantum stabilizer codes. Each parity check is turned into a stabilizer generator which has $I$ on every qubit not involved in the check, and $Z$ on every qubit that is. The resulting code will protect against errors that anticommute with $Z$ (and therefore have the effect of flipping bits).

Of course, qubits do not restrict us to only working in the $Z$ basis. We could encode our qubits for a classical Hamming code in the $|+\rangle$ and $|-\rangle$ states instead. These are the eigenstates of $X$, so you just need to replace $Z$ with $X$ in everything I've said to see how this kind of code works. It would protect against errors that anticommute with $X$ (and so have the effect of flipping phase).

The magic of the Steane code, of course, is that it does both at the same time and protects against everything.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.