1 · Intuition
A qubit prepared in |0⟩ gives outcome 0 every time it is measured. After a Hadamard gate, the qubit is in a superposition: measuring it gives 0 or 1, each with probability ½. The state itself is not random — it is the definite state |+⟩. Randomness appears only at measurement.
2 · Mathematics
By the Born rule the probabilities are the squared magnitudes of the amplitudes:
H is unitary and its own inverse: . Applying it twice returns |0⟩ — something a fair coin flip could never do. That is interference.
Relative phase
Now apply Z, which multiplies the |1⟩ amplitude by −1: . The probabilities are still ½ and ½, yet |+⟩ and |−⟩ are different, perfectly distinguishable states (apply H again: one gives |0⟩, the other |1⟩). The difference is a relative phase, which is physical — unlike a global phase.
3 · Geometry
On the Bloch sphere |0⟩ is the north pole (+Z). H is a rotation by π about the axis (X+Z)/√2, which carries +Z to +X. Z is a rotation by π about the Z axis, carrying +X to −X. Probabilities depend only on the height (z-coordinate), which is why Z leaves them unchanged.
4 · Try it
The preview below runs the real simulator. Apply H, then Z, then H again, and watch each representation.