Curriculum / Quantum Gates Deep Dive / Phase Gates: S, T, and Rz
Phase Gates: S, T, and Rz
Rotate qubits around the Z axis. Understand global vs relative phase.
Phase Gates: S, T, and Rz
Phase gates rotate a qubit around the Z axis of the Bloch sphere. They don't change measurement probabilities alone, but they matter enormously in circuits.
Global vs Relative Phase
Multiply an entire quantum state by and nothing observable changes: every probability is the squared magnitude of an amplitude, so the factor cancels everywhere. That overall factor is a global phase, and on its own it is physically meaningless.
A relative phase between the |0⟩ and |1⟩ components is completely different. The states (|0⟩ + |1⟩)/√2 and (|0⟩ + |1⟩)/√2 are genuinely different points on the equator of the Bloch sphere: θ is the azimuthal angle. Phase gates change exactly this angle and nothing else. They leave the |0⟩/|1⟩ balance untouched and spin the state around the Z axis.
Why Phase Matters
Consider two states:
- •|+⟩ = (|0⟩ + |1⟩)/√2
- •|−⟩ = (|0⟩ − |1⟩)/√2
Both measure 50% |0⟩ and 50% |1⟩. But they're different quantum states. Applying H to |+⟩ gives |0⟩, while applying H to |−⟩ gives |1⟩. Phase is invisible until you interfere.
You can watch both halves of that statement in the simulator:
# Phase is invisible in the Z basis...
qc = QuantumCircuit(1, 1)
qc.h(0) # |+>
qc.s(0) # now (|0> + i|1>)/sqrt(2)
qc.measure(0, 0)
print_counts(simulate(qc, shots=1000)) # still ~50/50
# ...but interference reveals it
qc2 = QuantumCircuit(1, 1)
qc2.h(0) # |+>
qc2.s(0)
qc2.s(0) # S twice = Z, so the state is now |->
qc2.h(0) # H|-> = |1>
qc2.measure(0, 0)
print_counts(simulate(qc2, shots=1000)) # 100% |1>Phase does not appear in measurement results from a single qubit, but it does determine how two quantum paths interfere. Every quantum algorithm that achieves a speedup does so by arranging phases so that wrong-answer paths cancel and right-answer paths reinforce.
The S Gate (π/2 phase)
S|0⟩ = |0⟩ S|1⟩ = i|1⟩
The S gate rotates 90° around the Z axis. It takes |+⟩ → |i⟩ = (|0⟩ + i|1⟩)/√2 (pointing in the +Y direction on the Bloch sphere).
qc.s(0)
S² = Z: applying S twice is equivalent to a Z gate.
Need the opposite rotation? qc.sdg(0) applies S† (S dagger), a -90° rotation that exactly undoes S.
This is the opening of the lesson. The full walkthrough, the interactive circuit, and the graded challenge continue inside myqubit.
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 Gates Deep Dive
Master single-qubit and multi-qubit gates. Understand rotations, phases, and the math behind every gate in Qiskit.
This lesson is part of Pro
Unlock Quantum Gates Deep Dive and all 10 tracks with Pro: $12.99/month, $79/year, or $97 lifetime. Start with the free track first if you are new.