|q⟩ Bad Qubits

beginner · Programming · The Qubit State Vector & Dirac Notation

Kets: |ψ⟩ Notation

Every quantum state is written using a compact notation invented by Paul Dirac. The symbol ψ|\psi\rangle is called a ket — it is simply a label for a state vector. For a single qubit, the two standard building blocks are 0|0\rangle and 1|1\rangle, called the computational basis states.

Kets as column vectors

Behind the label is an ordinary column vector. The correspondence is

0=(10),1=(01).|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}, \qquad |1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}.

Any single-qubit state ψ|\psi\rangle is a superposition — a linear combination with complex coefficients called amplitudes:

ψ=α0+β1=(αβ),|\psi\rangle = \alpha|0\rangle + \beta|1\rangle = \begin{pmatrix} \alpha \\ \beta \end{pmatrix},

where α,βC\alpha, \beta \in \mathbb{C} and the normalization condition α2+β2=1|\alpha|^2 + |\beta|^2 = 1 must hold so that measurement probabilities sum to one.

Reading off probabilities

Once you have a ket, the Born rule turns amplitudes into probabilities. The probability of observing outcome b{0,1}b \in \{0, 1\} when measuring in the computational basis is

P(b)=bψ2=amplitude of b2.P(b) = |\langle b | \psi \rangle|^2 = |\text{amplitude of } |b\rangle|^2.

For example, consider the normalized state

ψ=320+121=(3212).|\psi\rangle = \frac{\sqrt{3}}{2}|0\rangle + \frac{1}{2}|1\rangle = \begin{pmatrix} \tfrac{\sqrt{3}}{2} \\ \tfrac{1}{2} \end{pmatrix}.

Reading off the amplitudes: α=32\alpha = \tfrac{\sqrt{3}}{2} and β=12\beta = \tfrac{1}{2}. The probabilities are

P(0)=322=34,P(1)=122=14.P(0) = \left|\frac{\sqrt{3}}{2}\right|^2 = \frac{3}{4}, \qquad P(1) = \left|\frac{1}{2}\right|^2 = \frac{1}{4}.

These sum to one, confirming the state is normalized: 34+14=1\tfrac{3}{4} + \tfrac{1}{4} = 1.

Try it

Apply the Born rule to the state ψ=320+121|\psi\rangle = \tfrac{\sqrt{3}}{2}|0\rangle + \tfrac{1}{2}|1\rangle and return P(1)P(1), the probability of measuring outcome 11.

Run your code to see the quantum state.

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