The Pauli Gates

Three tiny 2 \times 2 matrices show up everywhere in quantum computing — in error correction, in measurement, in the definition of almost every other gate. They are named after Wolfgang Pauli, and they are the closest thing a qubit has to a "flip." A classical bit has exactly one non-trivial operation, NOT (turn 0 into 1). A qubit lives on a whole sphere, so it has three independent ways to be turned inside out — one for each axis. Those three flips are the Pauli gates X, Y, and Z.

X = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}, \qquad Y = \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix}, \qquad Z = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}.

Each is a single-qubit gate, so each is unitary. But the Paulis are special twice over: each one is also Hermitian (equal to its own conjugate transpose), and each one squares to the identity, X^2 = Y^2 = Z^2 = I. That last fact means every Pauli is its own inverse — apply it twice and you are exactly back where you started.

X is the bit-flip (quantum NOT)

Watch X act on the two basis states. Matrix times column vector:

X|0\rangle = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \end{bmatrix} = |1\rangle, \qquad X|1\rangle = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix} = |0\rangle.

It swaps |0\rangle and |1\rangle — this is exactly the classical NOT, which is why X is called the bit-flip. Geometrically it is a 180^\circ rotation of the Bloch sphere about the x-axis: it turns the north pole into the south pole.

Z is the phase-flip

Z leaves |0\rangle completely alone but attaches a minus sign to |1\rangle:

Z|0\rangle = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}\begin{bmatrix} 1 \\ 0 \end{bmatrix} = |0\rangle, \qquad Z|1\rangle = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}\begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 0 \\ -1 \end{bmatrix} = -|1\rangle.

Nothing about a measurement in the |0\rangle/|1\rangle basis changes — the probabilities |{\pm}1|^2 = 1 are identical. What changed is the relative phase between the two components, which is why Z is the phase-flip. It is a 180^\circ rotation about the z-axis. And Y does both at once — up to a phase it is a bit-flip and a phase-flip, Y = iXZ, a 180^\circ rotation about the y-axis.

Reading a circuit

In a circuit diagram a qubit is a horizontal wire read left to right, and each gate is a labelled box sitting on it. Here a state |\psi\rangle enters, meets an X box, then a Z box, and comes out as ZX|\psi\rangle — the gate written first (leftmost on the wire) is applied first, so in matrix notation it sits on the right.

Worked example: X and Z acting on the plus state

The most revealing test states are |{+}\rangle = \tfrac{1}{\sqrt2}(|0\rangle + |1\rangle) and |{-}\rangle = \tfrac{1}{\sqrt2}(|0\rangle - |1\rangle). First apply X to |{+}\rangle:

X|{+}\rangle = \tfrac{1}{\sqrt2}\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\begin{bmatrix} 1 \\ 1 \end{bmatrix} = \tfrac{1}{\sqrt2}\begin{bmatrix} 1 \\ 1 \end{bmatrix} = |{+}\rangle.

X swaps the two equal entries and leaves them unchanged, so |{+}\rangle is a fixed point of the bit-flip. Now the same state through Z:

Z|{+}\rangle = \tfrac{1}{\sqrt2}\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}\begin{bmatrix} 1 \\ 1 \end{bmatrix} = \tfrac{1}{\sqrt2}\begin{bmatrix} 1 \\ -1 \end{bmatrix} = |{-}\rangle.

The phase-flip turns |{+}\rangle into |{-}\rangle (and, by the same arithmetic, |{-}\rangle back into |{+}\rangle). So Z is the bit-flip of the {+}/{-} world — the mirror image of how X behaves on |0\rangle/|1\rangle. That symmetry is the whole point of the three axes.

Worked example: every Pauli squares to the identity

Because a Pauli is its own inverse, applying it twice must do nothing. Check X^2 directly by multiplying the matrix by itself:

X^2 = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = I.

The same happens for Y and Z: Z^2 = I because (-1)^2 = 1, and Y^2 = I because the two {\pm}i multiply to -i^2 = 1. You can also see it on the sphere: two half-turns about the same axis make a full turn, which is the identity. It also matches X|0\rangle = |1\rangle followed by X|1\rangle = |0\rangle — round trip, back to start.

Suppose a qubit is |0\rangle and you sneak a Z onto it. Then you measure in the standard basis. Nothing happened — Z|0\rangle = |0\rangle, so you still read 0 with certainty. Do the same to |1\rangle and you read 1: the minus sign in -|1\rangle is a global phase there, invisible to any measurement. But feed Z the plus state and it flips it clean over, |{+}\rangle \to |{-}\rangle — two states that a {+}/{-} measurement tells apart perfectly. Same gate, same qubit: utterly undetectable in one basis and a total flip in another. That is why phase errors are the sneaky ones quantum error correction has to hunt for separately from bit errors.

It is tempting to think of X and Z as "the same kind of flip." They are not: X is a 180^\circ turn about the x-axis and Z a turn about the z-axis — perpendicular motions, and they do not commute (XZ = -ZX). Second trap: the minus in Z|1\rangle = -|1\rangle is not an ignorable global phase. A global phase multiplies the whole state and never matters; but here only the |1\rangle part is negated, so in a superposition like |{+}\rangle it becomes a relative phase — and relative phases are physically real and measurable. Bit-flip versus phase-flip is a genuine difference, never a book-keeping one.