Scholarly Expositions • Substack • Bigganblog

Research Blog, Essays & Science Writing

Technical tutorials on quantum algorithms and open quantum systems, philosophical essays on epistemology and logic on Substack, and popular mathematics & physics articles in Bengali on Bigganblog.

← Back to All Articles

Group Theory for Quantum Computing: Paulis, Codes, and Magic States

Pauli errors X1, Z1 and Y1 acquire distinct four-sign syndromes after encoding in the five-qubit perfect code.

The three troublemakers in the cover are $X_1$, $Z_1$, and $Y_1$: Pauli errors acting on the first qubit. They look rather confident until we encode our information. Then each leaves a different pattern of plus and minus signs. The joke is a calculation, and group theory lets us work it out.

Quantum gates can flip a bit, change a phase, and create entanglement. Yet an enormous collection of useful gates, the Clifford group, still cannot perform arbitrary quantum computation. The same algebra that makes errors easy to track also restricts what those gates can do.

Let us follow that connection from the ground up, with the five-qubit perfect code as our running example. Its checks will give us a subgroup, their outcomes will give us a homomorphism and a kernel, and its logical operations will make quotients concrete. From there, we can see what Clifford gates preserve, why that limits them, and how a magic state supplies a missing operation.

1. Groups Describe Reversible Operations

A pure qubit state is represented by a normalized complex vector $|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$, with $|\alpha|^2+|\beta|^2=1$. A reversible gate is a unitary matrix $U$: its conjugate transpose $U^\dagger$ satisfies $U^\dagger U=UU^\dagger=I$. Thus $U^{-1}=U^\dagger$.

A group is a set together with an operation satisfying four rules:

  • Closure: combining two elements gives another element of the set.
  • Associativity: $(AB)C=A(BC)$.
  • Identity: $IA=AI=A$.
  • Inverses: every $A$ has an $A^{-1}$ with $AA^{-1}=A^{-1}A=I$.

Unitary matrices of a fixed size form a group under multiplication. Closure follows from $(UV)^\dagger(UV)=V^\dagger U^\dagger UV=I$; associativity comes from matrix multiplication. We apply the rightmost gate first: $UV|\psi\rangle$ means apply $V$, then $U$. Reversing the sequence reverses the order: $(UV)^{-1}=V^{-1}U^{-1}$.

The operation matters. Integers form a group under addition, with identity $0$ and inverse $-a$. They fail under multiplication because $2$ has no integer multiplicative inverse.

Commutativity is optional. A group satisfying $AB=BA$ is Abelian. Quantum gates give an immediate counterexample:

$$ X=\begin{pmatrix}0&1\\1&0\end{pmatrix},\qquad Z=\begin{pmatrix}1&0\\0&-1\end{pmatrix},\qquad XZ=-ZX. $$

$X$ flips the computational basis states; $Z$ changes the sign of the $|1\rangle$ amplitude. Both square to $I$, but their order matters as matrices. The minus sign will matter when these operators describe measurement checks.

2. The Pauli Group, and What a Quotient Forgets

We now have a language for reversible operations. To use it for quantum errors, let us start with the smallest useful collection built from those bit and phase flips.

A subgroup is a subset that forms a group under the same operation. A set of generators produces every group element through products and inverses. The order of an element is the smallest positive power giving the identity, if such a power exists. Thus $X$ has order two, while $iI$ has order four. Powers of one generator form a cyclic group.

The one-qubit Pauli group is

$$ \mathcal P_1=\{i^kX^aZ^b:k=0,1,2,3;\ a,b=0,1\}. $$

It contains sixteen matrices, generated by $iI,X,Z$. Defining $Y=iXZ$ gives the familiar description $\{\pm I,\pm iI,\pm X,\pm iX,\pm Y,\pm iY,\pm Z,\pm iZ\}$. The phase factors ensure closure: for example, $XZ=-iY$.

Multiplying a whole state by $e^{i\theta}$ changes no measurement probability. Accordingly, $U$ and $e^{i\theta}U$ act identically on a register up to global phase. This does not identify relative phases: $(|0\rangle+|1\rangle)/\sqrt2$ and $(|0\rangle-|1\rangle)/\sqrt2$ are different states.

Declare two Paulis equivalent when they differ by a factor from

$$ K=\{I,-I,iI,-iI\}. $$

An equivalence relation is reflexive, symmetric, and transitive: descriptions match themselves, matches work both ways, and chains of matches remain consistent. Its equivalence classes collect matching descriptions; a representative is one chosen description. Here a class is a coset $PK=\{Pk:k\in K\}$. For example, $XK=\{X,-X,iX,-iX\}$. The quotient $\mathcal P_1/K$ contains four classes, represented by $I,X,Z,XZ$.

Let $\mathbb F_2=\{0,1\}$ with arithmetic modulo two. Addition is XOR, so $1+1=0$. Ignoring phase, multiplication adds the binary labels:

$$ [X^aZ^b][X^cZ^d]=[X^{a+c}Z^{b+d}], \qquad \mathcal P_1/K\cong\mathbb F_2^2. $$

Square brackets denote classes. The symbol $\cong$ means isomorphic: a bijection, meaning a one-to-one and onto map, preserving the operation. The Pauli group is non-Abelian, while this quotient is Abelian. We deliberately discarded its commutation phase, so we must retain the original operators whenever that phase matters.

For coset multiplication to be well defined, changing representatives must leave the answer unchanged. In a general group $G$, this works exactly when the subgroup $K$ is normal:

$$ gKg^{-1}=K\qquad(g\in G). $$

The transformation $k\mapsto gkg^{-1}$ is conjugation. Our phase subgroup commutes with everything, so it is normal. More generally, $(gk_1)(hk_2)=gh(h^{-1}k_1h)k_2$ explains the condition: normality keeps the extra factors inside $K$.

3. The Perfect Code: Four Checks Protect One Qubit

Now let us put those groups to work on the cover. We want to learn which error occurred while leaving the unknown amplitudes alone. The trick is to encode the qubit in a space where certain measurements always have the same answer, whatever those amplitudes are.

For $n$ qubits, Pauli operators are tensor products of $I,X,Y,Z$, with the same four overall phases as before. They form the group $\mathcal P_n$. Here we use five qubits, numbered from left to right: $X_1=XIIII$ means $X\otimes I\otimes I\otimes I\otimes I$.

The five-qubit perfect code uses the four checks printed in the meme:

$$ \begin{aligned} g_1&=XZZXI, & g_2&=IXZZX,\\ g_3&=XIXZZ, & g_4&=ZXIXZ. \end{aligned} $$

Each check is Hermitian, meaning $g_j^\dagger=g_j$, and squares to $I$, so its measurement outcomes are the eigenvalues $+1$ and $-1$. Although $X$ and $Z$ anticommute on one qubit, each pair of these strings anticommutes at an even number of positions. The minus signs cancel. For example, $g_1$ and $g_2$ anticommute at positions $2$ and $4$, and commute overall.

Their products form an Abelian stabilizer subgroup of $\mathcal P_5$:

$$ \mathcal S=\langle g_1,g_2,g_3,g_4\rangle =\{g_1^{a_1}g_2^{a_2}g_3^{a_3}g_4^{a_4}:a_j\in\{0,1\}\}. $$

The generators are independent: no nonempty product gives $I$ or $-I$. To check this, track the $X$ components of a proposed scalar product. Positions $3$ and $5$ first force $g_3$ and $g_2$ to be absent; positions $1$ and $2$ then force $g_1$ and $g_4$ to be absent. Thus $\mathcal S$ has $2^4=16$ elements and does not contain $-I$.

A stabilizer code is the common $+1$ eigenspace of such a group. Excluding $-I$ matters: otherwise a code state would have to satisfy $-|\psi\rangle=|\psi\rangle$, leaving only the zero vector. We call the allowed subspace the codespace.

Its projector is

$$ \Pi=\prod_{j=1}^{4}\frac{I+g_j}{2} =\frac1{16}\sum_{g\in\mathcal S}g. $$

A projector keeps a vector's component in the chosen subspace. Its trace, the sum of its diagonal entries, counts that subspace's dimension. Here only the identity term has nonzero trace, so $\operatorname{Tr}\Pi=32/16=2$. Four independent constraints have left room for one logical qubit inside the $2^5$-dimensional space of five physical qubits.

Choose orthonormal basis states $|0_L\rangle,|1_L\rangle$ in that space and encode

$$ \alpha|0\rangle+\beta|1\rangle \longmapsto |\psi_L\rangle=\alpha|0_L\rangle+\beta|1_L\rangle. $$

The subscript $L$ means logical. We have distributed one qubit across five physical qubits, not made five copies of an unknown state. Every encoded superposition returns $++++$, so these checks reveal neither $\alpha$ nor $\beta$. The subgroup has given us measurements we can safely use to look for trouble.

4. Syndromes, Kernels, and Logical Operations

Reading the Meme's Four Signs

For a Pauli error $E$, define a bit $s_j(E)$ by

$$ g_jE=(-1)^{s_j(E)}Eg_j. $$

It is $0$ if the error commutes with the check and $1$ if it anticommutes. Since $g_j|\psi_L\rangle=|\psi_L\rangle$,

$$ g_jE|\psi_L\rangle=(-1)^{s_j(E)}E|\psi_L\rangle. $$

The four bits form the error syndrome $s(E)=(s_1(E),s_2(E),s_3(E),s_4(E))$. In the order $(g_1,g_2,g_3,g_4)$, the cover's three signatures are

$$ \begin{array}{c|cccc} \text{error}&g_1&g_2&g_3&g_4\\\hline I&+&+&+&+\\ X_1&+&+&+&-\\ Z_1&-&+&-&+\\ Y_1&-&+&-&- \end{array} $$

For instance, $X_1$ commutes with the first three checks and anticommutes with the $Z$ at the start of $g_4$, giving bits $0001$. The errors have acquired name tags. Once we identify one of them within the single-qubit error set, applying that same Pauli reverses it because $X^2=Y^2=Z^2=I$.

What the Syndrome Remembers

Move a check past a product $EF$: it picks up the sign from $E$, then the sign from $F$. Signs multiply, so their binary exponents add:

$$ s(EF)=s(E)+s(F),\qquad s:\mathcal P_5\longrightarrow\mathbb F_2^4. $$

Here $\mathbb F_2^4$ means four-bit strings added coordinatewise by XOR. A map preserving the group operation is a homomorphism. Its kernel is the subgroup sent to the identity, here the zero syndrome:

$$ K_{\mathrm{syn}}=\ker s =\{E\in\mathcal P_5:g_jE=Eg_j\text{ for every }j\}. $$

This is the set of Paulis that commute with all our checks. It is normal in $\mathcal P_5$: conjugation cannot change its zero syndrome, since $s(FEF^{-1})=s(E)$. Now compare two errors:

$$ s(E)=s(F)\iff E^{-1}F\in K_{\mathrm{syn}}. $$

Each syndrome therefore labels an entire coset $EK_{\mathrm{syn}}$. We can distinguish those cosets even though we cannot distinguish every operator inside one.

Every four-bit syndrome occurs. For example, $X_2,Z_5,Z_3,X_1$ give $1000,0100,0010,0001$, respectively; their products generate all sixteen strings. The image of a map is its set of attained outputs. The first isomorphism theorem, $G/\ker\phi\cong\operatorname{im}\phi$, therefore becomes

$$ \mathcal P_5/K_{\mathrm{syn}}\cong\mathbb F_2^4. $$

That abstract theorem is describing our four measurement bits. The quotient collects precisely the errors our checks cannot tell apart.

What a Zero Syndrome Can Hide

A zero syndrome does not promise that the information is untouched. Consider

$$ \overline X=XXXXX,\qquad \overline Z=ZZZZZ. $$

They commute with every stabilizer but anticommute with each other, so within the codespace they act as logical Pauli operators. We choose the logical basis so that $\overline Z|0_L\rangle=|0_L\rangle$ and $|1_L\rangle=\overline X|0_L\rangle$. They produce no syndrome while changing the encoded information.

By contrast, every member of $\mathcal S$ acts as the identity on the codespace. Multiplying a codespace-preserving Pauli by a stabilizer leaves its logical action unchanged. Also, every element of $K_{\mathrm{syn}}$ commutes with $\mathcal S$, so $\mathcal S$ is normal inside this kernel. This gives us a second useful quotient:

$$ K_{\mathrm{syn}}/\mathcal S\cong\mathcal P_1. $$

The count makes this concrete. Including phases, $\mathcal P_5$ contains $4\cdot4^5=4096$ operators. Its sixteen syndrome cosets have equal size, so the kernel contains $256$. Dividing by the sixteen stabilizers leaves sixteen logical classes, represented by $i^k\overline X^a\overline Z^b$. These are exactly the one-qubit Paulis, with their global phases retained. Ignoring those phases would leave four logical operations.

The first quotient tells us what the checks report. The second tells us what zero-syndrome Paulis do to the logical qubit. Confusing the kernel with the stabilizer group would erase this distinction.

Why the Code Is Called Perfect

The same commutation test gives fifteen distinct nonzero syndromes, one for each $X_j,Y_j,Z_j$ on the five positions. Together with no error, they use all sixteen outcomes. Each sends the two-dimensional codespace into a different, orthogonal syndrome space. The counting fits exactly:

$$ 2^1(1+3\cdot5)=32=2^5. $$

This saturates the quantum Hamming bound for a nondegenerate code correcting one error: the no-error space and the fifteen single-qubit Pauli error spaces fit without overlap or unused dimensions. That is what perfect means here.

The correction extends beyond a randomly chosen Pauli. Every operator on one qubit is a linear combination $aI+bX+cY+dZ$. Syndrome measurement separates these components into their corresponding error spaces, and correction returns each branch to the same encoded state. The same argument applies to the error operators of a single-qubit noise channel. We assume ideal encoding, checks, and recovery, with noise acting on at most one physical qubit.

That last step is about linear combinations. Products deserve their own check, which brings us to another meme:

A QEC meme claiming that correcting X and Z errors may not correct their product ZX; the qualification is explained below.

The warning works for composing error patterns, but needs care when both Paulis act on the same known qubit. Open this meme in the collection.

Correctable errors need not remain correctable when multiplied. For example, our five-qubit code corrects $X_1$ and $Z_2$ separately, but $X_1Z_2$ produces syndrome $0100$, just like $Z_5$. Applying the single-error correction $Z_5$ leaves a nontrivial logical error. Two correctable alternatives have composed into a two-qubit error outside the guarantee.

There is an important qualification to the meme: if a code jointly corrects $\{I,X_j,Z_j\}$ on one fixed, known qubit $j$, then it can also correct $Y_j$. The Knill-Laflamme criterion requires $\Pi E_a^\dagger E_b\Pi=c_{ab}\Pi$ for all error pairs, where $\Pi$ is the projector onto the codespace and each $c_{ab}$ is a scalar. For that fixed-site set, the pairwise products already include $X_j,Z_j,Y_j$ up to phase, which also suffices for the enlarged set containing $Y_j$. Also, $Z_jX_j=iY_j$, while $X_jZ_j=-iY_j$. So the safe lesson is to specify the locations and the full error set, then check them together. Above, we explicitly distinguished all fifteen single-qubit Paulis before using linearity.

The code's distance is the smallest weight of a Pauli that preserves the codespace but acts on its logical qubit as more than an overall phase. Weight counts nonidentity tensor factors. Distinct single-error syndromes rule out such operators of weight one or two. Meanwhile, $\overline Xg_1=-IYYIX$ has weight three and the same logical action as $\overline X$. Thus the distance is three, giving the notation $[[5,1,3]]$: five physical qubits, one logical qubit, distance three.

The correctable-error assumption matters. Higher-weight errors can imitate a single-qubit syndrome or escape the checks entirely. Encoding makes the errors in the cover identifiable and correctable; it does not stop them from acting.

5. Clifford Gates Preserve the Pauli Group

We can now recognize errors using a group of checks. But a computation keeps moving the state through gates, so those errors and checks must move with it. Conjugation, which first appeared when we defined normal subgroups, tells us how. The gates preserving the Pauli description form the Clifford group:

$$ \mathcal C_n=\{U\text{ unitary}:U\mathcal P_nU^\dagger=\mathcal P_n\}. $$

In group theory this is the normalizer of $\mathcal P_n$: gates whose conjugation permutes the Pauli group. A normalizer is a group because composing or undoing two such permutations still preserves the set.

Two one-qubit Clifford generators are

$$ H=\frac1{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix},\qquad S=\begin{pmatrix}1&0\\0&i\end{pmatrix}. $$

Direct multiplication gives

$$ HXH^\dagger=Z,\quad HZH^\dagger=X,\qquad SXS^\dagger=Y,\quad SZS^\dagger=Z. $$

Together with CNOT, defined by $|a,b\rangle\mapsto|a,a+b\rangle$ for binary $a,b$, these generate the multi-qubit Clifford group up to global phase.

Conjugation also explains error propagation. An error $E$ before a gate $U$ satisfies

$$ UE|\psi\rangle=(UEU^\dagger)U|\psi\rangle. $$

For Clifford $U$ and Pauli $E$, the propagated error remains a Pauli. For example, CNOT conjugates $X\otimes I$ to $X\otimes X$. A one-qubit error can spread to two qubits, even though it remains inside the Pauli group. Preserving that group makes tracking errors manageable; controlling their spread is a further requirement for fault tolerance. The same conjugation updates stabilizer checks. A Clifford can map one stabilizer code to another; preserving this particular codespace requires $U\mathcal S U^\dagger=\mathcal S$.

6. Why Clifford Gates Are Not Universal

This tidy error bookkeeping is a real advantage. It also raises a question: how much computation can fit inside a gate set that keeps permuting the same Pauli structure?

On one qubit, conjugation by a Clifford sends $X,Y,Z$ to signed Pauli axes. There are six choices for the image of $Z$, then four anticommuting choices for the image of $X$. Their product fixes the image of $Y=iXZ$.

Using $H,S$, first send $Z$ to the chosen axis; composing on the right with $S^k$ cycles through the four possible images of $X$. Thus all $6\times4=24$ choices are realized. Two gates with identical actions on $X,Z$ differ only by a matrix commuting with both, which must be a scalar multiple of $I$.

The one-qubit Clifford group therefore has only 24 elements after global phases are identified. Longer Clifford circuits keep returning to that finite set. They cannot approximate arbitrary one-qubit rotations.

The restriction persists with ancillas and measurements. Starting from computational basis states, Clifford gates, Pauli measurements, and classical feedforward stay within the stabilizer formalism. Their measurement statistics can be simulated efficiently on a classical computer, as formalized by the Gottesman–Knill theorem. Such circuits can create entanglement; entanglement alone does not remove their algebraic restriction.

For a single pure qubit, the stabilizer states are precisely the six eigenstates of $X,Y,Z$. A state pointing between those axes is already outside that family.

7. The $T$ Gate Crosses the Boundary

To reach beyond those Pauli permutations, try a phase rotation halfway between $I$ and $S$:

$$ T=\begin{pmatrix}1&0\\0&e^{i\pi/4}\end{pmatrix},\qquad T^2=S. $$

Its conjugation gives

$$ TXT^\dagger=\frac{X+Y}{\sqrt2}. $$

The right side is not a Pauli, even up to phase. Therefore $T$ is not Clifford. This calculation shows exactly which group-preservation rule it breaks.

Breaking that rule is only the first step. The further, nontrivial universality theorem is that finite sequences of $H$ and $T$ approximate every one-qubit unitary arbitrarily well, up to global phase. Products generate rotations through irrational multiples of $\pi$; powers provide arbitrarily fine angles, and conjugation supplies different axes. Adding the entangling gate CNOT gives universality on multiple qubits.

Here universal means arbitrarily accurate approximation: for any target $U$ and tolerance $\varepsilon>0$, some circuit $W$ and phase $\chi$ satisfy $\|W-e^{i\chi}U\|<\varepsilon$. The operator norm measures the largest output-vector error over normalized inputs. A finite gate alphabet does not exactly express every unitary.

Also, $T$ alone is insufficient: $T^8=I$, so its powers form a finite cyclic group. The useful resource is the enlarged group generated by the available gates together.

Within the stabilizer model, we need a resource beyond Clifford operations. $T$ is one sufficient choice; it is not the unique gate every quantum computer must use.

8. A Magic State Implements the Missing Gate

We have found a gate that takes us beyond the Clifford group. The remaining trick is to supply its action using the operations we already know how to track. Suppose direct $T$ gates are unavailable during computation, but we can supply

$$ |A\rangle=T|+\rangle =\frac{|0\rangle+\omega|1\rangle}{\sqrt2}, \qquad \omega=e^{i\pi/4},\quad |+\rangle=\frac{|0\rangle+|1\rangle}{\sqrt2}. $$

This is a magic state: a supplied state that lets stabilizer operations implement a non-Clifford operation. Its Pauli expectations are $(\langle X\rangle,\langle Y\rangle,\langle Z\rangle)=(1/\sqrt2,1/\sqrt2,0)$, so it is not one of the six pure stabilizer states.

Clifford gates acquire a magic state, pictured as Thanos taking the Mind Stone, and gain universal quantum computation.

The extra power comes from the supplied state. Clifford operations consume it to implement $T$; a supply of these states makes universal computation possible. Open this meme in the collection.

The meme gives us the punchline. Let us check the mechanism rather than take the stone's word for it.

Take arbitrary data $|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$. Apply CNOT with the data as control and magic-state ancilla as target. Keeping the data first in the tensor product,

$$ |\psi\rangle|A\rangle\longmapsto \frac{T|\psi\rangle|0\rangle+ \omega T^\dagger|\psi\rangle|1\rangle}{\sqrt2}. $$

To check this, collect the ancilla-$0$ terms: $\alpha|0\rangle+\omega\beta|1\rangle=T|\psi\rangle$. The ancilla-$1$ terms are $\omega\alpha|0\rangle+\beta|1\rangle=\omega T^\dagger|\psi\rangle$.

Measure the ancilla in the computational basis. Each outcome has probability $1/2$:

  • Outcome $0$: the data is $T|\psi\rangle$. No correction is needed.
  • Outcome $1$: the data is $\omega T^\dagger|\psi\rangle$. Apply the Clifford gate $S$; since $ST^\dagger=T$, the result is $\omega T|\psi\rangle$.

Both branches implement $T$, up to an irrelevant global phase. One fresh magic state is consumed. The remaining ingredients are CNOT, measurement, and a classically selected Clifford correction.

There is no contradiction with the Clifford restriction: the extra resource entered through the ancilla. A supply of these states therefore gives Clifford circuits access to the universal Clifford+$T$ gate set. In fault-tolerant implementations, suitable noisy resource states can be prepared separately and purified through magic-state distillation; the ideal injection calculation above assumes a perfect supplied state and ideal operations.

Return to the three troublemakers in the cover. Their four-sign signatures came from commutation in the Pauli group. Kernels organized those signatures; quotients explained how physically different operators could have the same logical action; and normalizers told us which gates preserve this useful structure. Finally, the magic-state calculation showed how to compute beyond it. The group theory has been doing practical work at every step, from identifying an error to supplying a universal gate set.

Further reading

For the five-qubit stabilizers and logical operators used above, see Table 3.2 of Daniel Gottesman's Stabilizer Codes and Quantum Error Correction.

For the algebra, Thomas W. Judson's Abstract Algebra: Theory and Applications develops groups, quotients, homomorphisms, and coding theory. For a circuit-level treatment of the final calculation, see IBM Quantum Learning's magic-state injection lesson.