Conventions: qubits are numbered from 1, binary vectors are with the block first, , and .
Problem 1
Problem 4.1 (Bits, phases, and commutation).
Consider the four-qubit Paulis
Write each as a binary vector .
Compute the matrix . Which pairs anticommute?
Compute the product including its phase, and check that its binary vector is the sum of those of and .
Write in the form , i.e. find .
Solution
Reading , , qubit by qubit:
1100
0110
0011
1100
1010
1011
0110
0011
For example . Doing all pairs,
The diagonal is zero, as it must be for an alternating form. anticommutes with each of , , ; all other pairs commute. (Check one directly: and clash on qubit 1 ( vs ) and qubit 3 ( vs ), two clashes, so they commute.)
Qubit by qubit: , , , . So . In bits, , which is . The bits give the right Pauli; the factor is invisible to them (and is a reminder that the product of two anticommuting Hermitian Paulis is anti-Hermitian).
has , , so . Hence , so , matching the rule .
Problem 2
Problem 4.2 (The symplectic form).
Prove the following for on .
It is alternating: for every .
It is non-degenerate: if for all , then .
If is a subspace of dimension , then has dimension .
Conclude that an isotropic subspace () has dimension at most , so a stabilizer group on qubits has at most independent generators.
Solution
For , .
Let . Testing against (the vector of ) gives , and against gives . If all of these vanish then .
Let be an matrix whose rows are a basis of . Then . Since is invertible (), , so by rank-nullity .
If then , i.e. . A stabilizer group with independent generators is an isotropic subspace of dimension (its elements commute), hence . Equality gives , a stabilizer state.
Problem 3
Problem 4.3 (The five-qubit code in binary).
Use the generators , , , .
Verify and by explicit bit arithmetic.
Using the rule “column of is , column of is ”, write down , , and .
Explain, using only counting, why a code is the smallest possible non-degenerate code that corrects every single-qubit error, given that it has to have distinct nonzero syndromes for all single-qubit errors.
Show that and commute with every and anticommute with each other. Why does that make them a valid choice of ?
Solution
, , .
.
.
Column 3 of (the bits of qubit 3 in each row) is , so . Column 3 of is , so . Then . As a check: anticommutes with ( on qubit 3) and (), and commutes with () and ().
With generators there are nonzero syndromes. A non-degenerate code correcting all single-qubit errors needs distinct nonzero syndromes, so . With : gives (no), gives (no), gives (yes, with equality). This is the quantum Hamming bound, and the five-qubit code saturates it.
. For any , . Each is a cyclic shift of , which has exactly two ‘s and two ‘s, so and the product is . Similarly . Both are therefore in the normalizer. Finally , so they anticommute.
Neither is in : an element of commutes with every element of the normalizer, but each of these anticommutes with the other, which is in the normalizer. A pair of anticommuting normalizer elements outside is exactly a logical pair for .
Problem 4
Problem 4.4 (Logical operators of a small CSS code).
Let , the code with checks and .
Compute and the sizes of and .
Find two -type logicals and two -type logicals such that anticommutes with iff .
Show the distance is 2 and give one weight-1 error the code detects but cannot correct.
Generalize: for even , gives . Why must be even?
Solution
. is the set of even-weight words, ; has 2 elements. The quotient has classes.
Pick , (both even weight, so in ; neither is or , and they are not equivalent to each other because their sum ). For -type logicals pick , . The overlaps are
1 (odd)
2 (even)
2 (even)
1 (odd)
so anticommutes with exactly when . All four commute with and because they have even weight.
Every weight-1 Pauli anticommutes with or (an anticommutes with , a with , a with both), so the lightest logical has weight at least 2, and has weight 2: . The error has syndrome ” fires”, exactly the same as . Since is a nontrivial logical, no decoder can tell which one occurred: the code detects but cannot correct it.
, which vanishes iff is even; for odd the checks and anticommute. For even , ; weight-1 errors are detected as above and is a weight-2 logical, so . (For this gives .)
Problem 5
Problem 4.5 (Quantum Hamming codes).
For let be the matrix whose columns are all nonzero -bit strings, and set .
Show that every row of has weight and any two distinct rows overlap in positions. Conclude .
Show . For , write the parameters.
Show . (Hint: lower bound from the classical Hamming code; upper bound from an explicit weight-3 logical.)
Solution
Row has a 1 in every column whose bit is 1. Among the nonzero strings, exactly have bit equal to 1. Two rows overlap on the strings with bits and both 1, of which there are . For both numbers are even, so every entry of is .
The rows are independent (the columns include the unit vectors), so and . For this gives (Steane); for , and : a code.
Lower bound: an -logical is a word in , the classical Hamming code, whose nonzero words have weight (no column is zero, so no weight-1 codeword; columns are distinct, so no weight-2 codeword). Same for . So . Upper bound: the columns for satisfy , so . Every element of has even weight (rows have even weight and the overlap argument shows sums stay even; for the weights are 0 and 8), while has weight 3, so . Hence is a nontrivial logical and .
Problem 6
Problem 4.6 (Why CSS decoding splits).
Let be a Pauli error with binary vector acting on a CSS code with matrices () and ().
Show that the syndrome is .
Show that if is any solution of and any solution of , then applying the correction returns the state to the codespace, and the correction succeeds iff and .
Give an example on the Steane code of an error with a in it where treating the two halves independently is still optimal, and say briefly why independence can be suboptimal under depolarizing noise.
Solution
The check matrix is and swaps the and halves: . Therefore . The -checks see only and the -checks see only .
The residual error after correction is, up to phase, . Its syndrome is , so it lies in the normalizer and the state is back in the codespace. It acts trivially iff it is in . For a CSS code, (up to sign) iff and , because is generated by pure and pure checks. If, say, , the residual contains a nontrivial -logical.
Take on the Steane code: . The -checks give binary(5) , and the -checks give the same. Decoding each half with the Hamming lookup independently returns , i.e. , which is exactly right. Independence fails to be optimal when the noise correlates the halves: under depolarizing noise a is as likely as an , but the independent decoder treats a as two separate faults (an and a ), so it overestimates its cost. Decoders that use this correlation (for example correlated matching, mentioned in Module 10) do better for the surface code.
Problem 7
Problem 4.7 (Coding: a CSS parameter calculator).
Write a Python function css_params(HX, HZ) that, for small codes, returns together with and , by
computing ranks over by Gaussian elimination,
enumerating and to find , and likewise .
First assert . Test it on: the Steane code, the code, the Shor code of Module 4, and the quantum Hamming code of Problem 4.5. Which of these codes has a classical code of distance smaller than the quantum ?
Solution
A compact solution with numpy (exponential enumeration is fine for ):
import itertoolsimport numpy as npdef rref2(M): M = (np.array(M, dtype=np.uint8) % 2).copy() r, pivs = 0, [] for c in range(M.shape[1]): rows = [i for i in range(r, M.shape[0]) if M[i, c]] if not rows: continue M[[r, rows[0]]] = M[[rows[0], r]] for i in range(M.shape[0]): if i != r and M[i, c]: M[i] ^= M[r] pivs.append(c); r += 1 if r == M.shape[0]: break return M[:r], pivsdef rank2(M): return len(rref2(M)[1])def kernel2(M): n = M.shape[1] R, pivs = rref2(M) basis = [] for f in (c for c in range(n) if c not in pivs): v = np.zeros(n, dtype=np.uint8); v[f] = 1 for i, p in enumerate(pivs): v[p] = R[i, f] basis.append(v) return np.array(basis, dtype=np.uint8)def span(B): return {tuple(int(t) for t in (np.array(c) @ B) % 2) for c in itertools.product([0, 1], repeat=len(B))}def css_params(HX, HZ): assert not ((HX @ HZ.T) % 2).any(), "checks do not commute" n = HX.shape[1] k = n - rank2(HX) - rank2(HZ) dX = min(sum(a) for a in span(kernel2(HZ)) if a not in span(HX)) dZ = min(sum(b) for b in span(kernel2(HX)) if b not in span(HZ)) return n, k, min(dX, dZ), dX, dZ
Test matrices: Steane uses (the Hamming matrix of Module 4) for both; uses [[1,1,1,1]]; the Shor code uses the six pair checks for and the two weight-6 rows for ; the quantum Hamming code uses (columns in binary). Running the function gives
code
Steane
(7, 1, 3, 3, 3)
(4, 2, 2, 2, 2)
Shor
(9, 1, 3, 3, 3)
quantum Hamming
(15, 7, 3, 3, 3)
For the Shor code, contains weight-2 words such as , so the classical distance is 2, but all of them are in (they are stabilizers like ), and the quantum is 3. For the other three codes the classical distances of and equal the quantum ones. (As a bonus test, the toric code of Module 7 returns .)