|q⟩ Bad Qubits

beginner · Programming · The Qubit State Vector & Dirac Notation

Bras and Inner Products

Dirac notation pairs every ket ∣ψ⟩|\psi\rangle with a bra ⟨ψ∣\langle\psi|. If the ket is a column vector, the bra is its conjugate transpose — a row vector whose entries are the complex conjugates of the ket's entries. Together they give a compact way to write the inner product of two quantum states.

From kets to bras

For a general single-qubit ket ∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle = \alpha|0\rangle + \beta|1\rangle, the column-vector form is

∣ψ⟩=(αβ).|\psi\rangle = \begin{pmatrix} \alpha \\ \beta \end{pmatrix}.

The corresponding bra is

⟨ψ∣=(α∗β∗),\langle\psi| = \begin{pmatrix} \alpha^* & \beta^* \end{pmatrix},

where α∗\alpha^* denotes the complex conjugate of α\alpha. When the amplitudes are real — as they are for the states we will study first — conjugation does nothing and the bra is just the row version of the ket.

The inner product

The inner product ⟨φ∣ψ⟩\langle\varphi|\psi\rangle is defined by multiplying the row vector ⟨φ∣\langle\varphi| by the column vector ∣ψ⟩|\psi\rangle in the usual matrix-multiplication sense:

⟨φ∣ψ⟩=∑iφi∗ ψi.\langle\varphi|\psi\rangle = \sum_i \varphi_i^* \, \psi_i.

Two important properties follow directly from this definition:

A worked example

The state ∣+⟩=12∣0⟩+12∣1⟩|{+}\rangle = \tfrac{1}{\sqrt{2}}|0\rangle + \tfrac{1}{\sqrt{2}}|1\rangle has the column representation

∣+⟩=12(11).|{+}\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix}.

Its bra is therefore ⟨+∣=12(11)\langle{+}| = \tfrac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \end{pmatrix}.

The inner product with ∣0⟩=(10)|0\rangle = \binom{1}{0} is

⟨+∣0⟩=12(11)(10)=12⋅1+12⋅0=12.\langle{+}|0\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \end{pmatrix}\begin{pmatrix} 1 \\ 0 \end{pmatrix} = \frac{1}{\sqrt{2}} \cdot 1 + \frac{1}{\sqrt{2}} \cdot 0 = \frac{1}{\sqrt{2}}.

Squaring the magnitude gives ∣⟨+∣0⟩∣2=12|\langle{+}|0\rangle|^2 = \tfrac{1}{2}, which is exactly the 50 % chance of measuring 0 in the state ∣+⟩|{+}\rangle — confirming that the inner product carries the measurement probability we already know from the Born rule.

Try it

Compute the numerical value of ⟨+∣0⟩\langle{+}|0\rangle and return it.

Run your code to see the quantum state.

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