|q⟩ Bad Qubits

beginner · Programming · From Bits to Qubits

Normalization

A qubit's state is a vector in a two-dimensional complex vector space. We write it as

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

where α\alpha and β\beta are complex numbers called probability amplitudes. The Born rule says that if you measure the qubit, you get outcome 00 with probability α2|\alpha|^2 and outcome 11 with probability β2|\beta|^2.

Because probabilities must add to one, the amplitudes are constrained:

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

This is the normalization condition. Geometrically, it means the state vector lies on the unit sphere in the two-dimensional complex Hilbert space (a three-sphere S3S^3 when viewed as a subset of R4\mathbb{R}^4). The familiar Bloch sphere (S2S^2) is the quotient of that S3S^3 by global phase: two normalized states that differ only by an overall factor eiϕe^{i\phi} are physically identical, and collapsing those equivalence classes maps S3S^3 onto the real two-sphere S2S^2.

Why normalization matters

Every legal qubit state satisfies the normalization condition exactly. Any vector that does not satisfy it cannot represent a physical state, because the predicted probabilities would not sum to one — a logical impossibility. Normalization is therefore the first sanity check to run on any purported qubit state.

Checking norm in code

In practice you compute the norm squared

ψ2=α2+β2\|\psi\|^2 = |\alpha|^2 + |\beta|^2

and check whether it equals 11 within a small numerical tolerance. Floating-point arithmetic introduces rounding errors of order 101610^{-16}, so a tolerance of 10910^{-9} gives a safe margin while still catching states that are genuinely un-normalized.

For example, the equal-superposition state +=120+121|{+}\rangle = \tfrac{1}{\sqrt{2}}|0\rangle + \tfrac{1}{\sqrt{2}}|1\rangle has

α2+β2=12+12=1,|\alpha|^2 + |\beta|^2 = \frac{1}{2} + \frac{1}{2} = 1,

so it is correctly normalized.

Try it

Complete the function below to verify that the given amplitudes describe a normalized qubit state. Return true if the norm squared is within 10910^{-9} of 11, and false otherwise.

Run your code to see the quantum state.

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