Conventions: qubits numbered from 1 in the math (Stim numbers them from 0), , tableau rows written .
Problem 1
Problem 5.1 (Conjugation with signs).
Compute for (first on qubit 2, then on qubit 3), first with the conjugation tables and then with the bit rules, and check that the two agree.
Compute how conjugates , , . Which axis of the Bloch sphere does rotate about?
Solution
Tables. on qubit 2 sends , so . Then on qubit 3 sends , so .
Bits. is . : the sign flips because , then gives ; row , i.e. . : , no sign flip; swap : , i.e. . Both methods give .
Conjugation by a product applies the rightmost gate first: .
, so .
, so .
, so .
fixes and rotates the - plane by a quarter turn: it is a rotation about the axis (up to phase, ), just as is a rotation about .
Problem 2
Problem 5.2 (Tableau evolution for GHZ and beyond).
Start from .
Apply , , . Write the tableau after each gate and identify the final state.
Continue with and then . Write the final tableau and the three generators with signs.
Verify one of the final generators directly on the state vector, or explain how you would.
Solution
Initial tableau and updates (rows ):
step
row 1
row 2
row 3
generators
start
000|100|0
000|010|0
000|001|0
100|000|0
000|010|0
000|001|0
110|000|0
000|110|0
000|001|0
111|000|0
000|110|0
000|101|0
For : row 1 gets ; row 2 gets . No sign changes, because the sign term needs in the same row. The final state is .
: only row 1 has ; it had , so no sign flip and : row 1 becomes . Rows 2, 3 have and are unchanged.
: swap column 2 of the two blocks. Row 1 has , no , so no sign flip, and becomes . Row 2 has and becomes . Row 3 has on qubit 2 and stays .
Final generators: , , .
The state is . For instance : before it was , which stabilizes because commutes with ‘s. Conjugating by maps the statement ” stabilizes ” to ” stabilizes ”. A direct numerical check (multiply the matrix of by the state vector) gives the same result.
Problem 3
Problem 5.3 (Gate identities from tableaus).
Use only Pauli images (no matrices) to show, up to global phase:
.
.
Explain why “up to global phase” is all that the Pauli-image argument can give, and why that is enough for quantum circuits.
Right-hand side, rightmost gate first. swaps and fixes qubit-1 operators.
input
These are exactly the images , , ‘s fixed.
Rightmost gate first (, then , then ):
input
In the second column, spreads from 2 to 1 and from 1 to 2; e.g. . The final images swap the labels 1 and 2 on every operator, which is the tableau of SWAP. No signs appear because no row ever has the pattern or on (control, target).
If and are both Cliffords, they conjugate every Pauli identically, so the images cannot distinguish them. A global phase has no observable consequence: it multiplies every amplitude by the same number and cancels in all probabilities and expectation values. (If the gate is later controlled on another qubit the phase would become relative, but a controlled-Clifford is then a different gate with its own tableau.)
Problem 4
Problem 5.4 (Counting single-qubit Cliffords).
Show that no Clifford maps and on two qubits.
List all binary matrices with , where , and identify each with a permutation of .
Using that each permutation can be combined with 4 sign patterns, conclude that the single-qubit Clifford group has 24 elements modulo global phase. Name a gate sequence realizing the cyclic permutation .
Solution
and anticommute, but and commute. Conjugation preserves (anti)commutation, so the images of an anticommuting pair must anticommute. Contradiction.
Write acting on row vectors . A short computation gives , so the condition is , i.e. over (and ). The invertible binary matrices are exactly these, and there are 6 of them. Each is determined by the images of (first row) and (second row):
rows of
permutation of axes
example unitary
(10),(01)
identity
(01),(10)
(11),(01)
(10),(11)
(11),(10)
(01),(11)
The image of is the sum of the two rows. Products are operator products, so the rightmost gate acts first: means “apply , then ”. Signs are ignored in this table.
For each permutation, the signs of the images of and can be chosen freely by applying a Pauli first: conjugation by fixes and negates , by negates and fixes , by negates both, and by neither. So composing with a Pauli realizes all 4 sign choices for the pair of images. By Proposition 5.1 each (permutation, signs) pair is a different Clifford up to phase, which gives .
For the 3-cycle, take ( first): , , . So maps , , , the cycle up to signs. To fix the signs, apply a gate first: maps , , exactly.
Problem 5
Problem 5.5 (Row products with signs).
Using the function of Proposition 5.3, compute the sign of the product and write the result as a signed Pauli string.
Do the same for .
Explain why, in a stabilizer tableau, the total exponent is always even.
Solution
Per qubit, with the first factor and second : qubits 1 and 2 have , so each; qubit 3 has , so . Total , so the sign bit is 1. The bits add to , which is . Result: . (Directly: twice gives .)
Qubit 1 is : . Qubit 2 is : . Qubit 3 is : . Total , so the sign is . Bits: , which is . Result: . (Directly: , , product .)
Rows of a stabilizer tableau commute, so their product is Hermitian and its phase is real, . The phase is to the total exponent, so the exponent is or . If it were odd, the two rows would anticommute, signalling a bug.
Problem 6
Problem 5.6 (What Gottesman-Knill buys and what it does not).
How many bits does a stabilizer tableau of qubits need (with sign bits)? Compare with the number of complex amplitudes of a general state.
Show that for , and explain in one or two sentences why the tableau method cannot absorb this gate.
A friend says: “The surface code is highly entangled, and Stim simulates it with thousands of qubits, so entanglement cannot be what makes quantum computers powerful.” Assess the claim.
Solution
bits, about 250 kilobytes. A general state has amplitudes. (The Aaronson-Gottesman tableau of Module 6 doubles the stabilizer part with destabilizers: bits.)
. Since , this equals . A tableau row can only hold a single signed Pauli string. After , a stabilizer becomes a sum of two Pauli strings, and repeated gates would produce sums of exponentially many strings, so the compact description is lost.
The claim is half right. Entanglement alone does not imply a speedup: Clifford circuits produce maximal entanglement (Bell pairs, GHZ, toric-code ground states) and are classically simulable by Gottesman-Knill. But entanglement is still necessary for a speedup with pure states: circuits that keep the entanglement low are also classically simulable by other methods (for example matrix product states). Power needs entanglement and non-Clifford resources such as gates or magic states.
Problem 7
Problem 5.7 (Coding: a tableau simulator).
Implement a class Tableau(n) that stores an stabilizer tableau initialised to , with methods h(a), s(a), cnot(c, t) (0-indexed qubits) using the update rules of Module 5, and a method generators() returning strings like "+XX_". Then:
Run the Bell circuit and the GHZ-plus- circuit of Problem 5.2 and print the generators.
For 200 random 4-qubit circuits of 30 gates, compare your generators with stim.Tableau.from_circuit(circuit).z_output(k) for .
Solution
import numpy as npimport stimclass Tableau: def __init__(self, n): self.n = n self.x = np.zeros((n, n), dtype=np.uint8) self.z = np.eye(n, dtype=np.uint8) # generators Z_1..Z_n self.r = np.zeros(n, dtype=np.uint8) def h(self, a): self.r ^= self.x[:, a] & self.z[:, a] self.x[:, a], self.z[:, a] = self.z[:, a].copy(), self.x[:, a].copy() def s(self, a): self.r ^= self.x[:, a] & self.z[:, a] self.z[:, a] ^= self.x[:, a] def cnot(self, c, t): self.r ^= self.x[:, c] & self.z[:, t] & (self.x[:, t] ^ self.z[:, c] ^ 1) self.x[:, t] ^= self.x[:, c] self.z[:, c] ^= self.z[:, t] def generators(self): sym = {(0, 0): "_", (1, 0): "X", (0, 1): "Z", (1, 1): "Y"} return ["-+"[1 - self.r[i]] + "".join(sym[(self.x[i, j], self.z[i, j])] for j in range(self.n)) for i in range(self.n)]t = Tableau(2); t.h(0); t.cnot(0, 1)print(t.generators()) # ['+XX', '+ZZ']t = Tableau(3); t.h(0); t.cnot(0, 1); t.cnot(0, 2); t.s(0); t.h(1)print(t.generators()) # ['+YZX', '+ZX_', '+Z_Z']rng = np.random.default_rng(1)for trial in range(200): n, t, c = 4, Tableau(4), stim.Circuit() for _ in range(30): k = rng.integers(3) if k == 0: a = int(rng.integers(n)); t.h(a); c.append("H", [a]) elif k == 1: a = int(rng.integers(n)); t.s(a); c.append("S", [a]) else: a, b = map(int, rng.choice(n, 2, replace=False)) t.cnot(a, b); c.append("CNOT", [a, b]) T = stim.Tableau.from_circuit(c) assert t.generators() == [str(T.z_output(k)) for k in range(n)]print("all 200 circuits agree with stim")
Output: the Bell circuit gives ['+XX', '+ZZ']; the second circuit gives ['+YZX', '+ZX_', '+Z_Z'], matching Problem 5.2; and all 200 random circuits agree with Stim. Note that the comparison works row by row because both programs start from and never reorder or multiply rows; once measurements are added (Module 6), two tableaus can describe the same state with different rows, and one must compare canonical forms instead.