Pricing…Open Lab
Chapter 08 of 14 · ~10 min

Phase gates and rotations

Phase gates (Z, S, T and RZ) turn the direction of the |1⟩ amplitude. On their own, they don't change the readout chances. But put an H before and after, and that hidden turn becomes a histogram change you can see — even a certain one. Rotation gates take an angle in radians and change the chances directly. RY(θ) on |0⟩ gives cos²(θ/2) zeros. So the chance follows half the angle, not the angle itself.

Why care? Phase is the hidden dial behind almost every quantum algorithm. This chapter shows you how to turn it, and how to make it show up in a histogram.

A qubit's state is a pair of amplitudes. These are numbers with a sign (and in general they are complex). There is one for the outcome 0 and one for the outcome 1. The chance of each outcome is the squared size of its amplitude.

A phase is a multiplier of size 1 applied to an amplitude. It changes the amplitude's direction, but never its size. What does "direction" mean for a number? Draw a + bi as an arrow on graph paper: a steps across, then b steps up. A positive number points right. A negative number points left. So multiplying by −1 reverses the arrow, which is a half turn. Multiplying by i turns it a quarter turn. A phase angle is the angle of that arrow.

Think of the hands of a clock. A phase moves the hand around the face, but the hand never gets longer or shorter. (Unlike a clock, only the difference between two hands will ever matter, as you'll see.)

The phase gates act only on the |1⟩ amplitude:

  • Z multiplies it by −1. That is a half turn.
  • S multiplies it by i, the number whose square is −1. That is a quarter turn.
  • T turns it an eighth of a turn.
  • The general P(θ) gate turns it by any angle θ you choose.

All of them leave the |0⟩ amplitude alone.

Here is the trap. Start from |0⟩ and apply H. The amplitudes become (0.7071, 0.7071). So the chances 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. The chances are the same. On its own, a phase can't be seen in the histogram.

What the rest of this chapter covers
  1. Can a phase be seen in the histogram?INTERACTIVE
  2. How do you make a phase visible?
  3. The H–Z–H sandwichINTERACTIVE
  4. What does a quarter turn do instead?INTERACTIVE
  5. What do rotation gates do with an angle?
  6. Dialling a 75/25 splitINTERACTIVE
  7. Worked exampleINTERACTIVE
  8. Why is RZ often free on real devices?
Keep learning with Pro

You’ve read the opening of chapter 8. Pro unlocks the other 8 sections — plus every chapter of every course, with circuits you can run right on the page. That’s $11.99 a month, about the price of a coffee, or $99.99 a year (save 30%). The first chapter of every course, and the whole math course, stay free.

Start learning with ProSee plansRead chapter 1 free
Phase gates and rotations · QPU137