Phase gates and rotations
Phase gates (Z, S, T, RZ) turn the direction of the |1⟩ amplitude without changing the readout probabilities on their own — an H before and after converts that hidden turn into a visible, even deterministic, histogram change. Rotation gates take an angle in radians and reshape probabilities directly: RY(θ) on |0⟩ gives cos²(θ/2) zeros, so the probability follows the half-angle, not the angle.
A qubit's state is a pair of amplitudes — signed (in general complex) numbers, one for the outcome 0 and one for the outcome 1 — and the probability of each outcome is the squared magnitude of its amplitude. A phase is a multiplier of size 1 applied to an amplitude: it changes the amplitude's direction (its sign, or more generally its angle) but never its size. To see what direction means for a number, draw a + bi as an arrow on graph paper: a steps across, b steps up. A positive real number points right and a negative one points left, so multiplying by −1 reverses the arrow — a half turn — and multiplying by i rotates it a quarter turn. A phase angle is the angle of that arrow. To see what direction means for a number, draw a + bi as an arrow on graph paper: a steps across, b steps up. A positive real number points right and a negative one points left, so multiplying by −1 reverses the arrow — a half turn — and multiplying by i rotates it a quarter turn. A phase angle is the angle of that arrow.
The phase gates act only on the |1⟩ amplitude. Z multiplies it by −1 (a half turn). S multiplies it by i — the number whose square is −1, which works like a quarter turn. T applies an eighth of a turn. The general P(θ) gate turns the |1⟩ amplitude by any angle θ you choose. All of them leave the |0⟩ amplitude untouched.
Here is the trap. Start from |0⟩ and apply H: the amplitudes become (0.7071, 0.7071), so the probabilities are 0.7071² = 0.5 and 0.5. Now apply Z: the amplitudes become (0.7071, −0.7071). Square them: 0.5 and (−0.7071)² = 0.5. Identical probabilities. A phase, on its own, is invisible in the histogram.
You’ve read the opening of chapter 8 — 8 more sections follow, with worked examples and circuits you can run on the page. A free account unlocks every chapter of every course (paid plans aren’t live yet — early readers get everything free).