You already know the specific cases:
The general statement: every single-qubit unitary gate can be written as a rotation by some angle \(\vartheta\) around some axis \(\hat{n}\) on the Bloch sphere. No exceptions.
This means you can always visualize what any gate does: find the axis it rotates around, find the angle, and picture the Bloch sphere spinning. The eigenstates are the poles of that axis (they don't move). Everything else rotates around them.
Every single-qubit unitary is (up to global phase):
$$R_{\hat{n}}(\vartheta) = \cos\!\left(\frac{\vartheta}{2}\right) I \;-\; i\sin\!\left(\frac{\vartheta}{2}\right) \bigl[n_x X + n_y Y + n_z Z\bigr]$$where:
The formula has two parts:
1 \(\cos(\vartheta/2) \cdot I\) — the "stay put" part. The identity does nothing, so this term keeps the state where it is, weighted by how much of the rotation is "staying."
2 \(-i\sin(\vartheta/2) \cdot [n_x X + n_y Y + n_z Z]\) — the "move" part. This is a blend of Pauli gates (which each rotate 180° around their own axis), weighted by the axis direction \(\hat{n}\), scaled by how much rotation happens.
This is a quirk of spin-½ systems. A 360° physical rotation corresponds to a 720° rotation of the state vector. So to rotate the Bloch sphere by \(\vartheta\), the matrix needs \(\vartheta/2\). You don't need to derive this — just know: the formula uses half-angles, and 180° on the Bloch sphere means \(\vartheta = \pi\) (not \(2\pi\)).
Z should be a 180° rotation around the z-axis. Let's verify.
1 Set the axis and angle: \(\hat{n} = (0, 0, 1)\) (z-axis), \(\vartheta = \pi\) (180°)
2 Plug in:
$$R_z(\pi) = \cos\!\left(\frac{\pi}{2}\right) I - i\sin\!\left(\frac{\pi}{2}\right)[0 \cdot X + 0 \cdot Y + 1 \cdot Z]$$ $$= 0 \cdot I - i \cdot 1 \cdot Z = -iZ$$\(R_z(\pi) = -iZ\)
That \(-i\) is a global phase — unobservable. So \(R_z(\pi)\) and \(Z\) are the same physical gate.
The Hadamard gate maps \(|0\rangle \leftrightarrow |+\rangle\). On the Bloch sphere, that's swapping the north pole with a point on the equator. What axis and angle does that?
1 Axis: \(\hat{n} = \left(\frac{1}{\sqrt{2}}, 0, \frac{1}{\sqrt{2}}\right)\) — the axis halfway between x and z.
Think: to swap the z-pole and the x-equator point, you need the axis between them.
2 Angle: \(\vartheta = \pi\) (180° rotation)
3 Plug in:
$$R_{\hat{n}}(\pi) = 0 \cdot I - i \cdot 1 \cdot \left[\frac{1}{\sqrt{2}} X + 0 \cdot Y + \frac{1}{\sqrt{2}} Z\right]$$ $$= \frac{-i}{\sqrt{2}}(X + Z)$$\(R_{\hat{n}}(\pi) = \frac{-i}{\sqrt{2}}(X + Z)\)
Since \(H = \frac{1}{\sqrt{2}}(X + Z)\), we get \(R_{\hat{n}}(\pi) = -iH\). Again, \(-i\) is global phase. Same physical gate.
The rotation axis runs from the origin through \((1/\sqrt{2}, 0, 1/\sqrt{2})\) — 45° between the x and z axes. A 180° rotation around this axis swaps:
That's exactly what H does.
S is a 90° z-rotation. Quick check:
\(\hat{n} = (0,0,1)\), \(\vartheta = \pi/2\)
$$R_z\!\left(\frac{\pi}{2}\right) = \cos\!\left(\frac{\pi}{4}\right) I - i\sin\!\left(\frac{\pi}{4}\right) Z = \frac{1}{\sqrt{2}}(I - iZ)$$ $$= \frac{1}{\sqrt{2}}\begin{pmatrix}1-i & 0\\0 & 1+i\end{pmatrix} = \frac{1-i}{\sqrt{2}}\begin{pmatrix}1 & 0\\0 & i\end{pmatrix}$$That's the S gate times a global phase of \(\frac{1-i}{\sqrt{2}} = e^{-i\pi/4}\). Same physical gate. The z-rotation family (Z, S, T) all come from the same formula with different \(\vartheta\).
| Gate | Axis \(\hat{n}\) | Angle \(\vartheta\) | Formula check |
|---|---|---|---|
| X | \((1, 0, 0)\) | \(\pi\) (180°) | \(R_x(\pi) = -iX\) |
| Y | \((0, 1, 0)\) | \(\pi\) (180°) | \(R_y(\pi) = -iY\) |
| Z | \((0, 0, 1)\) | \(\pi\) (180°) | \(R_z(\pi) = -iZ\) |
| H | \(\left(\frac{1}{\sqrt{2}}, 0, \frac{1}{\sqrt{2}}\right)\) | \(\pi\) (180°) | \(R_{\hat{n}}(\pi) = -iH\) |
| S | \((0, 0, 1)\) | \(\frac{\pi}{2}\) (90°) | \(R_z(\pi/2) = e^{-i\pi/4} S\) |
| T | \((0, 0, 1)\) | \(\frac{\pi}{4}\) (45°) | \(R_z(\pi/4) = e^{-i\pi/8} T\) |
X, Y, Z are each 180° around their respective axes. That's why they're involutory (applying twice = 360° = identity, up to global phase). S and T are smaller rotations around z — you need to apply them multiple times to get back: \(S^4 = I\), \(T^8 = I\) (up to global phase).
If you know a gate's axis \(\hat{n}\) and angle \(\vartheta\), you immediately know:
You'll notice every worked example gives the gate "up to global phase" (the \(-i\) factor). This is because the rotation formula \(R_{\hat{n}}(\vartheta)\) and the standard gate definition can differ by a global phase. Physically identical. Mathematically off by a constant.
This is fine. Two matrices that differ by a global phase are the same quantum gate. The exam may ask you to show a gate "up to global phase" — just note the factor and move on.
The textbook uses a different (equivalent) parametrization:
$$U(\theta, \phi, \lambda) = \begin{pmatrix}\cos(\theta/2) & -e^{i\lambda}\sin(\theta/2) \\ e^{i\phi}\sin(\theta/2) & e^{i(\phi+\lambda)}\cos(\theta/2)\end{pmatrix}$$This is the same set of gates, just written differently. The rotation form \(R_{\hat{n}}(\vartheta)\) is more geometric (axis + angle). The \(U(\theta, \phi, \lambda)\) form is more algebraic (three parameters in a matrix). Both describe all single-qubit unitaries.
For the exam: the rotation form is better for understanding and Bloch sphere questions. The U form may appear in exercises. Know both exist, use whichever the question calls for.
Three methods to figure out what two gates in sequence do:
This is the most important identity for Week 2. Using \(H = \frac{1}{\sqrt{2}}(X + Z)\) and the Pauli rules:
$$HXH = \frac{1}{2}(X+Z)X(X+Z) = \frac{1}{2}(X+Z)(XX+XZ)$$ $$= \frac{1}{2}(X+Z)(I + XZ) = \frac{1}{2}(X+Z-Z\cdot Z\cdot X + Z \cdot X \cdot Z)$$Using anticommutation (\(XZ = -ZX\)) and \(ZZ = I\):
$$HXH = Z$$H swaps the x and z axes. So sandwiching X (x-axis rotation) between two H's turns it into Z (z-axis rotation). This "conjugation" pattern — \(UGU^\dagger\) rotates the axis of \(G\) — is fundamental in quantum computing.
| Rule | Formula | Meaning |
|---|---|---|
| Square to I | \(X^2 = Y^2 = Z^2 = I\) | Each Pauli is its own inverse |
| Cyclic | \(XY = iZ,\; YZ = iX,\; ZX = iY\) | Like cross products of unit vectors |
| Anticommute | \(XY = -YX,\; XZ = -ZX,\; YZ = -ZY\) | Swapping order flips sign |
| H identity | \(H = \frac{1}{\sqrt{2}}(X + Z)\) | H is the "average" of X and Z |
Concept 2.5 in progress.md. Also covers gate composition identities (2.7 extension).