|q⟩ Bad Qubits

beginner · Programming · From Bits to Qubits

Superposition, Intuitively

A classical bit holds exactly one value — 0 or 1 — at any given moment. A qubit can exist in a superposition: a combination of 0|0\rangle and 1|1\rangle simultaneously, weighted by numbers called amplitudes.

The general single-qubit state

Any qubit state ψ|\psi\rangle can be written as

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

where α\alpha and β\beta are (possibly complex) numbers called probability amplitudes. They must satisfy the normalization condition

α2+β2=1,|\alpha|^2 + |\beta|^2 = 1,

which ensures that the probabilities of all measurement outcomes add up to 1. When you measure the qubit in the computational basis, the Born rule says the probability of seeing 0 is α2|\alpha|^2 and the probability of seeing 1 is β2|\beta|^2.

An equal superposition

The most common example is the equal superposition, often called +|+\rangle:

+=120+121.|+\rangle = \frac{1}{\sqrt{2}}\,|0\rangle + \frac{1}{\sqrt{2}}\,|1\rangle.

Here α=β=120.707\alpha = \beta = \tfrac{1}{\sqrt{2}} \approx 0.707. Because 122=12\left|\tfrac{1}{\sqrt{2}}\right|^2 = \tfrac{1}{2}, measuring +|+\rangle yields 0 half the time and 1 the other half — a perfect 50/50 split.

The two extreme cases recover the classical states: α=1,β=0\alpha = 1, \beta = 0 gives 0|0\rangle (always 0), while α=0,β=1\alpha = 0, \beta = 1 gives 1|1\rangle (always 1). Superposition covers the entire continuous range between those extremes.

Why amplitudes, not just probabilities?

Probabilities are always non-negative, but amplitudes can be negative or even complex. That sign matters: two paths through a circuit can destructively interfere (amplitudes cancel) or constructively interfere (amplitudes add). If we only tracked probabilities we would lose that information entirely. The richer amplitude bookkeeping is what distinguishes quantum computation from classical probabilistic computation.

Try it

Apply the gate that maps 0|0\rangle to the equal superposition +|+\rangle. The grader checks that your state vector matches 120+121\tfrac{1}{\sqrt{2}}|0\rangle + \tfrac{1}{\sqrt{2}}|1\rangle up to global phase.

Run your code to see the quantum state.

Once you run the circuit you should see both amplitudes at 0.707\approx 0.707 and both probabilities at 0.50.5 — the signature of a perfect equal superposition.

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