Previous pages: why gates must be reversible → how to test unitarity. Now: the actual gates.
Before meeting the gates, one concept: an eigenstate of a gate is a state that the gate doesn't change (except possibly flipping its sign or multiplying by a phase).
$$U|\psi\rangle = \lambda|\psi\rangle$$
\(|\psi\rangle\) is an eigenstate of \(U\), and \(\lambda\) is its eigenvalue (a scalar).
The state stays the same — only its "label" (the eigenvalue) might flip the sign or rotate the phase.
Pick a gate — faded = before, solid = after. Green glow = eigenstate (stayed on its line).
Why care? Each gate has exactly two eigenstates (for a single qubit), and they form a basis. The gate's eigenstates tell you what the gate "sees" as its natural coordinate system. Every state that isn't an eigenstate gets changed by the gate.
For a deeper dive on eigenstates, eigenvalues, and the phase connection (why eigenvalues are always on the unit circle, how different eigenvalues create relative phase, and a worked example), see Eigenstates & Eigenvalues.
The Bloch sphere has three axes: X, Y, Z. The Pauli gates (named after physicist Wolfgang Pauli) are the three simplest possible quantum gates — each one is a 180° rotation around one of those axes. That's it. Three axes, three gates.
Why are they fundamental? Because any single-qubit gate can be built from rotations around these three axes. They're the atomic building blocks. Learn X, Y, Z and you can construct everything else by combining rotations. (Hadamard, S, T — all of them decompose into Pauli rotations.)
Each Pauli gate owns one axis of the Bloch sphere. Its eigenstates are the two poles of that axis.
$$X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$$
$$X|0\rangle = |1\rangle \qquad X|1\rangle = |0\rangle$$
Swaps \(|0\rangle\) and \(|1\rangle\). Classical NOT.
$$X|+\rangle = (+1)|+\rangle$$
$$X|-\rangle = (-1)|-\rangle$$
\(|+\rangle\) and \(|-\rangle\) survive X. Eigenvalues: +1 and −1.
180° rotation around the X-axis.
Poles of X-axis (\(|+\rangle\), \(|-\rangle\)) don't move. Everything else rotates.
Why these eigenstates? Verify: \(X|+\rangle = X \cdot \frac{1}{\sqrt{2}}\binom{1}{1} = \frac{1}{\sqrt{2}}\binom{1}{1} = |+\rangle\). The swap sends each component to the other, but they're equal, so nothing changes. For \(|-\rangle = \frac{1}{\sqrt{2}}\binom{1}{-1}\), the swap gives \(\frac{1}{\sqrt{2}}\binom{-1}{1} = -|-\rangle\) — a global sign flip (eigenvalue −1).
$$X = |0\rangle\langle 1| + |1\rangle\langle 0|$$
Read it as: "send \(|1\rangle\) to \(|0\rangle\), and send \(|0\rangle\) to \(|1\rangle\)." Each term \(|a\rangle\langle b|\) means "if input is \(|b\rangle\), output \(|a\rangle\)."
$$Y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}$$
$$Y|0\rangle = i|1\rangle \qquad Y|1\rangle = -i|0\rangle$$
Swaps AND adds a phase. Like doing X then Z (with a phase factor).
$$Y|{+i}\rangle = (+1)|{+i}\rangle$$
$$Y|{-i}\rangle = (-1)|{-i}\rangle$$
\(|{+i}\rangle = \frac{1}{\sqrt{2}}\binom{1}{i}\) and \(|{-i}\rangle = \frac{1}{\sqrt{2}}\binom{1}{-i}\)
180° rotation around the Y-axis.
Poles of Y-axis (\(|{+i}\rangle\), \(|{-i}\rangle\)) don't move.
Y is the weird Pauli. It's the only one with complex entries in the matrix. But the pattern is the same: it owns the Y-axis, its eigenstates are the Y-axis poles.
$$Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$$
$$Z|0\rangle = |0\rangle \qquad Z|1\rangle = -|1\rangle$$
Leaves \(|0\rangle\) alone, flips the sign of \(|1\rangle\). No bit flip — only phase.
$$Z|0\rangle = (+1)|0\rangle$$
$$Z|1\rangle = (-1)|1\rangle$$
\(|0\rangle\) and \(|1\rangle\) survive Z. These are the basis we measure in!
180° rotation around the Z-axis.
Poles of Z-axis (\(|0\rangle\), \(|1\rangle\)) don't move. Equator states get rotated.
Z is special: its eigenstates \(\{|0\rangle, |1\rangle\}\) are the computational basis — the same basis we measure in. That's why measurement is sometimes called "measuring in the Z-basis."
\(Z|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle) = |-\rangle\) and \(Z|-\rangle = |+\rangle\).
\(Z|{+i}\rangle = |{-i}\rangle\) and \(Z|{-i}\rangle = |{+i}\rangle\).
Z flips equator states to their opposite — because rotating 180° around Z sends every equator point to the other side.
| Gate | Axis | Eigenstates (don't move) | Basis name | Eigenvalues |
|---|---|---|---|---|
| X | X-axis | \(|+\rangle\), \(|-\rangle\) | X-basis | +1, −1 |
| Y | Y-axis | \(|{+i}\rangle\), \(|{-i}\rangle\) | Y-basis | +1, −1 |
| Z | Z-axis | \(|0\rangle\), \(|1\rangle\) | Z-basis (computational) | +1, −1 |
All three have eigenvalues +1 and −1. All three are Hermitian (\(U^\dagger = U\)), so applying them twice returns to the start. All three are 180° rotations — and a 180° rotation done twice is a full 360° = identity.
The problem: you have a gate matrix and want to know what it does. One option: multiply it by each basis vector (row-dots-column, the F4 mechanic). That works, but it's slow and gives you no intuition.
The shortcut: rewrite the matrix as a sum of "if → then" rules. Each rule says: "if the input is this state, output that state." You can read the gate's behavior straight from the formula, no multiplication needed.
This is a single "if → then" rule:
The \(\langle b|\) part tests the input — "are you \(|b\rangle\)?" If yes (braket = 1), output \(|a\rangle\). If no (braket = 0), output nothing.
Apply it to see how: \(\;|a\rangle\langle b| \cdot |b\rangle = |a\rangle \underbrace{\langle b|b\rangle}_{1} = |a\rangle\) ✓
Apply to something else: \(\;|a\rangle\langle b| \cdot |c\rangle = |a\rangle \underbrace{\langle b|c\rangle}_{0} = 0\) — rule doesn't fire.
Think of it like a pattern-matching function:
|a⟩⟨b| is like: function(input) { return input == |b⟩ ? |a⟩ : 0 }
A single rule only handles one input. To handle ALL inputs, you add rules together — one per basis state:
$$X = \underbrace{|1\rangle\langle 0|}_{\text{if }|0\rangle\text{, output }|1\rangle} \;+\; \underbrace{|0\rangle\langle 1|}_{\text{if }|1\rangle\text{, output }|0\rangle}$$
Read left to right: "send \(|0\rangle\) to \(|1\rangle\), and send \(|1\rangle\) to \(|0\rangle\)." That's the bit flip.
Verify on \(|0\rangle\):
\(X|0\rangle = |1\rangle\underbrace{\langle 0|0\rangle}_{1} + |0\rangle\underbrace{\langle 1|0\rangle}_{0} = |1\rangle\) ✓
First rule fires (input matches \(|0\rangle\)), second rule doesn't fire (input isn't \(|1\rangle\)).
If a gate is written as:
$$M = |v_0\rangle\langle w_0| + |v_1\rangle\langle w_1|$$
then it maps: \(|w_0\rangle \to |v_0\rangle\) and \(|w_1\rangle \to |v_1\rangle\).
The right side of each \(|\rangle\langle|\) is the input (what it matches). The left side is the output (what it produces).
This only works cleanly when the inputs \(\{|w_0\rangle, |w_1\rangle\}\) form an orthonormal basis — so each rule fires for exactly one basis state and ignores the other.
$$H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}$$
$$H|0\rangle = |+\rangle \qquad H|1\rangle = |-\rangle$$
$$H|+\rangle = |0\rangle \qquad H|-\rangle = |1\rangle$$
Z-basis ↔ X-basis, in both directions!
$$H = |+\rangle\langle 0| + |-\rangle\langle 1|$$
Maps \(|0\rangle \to |+\rangle\) and \(|1\rangle \to |-\rangle\). Read it directly.
\(H^\dagger = H\) (Hermitian)
\(HH = I\) (self-inverse)
Creates superposition from basis states
H is how you create superposition. Start with \(|0\rangle\) (easy to prepare), apply H, get \(|+\rangle\) (equal superposition). Almost every quantum algorithm starts with "apply H to all qubits" — this puts them into superposition so quantum parallelism can work.
It's also the bridge between the Z-basis (what we measure in) and the X-basis (where interference happens). H lets you switch between "computation space" and "measurement space."
Bloch sphere: H is a 180° rotation around the axis halfway between X and Z (the diagonal in the XZ-plane). This swaps the X-axis poles with the Z-axis poles — which is exactly \(|0\rangle \leftrightarrow |+\rangle\) and \(|1\rangle \leftrightarrow |-\rangle\).
Z flips the phase by 180°. S and T are smaller rotations: 90° and 45°.
$$S = \begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}$$
$$S|0\rangle = |0\rangle \qquad S|1\rangle = i|1\rangle$$
Leaves \(|0\rangle\) alone, rotates \(|1\rangle\)'s phase by 90°.
$$S^2 = Z$$
Two quarter-turns = one half-turn. S is the "square root of Z."
\(S^\dagger \neq S\) (NOT Hermitian)
\(S^\dagger = \begin{pmatrix} 1 & 0 \\ 0 & -i \end{pmatrix}\)
Undo requires a separate gate.
Bloch sphere: 90° rotation around the Z-axis. Sends \(|+\rangle \to |{+i}\rangle \to |-\rangle \to |{-i}\rangle \to |+\rangle\) (quarter-steps around the equator).
$$T = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{pmatrix}$$
$$T|0\rangle = |0\rangle \qquad T|1\rangle = e^{i\pi/4}|1\rangle$$
Rotates \(|1\rangle\)'s phase by 45°. \(e^{i\pi/4} = \frac{1+i}{\sqrt{2}}\).
$$T^2 = S \qquad T^4 = Z \qquad T^8 = I$$
T is the "square root of S" and "fourth root of Z."
\(T^\dagger \neq T\) (NOT Hermitian)
\(T^\dagger = \begin{pmatrix} 1 & 0 \\ 0 & e^{-i\pi/4} \end{pmatrix}\)
Undo requires \(T^\dagger\).
Bloch sphere: 45° rotation around the Z-axis. Finest standard rotation — eight T gates make a full circle.
Z, S, and T are all the same kind of gate — they rotate around the Z-axis. They only differ in the angle:
$$\text{General form: } R_Z(\phi) = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\phi} \end{pmatrix}$$
All leave \(|0\rangle\) alone (top-left is always 1). All rotate \(|1\rangle\)'s phase by different amounts. All have \(|0\rangle\) and \(|1\rangle\) as eigenstates (same as Z).
| Gate | Matrix | Action | Bloch rotation | Hermitian? | Self-inverse? |
|---|---|---|---|---|---|
| X | \(\begin{pmatrix}0&1\\1&0\end{pmatrix}\) | Swap \(|0\rangle \leftrightarrow |1\rangle\) | 180° around X | Yes | Yes |
| Y | \(\begin{pmatrix}0&-i\\i&0\end{pmatrix}\) | Swap + phase | 180° around Y | Yes | Yes |
| Z | \(\begin{pmatrix}1&0\\0&-1\end{pmatrix}\) | Flip sign of \(|1\rangle\) | 180° around Z | Yes | Yes |
| H | \(\frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\1&-1\end{pmatrix}\) | \(|0\rangle \leftrightarrow |+\rangle\), \(|1\rangle \leftrightarrow |-\rangle\) | 180° around X+Z diagonal | Yes | Yes |
| S | \(\begin{pmatrix}1&0\\0&i\end{pmatrix}\) | \(|1\rangle\) gets \(\times i\) | 90° around Z | No | No (\(S^2=Z\)) |
| T | \(\begin{pmatrix}1&0\\0&e^{i\pi/4}\end{pmatrix}\) | \(|1\rangle\) gets \(\times e^{i\pi/4}\) | 45° around Z | No | No (\(T^2=S\)) |