beginner · Programming · Single-Qubit Gates I: X, Y, Z
Pauli Matrices
The gates X, Y, and Z that you have applied in the last three lessons each correspond to a
2×2 matrix. Together they are called the Pauli matrices, named after the physicist
Wolfgang Pauli. Knowing their explicit form lets you read off how each gate transforms any state
vector by ordinary matrix–vector multiplication.
The three matrices
X=(0110),Y=(0i−i0),Z=(100−1).
A few patterns worth memorising:
All three are Hermitian (M=M†, i.e. M equals its own conjugate transpose) and
unitary (MM†=I). As a consequence, every Pauli gate is its own inverse.
X and Z are real, with only 0s and ±1s. Y is the odd one out — it introduces
the imaginary unit i.
The diagonal of Z reads (+1,−1), recording that ∣0⟩ and ∣1⟩ pick up phases
+1 and −1 respectively under Z.
Reading the action from the matrix
Matrix–vector multiplication connects the matrix entries to the gate's action. For X acting on a
general qubit α∣0⟩+β∣1⟩:
X(αβ)=(0110)(αβ)=(βα),
so X swaps the two amplitudes — exactly the bit-flip you observed in the simulator.
For Z:
Z(αβ)=(100−1)(αβ)=(α−β).
The amplitude of ∣0⟩ is unchanged while the amplitude of ∣1⟩ picks up a minus sign.
For Y:
Y(αβ)=(0i−i0)(αβ)=(−iβiα).
Y both swaps the amplitudes and multiplies each by ±i — a combination of X and Z twisted
by i. In fact one can verify that Y=iXZ.
Determinants as a consistency check
For any 2×2 matrix (acbd), the
determinant is ad−bc. Computing it for each Pauli matrix gives
All three determinants equal −1. This is not a coincidence. The group SU(2) consists of
2×2 unitary matrices with determinant exactly +1; the Pauli matrices have
det=−1, so they lie in U(2) but outside SU(2). On the Bloch sphere each Pauli gate
acts as a 180° rotation about its namesake axis (X about x^, Y about y^,
Z about z^) — a proper rotation — so the det=−1 in the 2×2 matrix sense
does not indicate a reflection on the Bloch sphere.
Try it
Use the determinant formula to compute det(X)+det(Y)+det(Z) and return the result.
Run your code to see the quantum state.
Sign in on the full site to ask questions and join the discussion.