Curriculum / Quantum Foundations / Phase Gates: Z, S, and T

Lesson 6 of 17ReadingFree+75 XP

Phase Gates: Z, S, and T

Explore gates that change the phase of quantum states.

Phase Gates

What is Phase?

In quantum computing, a qubit in superposition has both an amplitude and a phase. Phase doesn't affect measurement probabilities directly, but it's crucial for quantum interference, the mechanism that makes quantum algorithms work.

Complex Numbers in Five Minutes

Phase is written with complex numbers, so here is everything this course needs from them. The imaginary unit i is defined by i² = −1. A complex number a + bi is a point in a plane: a steps sideways, b steps up. Its modulus |a + bi| = √(a² + b²) is the distance from the origin.

The numbers with modulus 1 form a circle, and Euler's formula names every point on it:

Multiplying an amplitude by e^{iθ} rotates it by the angle θ around that circle without changing its modulus. Since measurement probabilities come from the modulus squared, a phase factor moves the amplitude around the circle while leaving the probability untouched. That is exactly what phase gates do. The special values are worth memorizing: e^{iπ} = −1 (a 180° turn) and e^{iπ/2} = i (a 90° turn).

The Z Gate

The Z gate flips the sign of the |1⟩ component:

  • Z|0⟩ = |0⟩
  • Z|1⟩ = -|1⟩
qc.z(0)

The S Gate

The S gate adds a 90° phase rotation to |1⟩:

  • S|1⟩ = i|1⟩
qc.s(0)

Every gate has an inverse that undoes it. The inverse of S is written S† (read "S dagger", code qc.sdg(0)) and rotates the phase back by 90°. You will meet the dagger symbol again: for any gate it means the reverse operation.

The T Gate

The T gate adds a 45° phase rotation:

qc.t(0)

Why Phase Matters

Phase determines how quantum states interfere with each other. In algorithms like Grover's search and Shor's factoring, phase manipulations are used to amplify correct answers and suppress wrong ones.

You can't directly observe phase through measurement, but you can detect its effects by applying H gates before measuring (converting phase differences into measurable amplitude differences).

How this lesson works

A guided reading lesson with interactive knowledge checks. Concepts are explained step by step with circuit diagrams and runnable examples, and you confirm understanding before moving on.

Part of: Quantum Foundations

Learn the basics: qubits, gates, superposition, and measurement.

Take this lesson free

Create a free account and start this lesson in your browser. No credit card, no installation.