Look at where the nonzero entries of \(I, X, Y, Z\) sit: \(I\) and \(Z\) occupy the main diagonal (with matching and opposite signs), while \(X\) and \(Y\) occupy the off-diagonal positions (with matching real entries and opposite imaginary entries). Can every \(2\times 2\) complex matrix be written as a linear combination of \(I, X, Y,\) and \(Z\)? Take an arbitrary \(2\times 2\) matrix
\[A = \begin{pmatrix}a & b\\ c & d\end{pmatrix}.\]
Because \(\tfrac{1}{2}(I+Z) = \begin{pmatrix}1 & 0\\ 0 & 0\end{pmatrix}\) and \(\tfrac{1}{2}(I-Z) = \begin{pmatrix}0 & 0\\ 0 & 1\end{pmatrix}\), combinations of \(I\) and \(Z\) can produce any diagonal entries \(a\) and \(d\). Similarly, because \(\tfrac{1}{2}(X+iY) = \begin{pmatrix}0 & 1\\ 0 & 0\end{pmatrix}\) and \(\tfrac{1}{2}(X-iY) = \begin{pmatrix}0 & 0\\ 1 & 0\end{pmatrix}\), combinations of \(X\) and \(Y\) can produce any off-diagonal entries \(b\) and \(c\). Combining all four pieces expresses \(A\) uniquely as
\[A = \frac{a+d}{2}I + \frac{b+c}{2}X + \frac{c-b}{2i}Y + \frac{a-d}{2}Z.\]
We can verify each entry directly: the top-left entry is \(\tfrac{a+d}{2} + \tfrac{a-d}{2} = a\), the bottom-right is \(\tfrac{a+d}{2} - \tfrac{a-d}{2} = d\), the top-right is \(\tfrac{b+c}{2} - i\tfrac{c-b}{2i} = b\), and the bottom-left is \(\tfrac{b+c}{2} + i\tfrac{c-b}{2i} = c\). Thus the four matrices \(\{I, X, Y, Z\}\) form a complete basis for single-qubit operators—every linear operator on a single qubit (whether unitary or not) is a weighted sum of these four matrices. For example, our Hadamard gate and phase gate expand as
\[H = \frac{X+Z}{\sqrt{2}},\qquad R_\phi = \frac{1+e^{i\phi}}{2}I + \frac{1-e^{i\phi}}{2}Z.\]
Pause to distinguish two very different ways of combining matrices. Writing \(H = (X+Z)/\sqrt{2}\) expresses \(H\) as a sum of Pauli matrices, whereas a quantum circuit combines gates in sequence by multiplying their matrices. A circuit containing only the gates \(X, Y, Z\) can only form products like \(ZX = iY\), which map \(\ket{0}\) to \(\pm\ket{0}\), \(\pm i\ket{0}\), \(\pm\ket{1}\), or \(\pm i\ket{1}\)—a sequence of Pauli gates starting from \(\ket{0}\) can never create a superposition like \(H\ket{0} = (\ket{0}+\ket{1})/\sqrt{2}\)! Nor is every linear combination of Pauli matrices a valid quantum gate: for instance, \(I+Z = \operatorname{diag}(2,0)\) doubles \(\ket{0}\) and annihilates \(\ket{1}\), which is not unitary.
When does a linear combination of \(I\) and a Pauli matrix give a valid unitary gate? For any real angle \(\theta\), define the continuous rotation operator
\[R_x(\theta) = \cos\frac{\theta}{2}\,I - i\sin\frac{\theta}{2}\,X = \begin{pmatrix}\cos(\theta/2) & -i\sin(\theta/2)\\ -i\sin(\theta/2) & \cos(\theta/2)\end{pmatrix}.\]
Taking its adjoint replaces \(-i\) with \(+i\) (since \(I^\dagger = I\) and \(X^\dagger = X\)), and multiplying \(R_x(\theta)^\dagger R_x(\theta)\) cancels the cross terms \(\pm i\cos(\theta/2)\sin(\theta/2)X\) while using \(X^2 = I\) to leave \(\bigl(\cos^2(\theta/2) + \sin^2(\theta/2)\bigr)I = I\). Thus \(R_x(\theta)\) is unitary for every \(\theta\): acting on \(\ket{0}\), it produces \(\cos(\theta/2)\ket{0} - i\sin(\theta/2)\ket{1}\), rotating the state continuously between \(\ket{0}\) (at \(\theta=0\)) and \(-i\ket{1}\) (at \(\theta=\pi\), where \(R_x(\pi) = -iX\)). Having a continuous family of gates \(R_x(\theta)\) is a much stronger hardware capability than having only the single fixed gate \(X\).
In short, the four Pauli matrices \(\{I, X, Y, Z\}\) provide a universal coordinate system for describing any single-qubit operator on paper; constructing arbitrary unitary evolutions out of a fixed set of hardware gates is a separate engineering and algorithmic question that we will tackle in Chapter 8.
Further reading: IBM Quantum’s guide to the Pauli basis.