Chapter 35 Exercises: Quantum Error Correction
Problems are organized by section and graded by difficulty: - [B] Basic — direct application of formulas and definitions - [I] Intermediate — requires multi-step reasoning or combining concepts - [A] Advanced — requires deeper analysis, proof, or synthesis
Section 35.1–35.2: Why QEC and Quantum Errors
Problem 35.1 [B]
A superconducting qubit has $T_1 = 100\,\mu$s and a gate time of 50 ns. How many single-qubit gates can be performed before the probability of a relaxation error exceeds 50%? (Assume the error probability grows linearly as $p \approx t/T_1$ for $t \ll T_1$.)
Problem 35.2 [B]
Show that the Pauli matrices $\hat{I}$, $\hat{X}$, $\hat{Y}$, $\hat{Z}$ form a basis for the space of $2 \times 2$ matrices. That is, show that any $2 \times 2$ matrix $M$ can be written as $M = c_0\hat{I} + c_1\hat{X} + c_2\hat{Y} + c_3\hat{Z}$ for some complex coefficients $c_0, c_1, c_2, c_3$.
(Hint: Write out the matrices explicitly and solve for $c_0, c_1, c_2, c_3$ in terms of the matrix elements of $M$.)
Problem 35.3 [B]
Verify the following Pauli algebra identities:
(a) $\hat{X}^2 = \hat{Y}^2 = \hat{Z}^2 = \hat{I}$
(b) $\hat{X}\hat{Z} = -\hat{Z}\hat{X} = -i\hat{Y}$
(c) $\hat{Y} = i\hat{X}\hat{Z}$
Problem 35.4 [I]
A general single-qubit error can be written as $\hat{E} = e^{-i\theta(\hat{n}\cdot\hat{\sigma})/2}$, where $\hat{n}$ is a unit vector and $\hat{\sigma} = (\hat{X}, \hat{Y}, \hat{Z})$.
(a) Show that this can be expanded as $\hat{E} = \cos(\theta/2)\hat{I} - i\sin(\theta/2)(n_x\hat{X} + n_y\hat{Y} + n_z\hat{Z})$.
(b) For the specific case $\hat{n} = \hat{z}$ and $\theta = \pi/10$ (a small phase rotation), compute the coefficients $e_0, e_1, e_2, e_3$ in $\hat{E} = e_0\hat{I} + e_1\hat{X} + e_2\hat{Y} + e_3\hat{Z}$.
(c) Explain qualitatively why a code that corrects $\hat{X}$, $\hat{Y}$, and $\hat{Z}$ errors individually also corrects the continuous error $\hat{E}$.
Problem 35.5 [I]
The depolarizing channel applies $\hat{X}$, $\hat{Y}$, or $\hat{Z}$ each with probability $p/3$, and leaves the state unchanged with probability $1-p$. Write the density matrix $\rho_{\text{out}}$ in terms of the input density matrix $\rho_{\text{in}}$:
$$\rho_{\text{out}} = (1-p)\rho_{\text{in}} + \frac{p}{3}(\hat{X}\rho_{\text{in}}\hat{X} + \hat{Y}\rho_{\text{in}}\hat{Y} + \hat{Z}\rho_{\text{in}}\hat{Z})$$
Show that $\rho_{\text{out}} = (1 - \frac{4p}{3})\rho_{\text{in}} + \frac{4p}{3}\cdot\frac{\hat{I}}{2}$.
(This means the depolarizing channel mixes the state toward the maximally mixed state $\hat{I}/2$.)
Section 35.3: The 3-Qubit Bit-Flip Code
Problem 35.6 [B]
For the 3-qubit bit-flip code with $|0\rangle_L = |000\rangle$ and $|1\rangle_L = |111\rangle$:
(a) Write out the encoded state $|\psi\rangle_L$ for $|\psi\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$.
(b) Apply a bit-flip error $\hat{X}_2$ (flip qubit 2) to this encoded state.
(c) Compute the syndrome by evaluating $\hat{Z}_1\hat{Z}_2$ and $\hat{Z}_2\hat{Z}_3$ on the errored state. Verify that the syndrome uniquely identifies the error.
Problem 35.7 [B]
Show that the syndrome operators $\hat{Z}_1\hat{Z}_2$ and $\hat{Z}_2\hat{Z}_3$ commute: $[\hat{Z}_1\hat{Z}_2, \hat{Z}_2\hat{Z}_3] = 0$. (Hint: Both operators are diagonal in the computational basis.)
Problem 35.8 [I]
For the 3-qubit bit-flip code, suppose that each qubit independently undergoes a bit-flip error with probability $p$.
(a) What is the probability that the code correctly recovers the original state? (Consider all patterns of 0 or 1 errors.)
(b) What is the probability that the code fails? (Consider patterns of 2 or 3 errors.)
(c) For what range of $p$ does the encoded qubit have a lower error rate than an unencoded qubit?
Problem 35.9 [I]
Demonstrate that the 3-qubit bit-flip code does not protect against phase-flip errors. Specifically:
(a) Apply $\hat{Z}_1$ to the encoded state $\alpha|000\rangle + \beta|111\rangle$.
(b) Compute the bit-flip syndrome ($\hat{Z}_1\hat{Z}_2$ and $\hat{Z}_2\hat{Z}_3$). Show that the syndrome is $(+1, +1)$ — indistinguishable from "no error."
(c) Explain what has happened to the logical qubit.
Problem 35.10 [I]
Encoding circuit analysis. The encoding circuit for the 3-qubit bit-flip code uses two CNOT gates. Write the unitary matrix for each CNOT gate (in the 8-dimensional Hilbert space of 3 qubits) and verify that their product, applied to $(\alpha|0\rangle + \beta|1\rangle)|00\rangle$, produces $\alpha|000\rangle + \beta|111\rangle$.
Section 35.4: The 3-Qubit Phase-Flip Code
Problem 35.11 [B]
Verify that $\hat{Z}|+\rangle = |-\rangle$ and $\hat{Z}|-\rangle = |+\rangle$, where $|\pm\rangle = (|0\rangle \pm |1\rangle)/\sqrt{2}$.
Problem 35.12 [I]
For the 3-qubit phase-flip code with $|0\rangle_L = |{+}{+}{+}\rangle$ and $|1\rangle_L = |{-}{-}{-}\rangle$:
(a) Write both logical states in the computational basis $\{|0\rangle, |1\rangle\}$.
(b) Apply a phase-flip error $\hat{Z}_2$ and compute the syndrome using $\hat{X}_1\hat{X}_2$ and $\hat{X}_2\hat{X}_3$.
(c) Verify that a bit-flip error $\hat{X}_1$ is NOT detected by the phase-flip syndrome.
Problem 35.13 [I]
Show that the Hadamard gate $\hat{H}$ interchanges the roles of $\hat{X}$ and $\hat{Z}$:
(a) Verify $\hat{H}\hat{X}\hat{H} = \hat{Z}$.
(b) Verify $\hat{H}\hat{Z}\hat{H} = \hat{X}$.
(c) Use this to explain why the phase-flip code can be obtained from the bit-flip code by applying Hadamard gates to each qubit.
Section 35.5: Shor's 9-Qubit Code
Problem 35.14 [B]
Write out the explicit 9-qubit state for $|0\rangle_L$ in the Shor code:
$$|0\rangle_L = \frac{1}{2\sqrt{2}}(|000\rangle + |111\rangle)(|000\rangle + |111\rangle)(|000\rangle + |111\rangle)$$
How many computational basis states appear in the expansion?
Problem 35.15 [I]
For the Shor code, suppose a phase-flip error $\hat{Z}_5$ occurs on qubit 5 (the middle qubit of the second block).
(a) Show that this flips the sign of the second block: $(|000\rangle + |111\rangle) \to (|000\rangle - |111\rangle)$.
(b) Compute all 8 syndrome measurements and verify that the error is correctly identified.
(c) What correction should be applied?
Problem 35.16 [A]
Show that the Shor code can correct a $\hat{Y}_3 = i\hat{X}_3\hat{Z}_3$ error (combined bit-and-phase flip on qubit 3). Compute the syndrome and the correction.
Problem 35.17 [A]
The Shor code uses 9 physical qubits to encode 1 logical qubit. How many of the $2^9 = 512$ computational basis states appear in (a) $|0\rangle_L$? (b) $|1\rangle_L$? (c) What is the dimension of the code space (the subspace spanned by $|0\rangle_L$ and $|1\rangle_L$)?
Section 35.6: Steane's 7-Qubit Code
Problem 35.18 [I]
Verify that $|0000000\rangle$ is a valid Hamming codeword by checking that $H\mathbf{c} = \mathbf{0}$ (mod 2), where $H$ is the $3 \times 7$ parity-check matrix given in Section 35.6.
Problem 35.19 [I]
For the Steane code, verify that the stabilizer generator $\hat{g}_1 = \hat{Z}_1\hat{Z}_4\hat{Z}_6\hat{Z}_7$ has eigenvalue $+1$ on the logical state $|0\rangle_L$.
(Hint: Check that every computational basis state in the superposition for $|0\rangle_L$ has an even number of 1s at positions 1, 4, 6, 7.)
Problem 35.20 [A]
Show that the logical $\hat{X}_L$ operator for the Steane code is $\hat{X}_L = \hat{X}_1\hat{X}_2\hat{X}_3\hat{X}_4\hat{X}_5\hat{X}_6\hat{X}_7$ (apply $\hat{X}$ to all 7 qubits). Verify that this maps $|0\rangle_L \to |1\rangle_L$.
Section 35.7: Syndrome Measurement
Problem 35.21 [B]
For the syndrome measurement circuit using an ancilla qubit and two CNOT gates:
(a) Verify that if the data qubits are in $|00\rangle$, the ancilla measures $0$ (eigenvalue $+1$).
(b) Verify that if the data qubits are in $|01\rangle$, the ancilla measures $1$ (eigenvalue $-1$).
(c) Show that if the data qubits are in $\alpha|00\rangle + \beta|11\rangle$ (both same parity), the ancilla measures $0$ without disturbing the superposition.
Problem 35.22 [I]
The stabilizer formalism requires that all stabilizer generators commute. Show that $[\hat{Z}_1\hat{Z}_2, \hat{Z}_2\hat{Z}_3] = 0$ by using the fact that Pauli operators on different qubits commute.
Problem 35.23 [A]
Degeneracy in error correction. Two errors $\hat{E}_1$ and $\hat{E}_2$ are said to be degenerate if they produce the same syndrome and the same effect on the code space (i.e., $\hat{E}_1|\psi\rangle_L = e^{i\phi}\hat{E}_2|\psi\rangle_L$ for all logical states). Show that in the 3-qubit bit-flip code, there are no degenerate errors among the correctable set $\{\hat{I}, \hat{X}_1, \hat{X}_2, \hat{X}_3\}$.
Section 35.8–35.9: Threshold Theorem and Resource Overhead
Problem 35.24 [B]
For a concatenated code with $p_k = \frac{1}{c}(cp)^{2^k}$:
(a) If $p = 10^{-3}$ and $c = 100$, compute $p_1$, $p_2$, and $p_3$.
(b) How many levels of concatenation are needed to achieve $p_k < 10^{-15}$?
(c) If each level uses a 7-qubit code, how many physical qubits are needed per logical qubit at the level you found in (b)?
Problem 35.25 [I]
The surface code has a threshold of approximately $p_{\text{th}} \sim 1\%$ and requires $\sim 2d^2$ physical qubits per logical qubit at distance $d$. The logical error rate scales approximately as $p_L \sim (p/p_{\text{th}})^{(d+1)/2}$.
(a) For a physical error rate $p = 10^{-3}$, what code distance $d$ is needed to achieve $p_L < 10^{-12}$?
(b) How many physical qubits are required per logical qubit at this distance?
(c) To implement Shor's algorithm with 4,000 logical qubits at this error rate, how many total physical qubits are needed (ignoring magic state distillation overhead)?
Problem 35.26 [I]
Repetition code analysis. A classical repetition code encodes 1 bit in $n$ bits (all copies must agree). The code corrects up to $\lfloor(n-1)/2\rfloor$ errors.
(a) For $n = 5$ and bit-flip probability $p = 0.01$, compute the probability of a logical error (3 or more flips).
(b) Compare with $n = 3$.
(c) Show that for any $p < 1/2$, the logical error rate decreases exponentially with $n$.
Problem 35.27 [A]
The no-go theorem for transversal universality (Eastin-Knill). Explain qualitatively why no quantum error-correcting code can implement a universal gate set using only transversal gates. (Hint: A transversal gate acts independently on each physical qubit, so it cannot spread errors between qubits within a code block. But a universal gate set must include at least one gate that is not a Clifford gate.)
Problem 35.28 [A]
Magic state distillation. A "magic state" is $|T\rangle = \frac{1}{\sqrt{2}}(|0\rangle + e^{i\pi/4}|1\rangle)$. Show that if you have a supply of perfect $|T\rangle$ states, you can implement the $T$ gate ($T = \text{diag}(1, e^{i\pi/4})$) on any qubit $|\psi\rangle$ using only Clifford gates and one $|T\rangle$ state.
(Hint: Use the "gate teleportation" circuit: apply a CNOT between $|\psi\rangle$ (control) and $|T\rangle$ (target), measure the target in the $\{|+\rangle, |-\rangle\}$ basis, and apply a correction based on the measurement outcome.)
Synthesis Problems
Problem 35.29 [A]
Comparing codes. For each of the following quantum error-correcting codes, state: the number of physical qubits, the number of logical qubits, the code distance, and the types of errors it can correct.
(a) 3-qubit bit-flip code (b) 3-qubit phase-flip code (c) Shor [[9,1,3]] code (d) Steane [[7,1,3]] code
Problem 35.30 [A]
Design challenge. The 5-qubit code is the smallest quantum error-correcting code that can correct any single-qubit error. It encodes 1 logical qubit in 5 physical qubits: [[5,1,3]]. The stabilizer generators are:
$$\hat{g}_1 = \hat{X}_1\hat{Z}_2\hat{Z}_3\hat{X}_4, \qquad \hat{g}_2 = \hat{X}_2\hat{Z}_3\hat{Z}_4\hat{X}_5$$ $$\hat{g}_3 = \hat{X}_1\hat{X}_3\hat{Z}_4\hat{Z}_5, \qquad \hat{g}_4 = \hat{Z}_1\hat{X}_2\hat{X}_4\hat{Z}_5$$
(a) Verify that all four stabilizer generators commute.
(b) How many syndrome bits does this code produce? How many distinct error patterns can be identified?
(c) Show that $n - k = 4$ stabilizer generators are consistent with encoding $k = 1$ logical qubit in $n = 5$ physical qubits.
(d) There are $3 \times 5 = 15$ possible single-qubit Pauli errors ($\hat{X}_i$, $\hat{Y}_i$, $\hat{Z}_i$ for $i = 1, \ldots, 5$) plus the identity (no error) = 16 total. The syndrome has $2^4 = 16$ possible values. Explain why this is a perfect match and what it implies about the efficiency of the 5-qubit code.