Notes on quantum error correction · Part 1 · follows Roffe, section 3 · next: Part 2

Quantum redundancy and stabilizer measurement

A qubit cannot be cloned, read, or protected against bit flips alone. Section 3 of the paper answers the first two obstacles by spreading the state over a larger Hilbert space and measuring only which subspace it is in; the third defeats both codes below. The theory comes first; the interactive figures are gathered at the end, followed by problems.

Roffe §3

The two-qubit code

A CNOT from \(\ket\psi\) onto a qubit in \(\ket0\) encodes

\[ \alpha\ket0 + \beta\ket1 \;\longmapsto\; \ket\psi_\L = \alpha\ket{00} + \beta\ket{11} \;\ne\; \ket\psi\otimes\ket\psi . \qquad\text{(eq. 12, 13)} \]

Nothing is copied; the amplitudes are shared by an entangled pair. The state now lives in the codespace \(\C\), a two-dimensional slice of \(\H_4\), and a bit flip on either qubit moves it into the orthogonal error space \(\F\):

\[ \begin{aligned} \C &= \span\{\ket{00}, \ket{11}\}, \\ \F &= \span\{\ket{01}, \ket{10}\}, \\ X_1\ket\psi_\L &= \alpha\ket{10} + \beta\ket{01} \in \F . \qquad\text{(eq. 14–17)} \end{aligned} \]

The stabilizer \(Z_1Z_2\) is \(+1\) on \(\C\) and \(-1\) on \(\F\), so measuring it projects onto a subspace without distinguishing \(\ket{00}\) from \(\ket{11}\): \(\alpha\) and \(\beta\) survive (eq. 18). The measurement uses an ancilla, a Hadamard, a controlled-\(Z_1Z_2\) and a second Hadamard (paper's figure 2):

\[ E\ket\psi_\L\ket0_A \;\longmapsto\; \tfrac12(\I + Z_1Z_2)\,E\ket\psi_\L\ket0_A + \tfrac12(\I - Z_1Z_2)\,E\ket\psi_\L\ket1_A . \qquad\text{(eq. 19)} \]

The ancilla outcome is the syndrome \(S\): 0 for \(E \in \{\I, X_1X_2\}\), 1 for \(E \in \{X_1, X_2\}\) (table 1). So the code detects a flip but cannot locate it, and \(X_1X_2\) passes unseen while mapping \(\ket\psi_\L\) to the encoding of \(X\ket\psi\): it is the logical operator \(\bar X\).

Coherent errors: detection already suppresses

Let each qubit suffer \(E = \alpha_I\I + \alpha_X X\) with \(p_X = |\alpha_X|^2\) (eq. 20). On the pair,

\[ E_1\otimes E_2 = \alpha_I^2\,\I + \alpha_I\alpha_X\,(X_1 + X_2) + \alpha_X^2\,X_1X_2 , \qquad\text{(eq. 21)} \]

and syndrome extraction sends the middle terms to \(S = 1\) (eq. 22). Given \(S = 0\), the state is \(\propto (\alpha_I^2\I + \alpha_X^2X_1X_2)\ket\psi_\L\) (eq. 23), and the logical error probability is

\[ p_L = \frac{p_X^2}{(1 - p_X)^2 + p_X^2} \approx p_X^2 . \qquad\text{(eq. 24)} \]

At \(p_X = 0.1\) that is about eight times below the bare qubit; the curves meet only at \(p_X = \tfrac12\).

Roffe §3.1

The three-qubit code

Two CNOTs give \(\ket\psi_\L = \alpha\ket{000} + \beta\ket{111}\), and the eight-dimensional space splits into

\[ \begin{aligned} \C &= \span\{\ket{000}, \ket{111}\}, \\ \F_1 &= \span\{\ket{100}, \ket{011}\}, \\ \F_2 &= \span\{\ket{010}, \ket{101}\}, \\ \F_3 &= \span\{\ket{001}, \ket{110}\}, \qquad\text{(eq. 25)} \end{aligned} \]

with \(X_i\ket\psi_\L \in \F_i\). The stabilizers \(Z_1Z_2\) and \(Z_2Z_3\) read \((-,+)\), \((-,-)\), \((+,-)\) on \(\F_1, \F_2, \F_3\), so the two-bit syndrome names the flipped qubit and a lookup table undoes it (paper's figure 3, table 2). Eight bit-flip patterns share four syndromes: each weight-two pattern looks like the single flip on the remaining qubit, the decoder completes it to \(X_1X_2X_3 = \bar X\), and the code fails exactly as a classical majority vote does. With the coherent error of eq. 20 on every qubit, the failing terms are the three double flips and the triple flip, so every run is kept and

\[ p_L = 3p_X^2(1 - p_X) + p_X^3 = 3p_X^2 - 2p_X^3 , \]

quadratic like eq. 24 but without discarding anything; the curves again meet at \(p_X = \tfrac12\).

Roffe §3.2

Quantum code distance

The distance \(d\) is the weight of the lightest logical operator, the smallest undetected error that changes the encoded state. For bit flips alone the three-qubit code has \(\bar X = X_1X_2X_3\) (eq. 26), so \(d = 3\) and it corrects \(t = \lfloor (d-1)/2\rfloor = 1\) flip. In the conjugate basis \(\ket\pm = (\ket0 \pm \ket1)/\sqrt2\), where \(Z\ket\pm = \ket\mp\) (eq. 27),

\[ \begin{aligned} \ket\pm_\L &= \tfrac{1}{\sqrt2}\bigl(\ket{000} \pm \ket{111}\bigr), \\ Z_1\ket+_\L &= \ket-_\L . \qquad\text{(eq. 28)} \end{aligned} \]

Both stabilizers commute with \(Z_1\), so the syndrome stays 00: \(\bar Z = Z_1\) has weight one and the quantum distance is \(d = 1\). Catching \(Z\) errors needs stabilizers built from \(X\)s, and catching both needs commuting stabilizers of both types, which is the stabilizer formalism of section 4 and part 2 of these notes, and from there CSS and quantum LDPC codes.

Interactive figures

Click a qubit to apply an error, step the circuit gate by gate, or click a table row. Within each tab the parts share one error. Bars are amplitudes, grouped into the codespace \(\C\) and the error spaces; the input is \(\alpha = 0.8\), \(\beta = 0.6\) unless you move the slider (set \(\theta = \pi/2\) for \(\ket+\) to see the phase flip of eq. 28).

Problems

Each solution is hidden until you open it. Numbers can be checked against the figures above.

  1. Encoding is not copying. Apply a CNOT, controlled by the first qubit, to \((\alpha\ket0 + \beta\ket1)\ket0\). For which \(\alpha, \beta\) is the result equal to \(\ket\psi\otimes\ket\psi\)? Why does this not contradict the no-cloning theorem?

    Solution

    The CNOT gives \(\alpha\ket{00} + \beta\ket{11}\) (eq. 12). Expanding the copy,

    \[ \ket\psi\otimes\ket\psi = \alpha^2\ket{00} + \alpha\beta\,(\ket{01} + \ket{10}) + \beta^2\ket{11} . \]

    Equality needs \(\alpha\beta = 0\), \(\alpha^2 = \alpha\) and \(\beta^2 = \beta\), which with \(|\alpha|^2 + |\beta|^2 = 1\) leaves \(\ket0\) or \(\ket1\). A unitary can copy the members of one orthonormal basis and nothing else, which is exactly what the no-cloning theorem allows. For every superposition the CNOT makes an entangled pair instead of a copy, and the code uses that entanglement.

  2. Detection with random bit flips. In the two-qubit code, let each qubit flip independently with probability \(p\) (random flips, not the coherent error of eq. 20). (a) How often does the ancilla read \(S = 1\)? (b) How often is \(S = 0\) while the logical state is flipped? (c) Runs with \(S = 1\) are discarded. What is the logical error rate of the runs that are kept? Evaluate everything at \(p = 0.1\).

    Solution

    (a) Exactly one flip, \(X_1\) or \(X_2\): \(2p(1-p) = 0.18\).

    (b) Both flip. \(X_1X_2 = \bar X\) commutes with \(Z_1Z_2\), so it passes unseen: \(p^2 = 0.01\).

    (c) The kept fraction is \((1-p)^2 + p^2 = 0.82\), so \(p_L = p^2 / \bigl((1-p)^2 + p^2\bigr) \approx 0.0122\), eight times below the bare \(0.1\). It is the same expression as eq. 24: for these branch probabilities random and coherent flips agree, and the caveat in the text concerns interference, which random flips do not have. The price is that about one run in five is thrown away.

  3. Majority vote. The three-qubit code with its lookup decoder, each qubit flipping independently with probability \(p\). (a) Show that \(p_L = 3p^2 - 2p^3\). (b) Factor \(p - p_L\) and show that the code helps exactly when \(p \lt \tfrac12\). (c) Compare \(p = 0.1\) with the detection code of the previous problem.

    Solution

    (a) One flip is undone; two or three flips make the decoder complete \(\bar X = X_1X_2X_3\). So \(p_L = 3p^2(1-p) + p^3 = 3p^2 - 2p^3\).

    (b) \(p - p_L = p - 3p^2 + 2p^3 = p(1-p)(1-2p)\), which is positive for \(0 \lt p \lt \tfrac12\) and vanishes at \(p = \tfrac12\), where the curves in figure B.3 meet.

    (c) \(p_L = 0.028\), about 3.6 times below \(0.1\). The detection code reaches \(0.0122\) with two qubits, but only by discarding 18% of the runs; the three-qubit code keeps every run.

  4. The phase-flip code. Apply a Hadamard to every qubit of the three-qubit code, so that \(\ket0_\L = \ket{{+}{+}{+}}\) and \(\ket1_\L = \ket{{-}{-}{-}}\). (a) What are the stabilizers? (b) Give the syndromes of \(Z_1, Z_2, Z_3\). (c) Show that \(X_1\) goes undetected and find what it does to the logical state. What is the distance of this code against all Pauli errors?

    Solution

    (a) \(HZH = X\), so \(Z_1Z_2, Z_2Z_3\) become \(X_1X_2, X_2X_3\). Since \(X\ket\pm = \pm\ket\pm\), both are \(+1\) on \(\ket{{+}{+}{+}}\) and on \(\ket{{-}{-}{-}}\).

    (b) \(Z\) anticommutes with \(X\): \(Z_1 \to 10\), \(Z_2 \to 11\), \(Z_3 \to 01\), the same table as for bit flips in the original code.

    (c) \(X_1\) commutes with both stabilizers, so the syndrome is 00. It fixes \(\ket{{+}{+}{+}}\) and maps \(\ket{{-}{-}{-}}\) to \(-\ket{{-}{-}{-}}\), so \(X_1 = \bar Z\). A weight-one logical operator means \(d = 1\): the mirror image of eq. 28. The Shor code of part 2 nests the two codes to catch both kinds of error.