Quantum LabQL-002
FOUNDATIONS / VERIFIED IDEAL SIMULATION

When a Phase Becomes Observable

Hadamard gates, relative phase and interference

NumPy mathematicsQiskit StatevectorNo hardware claim
01 / The question

Why can a phase change the final Z-basis measurement probabilities without changing them immediately?

A phase gate changes the relative phase between amplitudes. The final Hadamard recombines them, converting a phase difference into observable probability differences.

02 / Mathematical prediction

State and transformation

Core relation
HP(φ)H|0⟩=(1+eiφ)|0⟩+(1−eiφ)|1⟩2

On narrow screens, scroll the equation horizontally to view every term.

P(0) = cos²(φ/2); P(1) = sin²(φ/2)

Quantum circuit

q₀: |0⟩HP(φ)Hfinal state

Circuit wire labels follow the Qiskit indexing convention; Statevector results are computed with an ideal simulator, not hardware.

03 / Prediction and simulation

Analytic predictions and simulator results

Swipe the results table horizontally to see all columns.

QuantityAnalytic predictionComputed value or classical sample
φ = 90° · final P(0)50%50% · Qiskit
φ = 180° · final P(0)0%≈0% · Qiskit
Before the final HP(0) = P(1) = 50%50% / 50% · NumPy

Values are reported from the previously completed local experiments: exact ideal statevector probabilities (Qiskit), classical NumPy sampling where stated, and the specified NumPy density-matrix calculation. These are not observations from physical quantum hardware. Rounded values are shown for readability.

04 / Reproduce the principle

Minimal Qiskit example

This independently written teaching snippet illustrates the verified circuit principle without disclosing the private lab source. Run it with NumPy and Qiskit installed; this abbreviated public snippet has undergone source and syntax review, but not a separate Qiskit-enabled execution test.

Python · NumPy + QiskitIdeal statevector
import numpy as np
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector

def final_probabilities(degrees):
    circuit = QuantumCircuit(1)
    circuit.h(0)
    circuit.p(np.deg2rad(degrees), 0)
    circuit.h(0)
    return Statevector.from_instruction(circuit).probabilities()

for angle in (0, 90, 180):
    print(angle, np.round(final_probabilities(angle), 6))

assert np.allclose(final_probabilities(180), [0, 1])

This example uses the ideal P(φ) = diag(1, e^{iφ}) gate. The middle phase operation preserves 50:50 Z-basis probabilities after the first H; the final H changes the relevant measurement basis.

Computations are local ideal statevector calculations. Nothing here sends jobs to an IBM Quantum device or cloud backend.

05 / Interpretation and boundaries

What we can conclude

Relative phase leaves the intermediate Z-basis probabilities unchanged, but the final Hadamard mixes the amplitudes so the relative phase changes the output probabilities. The state remains normalized.

What this does not establish

A common global phase has no observable consequence. The relative phase here becomes relevant only after a second Hadamard. The historical finite-shot counts are classical NumPy draws, not quantum-device measurements.