|q⟩ Bad Qubits

beginner · Programming · Measurement & Probability in Code

The Measurement Postulate

Quantum mechanics comes with a set of postulates — formal rules that tell you how systems evolve and what you observe when you look at them. The measurement postulate is the one that connects the abstract state vector to the concrete numbers that appear on a detector.

What measurement does

A qubit's state can always be written as a superposition of the two computational basis states:

ψ=α0+β1,|\psi\rangle = \alpha|0\rangle + \beta|1\rangle,

where α\alpha and β\beta are complex amplitudes satisfying α2+β2=1|\alpha|^2 + |\beta|^2 = 1.

When you measure this qubit in the computational basis, two things happen simultaneously:

  1. You get a definite classical outcome, either 0 or 1, chosen at random. The probability of each outcome is given by the Born rule:

    P(outcome 0)=α2,P(outcome 1)=β2.P(\text{outcome }0) = |\alpha|^2, \qquad P(\text{outcome }1) = |\beta|^2.

  2. The state collapses. Immediately after the measurement the qubit is no longer in the superposition α0+β1\alpha|0\rangle + \beta|1\rangle. It is now in the basis state that matches the outcome: 0|0\rangle if you saw 0, or 1|1\rangle if you saw 1.

The two effects are inseparable. Measurement is irreversible — the prior amplitudes are gone — and the outcome is genuinely random (not just unknown to you).

Before vs. after

It is worth being precise about the timeline:

This last point is the hallmark of projective measurement: once the collapse has happened, re-measuring gives no new information.

Try it

Measure the qubit while it is in 0|0\rangle (the default starting state). Because α2=1|\alpha|^2 = 1 and β2=0|\beta|^2 = 0, the distribution should be entirely on outcome 0.

Run your code to see the quantum state.

Switch to the Probabilities tab. You should see a single bar at 0 with height 1 and an empty bar at 1 — exactly what the Born rule predicts for a definite state.

Sign in on the full site to ask questions and join the discussion.