where α and β are complex numbers. The relative phase between ∣0⟩ and ∣1⟩ is the argument of the ratio β/α. Although global phase is unobservable, relative phase is physically meaningful — it determines how states interfere and shapes every quantum algorithm.
The RZ gate
RZ(θ) rotates the Bloch sphere about the z-axis by angle θ. Its matrix is
RZ(θ)=(e−iθ/200eiθ/2).
Acting on a general state α∣0⟩+β∣1⟩, the gate advances the phase of ∣1⟩ by θ relative to ∣0⟩:
RZ(θ)(α∣0⟩+β∣1⟩)=e−iθ/2α∣0⟩+eiθ/2β∣1⟩.
The common factor e−iθ/2 is a global phase and can be dropped; what remains is that ∣1⟩ picks up a factor of eiθ relative to ∣0⟩.
A concrete example: RZ(π) on |+⟩
Start with the equal superposition ∣+⟩=21(∣0⟩+∣1⟩) produced by a Hadamard gate. Applying RZ(π) gives
Dropping the global factor e−iπ/2, the result is ∣−⟩=21(∣0⟩−∣1⟩). The magnitudes of both amplitudes are unchanged — measurement probabilities remain 50/50 — but the sign (phase) of the ∣1⟩ component has flipped.
Connection to Z and S gates
The Z gate is a special case: Z=RZ(π) up to global phase. Similarly, S=RZ(π/2) and T=RZ(π/4). The parameterized family RZ(θ) generalizes all of them to arbitrary angles, giving you precise control over the phase between ∣0⟩ and ∣1⟩.
Try it
Prepare the ∣+⟩ state with a Hadamard, then apply RZ(π) to flip the relative phase and reach ∣−⟩. The grader checks the full state vector.
Run your code to see the quantum state.
After running, inspect the amplitudes: both should have magnitude ≈0.707. The simulator displays the raw statevector 21(−i∣0⟩+i∣1⟩), which equals ∣−⟩ up to the global factor e−iπ/2=−i. The relative phase between the two amplitudes is π — that is the relative phase in action.
Sign in on the full site to ask questions and join the discussion.