Conventions: Hermitian , Pauli strings read left to right as qubits .
Problem 1
Problem 2.1 (Pauli arithmetic).
Compute each product as a phase times a Pauli string, and say whether the two factors commute.
Then explain why , and why can never belong to a stabilizer group.
Solution
Work qubit by qubit with , , and their reverses , , .
. Two clashes (positions 1 and 3), so they commute.
. Two clashes, commute.
. One clash, anticommute (and the product is not Hermitian, as must happen for anticommuting Hermitian factors: ).
. Two clashes, commute.
There are Pauli strings and each may carry one of phases; distinct (phase, string) pairs give distinct matrices because the strings are linearly independent. So . Finally , so a group containing contains , which a stabilizer group may not.
Problem 2
Problem 2.2 (Counting commuting strings).
Prove that for any Pauli string on qubits, exactly of the Pauli strings commute with .
Let be Pauli strings whose binary vectors are independent (no product of a subset is up to phase). Show that the commutation pattern of a uniformly random string with is uniformly distributed over (hint: the pattern is a linear function of the binary vector of the string). Use this to predict how many 3-qubit strings commute with both and , and list them.
Solution
Choose a position with . Fix the entries of at all other positions; they contribute some number of clashes. At position , the choices add no clash and the two other choices add one. So exactly two of the four completions have an even total. Summing over the choices of the other positions gives commuting strings.
Uniformity. Write for the binary vector of and for that of . The commutation pattern is , where is the symplectic form (count of clashes mod 2). This is a linear map , given by the matrix whose rows are with - and -halves swapped. Swapping halves is invertible, so independent give independent rows and the matrix has rank ; the map is onto. Every pattern then has the same number of preimages, (a coset of the kernel). Each independent constraint therefore halves the count. Part 1 is the case .
With independent constraints, a fraction of the strings commute with both, i.e. . They are the strings whose -part (positions with or ) is either empty or all three qubits, with any -part:
(An enumeration confirms exactly these 16.) These are the stabilizers and logical operators of the bit-flip code, which we meet again in Module 3.
Problem 3
Problem 2.3 (Valid generating sets).
For each list decide: (a) do the elements pairwise commute? (b) is in the generated group? (c) are they independent? If the list is a valid stabilizer group, give and .
Solution
and clash twice, so they commute. Their product is (Problem 1), so , no , independent; and . (The state is the two-qubit cluster state .)
and clash once (qubit 2): they anticommute. Invalid.
All pairs clash twice, so they commute. But , so . Invalid. (Replacing by gives a valid but dependent list: is the stabilizer group of .)
vs : two clashes; vs : two clashes; vs : no clash. All commute; no product of a subset is up to phase, so they are independent; , . It is the GHZ state in the basis, .
All commute (only s). But , so they are dependent: only two independent generators, , and . Listing adds no constraint.
Problem 4
Problem 2.4 (Stabilizer groups of named states).
Find a stabilizer generator for .
Which two-qubit state is stabilized by ?
Give independent generators and the full group for .
Give four independent generators for , and find the signs of and in its stabilizer group.
Solution
From and : . So .
fixes and fixes , so the state is .
Both components have opposite bits () and swaps them (). So , and the product . The full group is .
As for GHZ: and the neighbouring parities , , . These four are independent (the three -type ones are independent and none of them contains an ). For the signs, as an operator identity, and fixes , so : sign . Similarly , which has sign . (Both signs confirmed numerically.)
Problem 5
Problem 2.5 (The dimension formula).
Let be a stabilizer group on qubits with independent generators.
For signs define . Show that and for .
Show that every has trace . (Hint: repeat the argument of Theorem 2.1, or find a Pauli that maps to .)
Compute for and for .
Solution
For each , ; multiplying these identities and expanding gives . If then contains the factor (all factors commute, so we can bring these two together).
Expanding gives . Only the term has non-zero trace, equal to , so for every . (Alternatively: by Problem 2 there is a Pauli with any prescribed commutation pattern with the , and .) So the syndrome spaces all have the same dimension and tile the whole space: .
: , , dimension (two logical qubits; this is the code). : the three generators commute ( clashes twice with each pair) and are independent, so dimension . Numerically, each of the sign patterns of the second group has a 2-dimensional eigenspace.
Problem 6
Problem 2.6 (Counting small stabilizer states).
List all single-qubit stabilizer states and their stabilizer groups. Check that agrees with .
Of the two-qubit stabilizer states, how many are product states and how many are entangled? Explain how to recognize an entangled one from its stabilizer group.
Solution
A single-qubit stabilizer group is with : six groups, the six states . The formula gives .
A product of two single-qubit stabilizer states: . The remaining are entangled (we confirmed the split by enumerating all 60 groups). A two-qubit stabilizer state is a product state iff its group contains a non-identity element acting only on qubit 1 (and then also one acting only on qubit 2). For example has no weight-one element, so is entangled. The 24 entangled ones are exactly the images of under the 24 single-qubit Clifford operations (up to phase) applied to qubit 2, a fact we confirmed with Stim; Cliffords are the subject of Module 5.
Problem 7
Problem 2.7 (A phase-tracking Pauli multiplier).
Represent a signed Pauli string as with a Hermitian Pauli string and , and store as two bit arrays (, , , ).
Using and , derive a formula for the phase exponent of a product .
Implement it in numpy and test it against stim.PauliString multiplication on random strings.
Solution
A Hermitian string with bits equals , where and counts the s. Then
because moving past costs a sign at every position where both are present. Writing the result back as a Hermitian string with gives
A reference implementation:
import numpy as np, stimdef to_xz(s): return (np.array([c in "XY" for c in s], dtype=np.uint8), np.array([c in "ZY" for c in s], dtype=np.uint8))def from_xz(x, z): return "".join("IXZY"[a + 2 * b] for a, b in zip(x, z))def pauli_mult(p, q): (e1, s1), (e2, s2) = p, q x1, z1 = to_xz(s1); x2, z2 = to_xz(s2) x, z = x1 ^ x2, z1 ^ z2 e = (e1 + e2 + int((x1 & z1).sum()) + int((x2 & z2).sum()) + 2 * int((z1 & x2).sum()) - int((x & z).sum())) return e % 4, from_xz(x, z)rng = np.random.default_rng(0)for _ in range(2000): n = rng.integers(1, 7) s1 = "".join(rng.choice(list("IXYZ"), n)) s2 = "".join(rng.choice(list("IXYZ"), n)) e, s = pauli_mult((0, s1), (0, s2)) assert stim.PauliString(s) * (1j ** e) == stim.PauliString(s1) * stim.PauliString(s2)print(pauli_mult((0, "XX"), (0, "ZZ"))) # (2, 'YY'), i.e. -YY
All 2000 random tests pass, and the example reproduces . Module 5 uses the same bookkeeping (in a slightly different form due to Aaronson and Gottesman) to update stabilizer tableaus.