|q⟩ Bad Qubits

beginner · Programming · Measurement & Probability in Code

Measuring |+⟩

Measurement in the computational basis turns amplitudes into outcome probabilities through the Born rule: the chance of seeing outcome bb is bψ2|\langle b|\psi\rangle|^2.

For the equal superposition

+=12(0+1),|+\rangle = \tfrac{1}{\sqrt{2}}\big(|0\rangle + |1\rangle\big),

both amplitudes have magnitude 12\tfrac{1}{\sqrt{2}}, so

P(0)=122=12,P(1)=12.P(0) = \left|\tfrac{1}{\sqrt{2}}\right|^2 = \tfrac{1}{2}, \qquad P(1) = \tfrac{1}{2}.

A single measurement still yields a definite 0 or 1; the 50/50 split only shows up over many repetitions (shots).

Try it

Prepare +|+\rangle and measure it. The grader checks the probability distribution, which should be even across 0 and 1.

Run your code to see the quantum state.

Open the Probabilities tab to see the two equal bars.

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