|q⟩ Bad Qubits

intermediate · Physics · Hilbert Spaces & Dirac Formalism

Dirac Bra-Ket Notation

Paul Dirac introduced a notation so compact and suggestive that it has become the universal language of quantum mechanics. This lesson makes the bra, the ket, and their pairing precise.

Kets are vectors

A ket ∣ψ⟩|\psi\rangle is just a vector in a Hilbert space H\mathcal{H}. The symbol inside the angle bracket is a label — it can be a name (∣ψ⟩|\psi\rangle), a number (∣0⟩|0\rangle, ∣1⟩|1\rangle), or any identifier convenient for the problem. In Cn\mathbb{C}^n a ket is a column vector, for example

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

A general single-qubit state is a complex linear combination ∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle = \alpha|0\rangle + \beta|1\rangle.

Bras are linear functionals

Every ket ∣ψ⟩|\psi\rangle has a partner called a bra, written ⟨ψ∣\langle\psi|. The bra is the conjugate transpose of the ket: where the ket is a column vector, the bra is the row vector of complex conjugates,

∣ψ⟩=(αβ)⟹⟨ψ∣=(α‾β‾).|\psi\rangle = \begin{pmatrix} \alpha \\ \beta \end{pmatrix} \quad\Longrightarrow\quad \langle\psi| = \begin{pmatrix} \overline{\alpha} & \overline{\beta} \end{pmatrix}.

A bra is a machine that eats a ket and outputs a complex number — a linear functional. We will say much more about this dual nature in the next lesson.

The bra-ket is the inner product

Placing a bra next to a ket and merging the two vertical bars gives a bra-ket, which is exactly the inner product:

⟨ϕ∣ψ⟩=⟨ϕ∣ ∣ψ⟩=(row vector)×(column vector).\langle \phi | \psi \rangle = \langle\phi| \, |\psi\rangle = (\text{row vector}) \times (\text{column vector}).

For ∣ϕ⟩=(γδ)|\phi\rangle = \big(\begin{smallmatrix} \gamma \\ \delta \end{smallmatrix}\big) and ∣ψ⟩=(αβ)|\psi\rangle = \big(\begin{smallmatrix} \alpha \\ \beta \end{smallmatrix}\big) this is

⟨ϕ∣ψ⟩=γ‾ α+δ‾ β.\langle \phi | \psi \rangle = \overline{\gamma}\,\alpha + \overline{\delta}\,\beta.

The notation makes the inner-product axioms visually obvious. Conjugate symmetry, ⟨ϕ∣ψ⟩=⟨ψ∣ϕ⟩‾\langle \phi | \psi \rangle = \overline{\langle \psi | \phi \rangle}, is the statement that swapping row and column and conjugating recovers the same number's conjugate.

Orthonormality in bra-ket form

The computational basis is orthonormal:

⟨0∣0⟩=1,⟨1∣1⟩=1,⟨0∣1⟩=⟨1∣0⟩=0,\langle 0 | 0 \rangle = 1, \quad \langle 1 | 1 \rangle = 1, \quad \langle 0 | 1 \rangle = \langle 1 | 0 \rangle = 0,

compactly ⟨i∣j⟩=δij\langle i | j \rangle = \delta_{ij} with the Kronecker delta. Using this, the amplitude of ∣0⟩|0\rangle in ∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle = \alpha|0\rangle + \beta|1\rangle is extracted by a single bra-ket:

⟨0∣ψ⟩=α⟨0∣0⟩+β⟨0∣1⟩=α.\langle 0 | \psi \rangle = \alpha \langle 0|0\rangle + \beta \langle 0|1\rangle = \alpha.

The equal superposition ∣+⟩|+\rangle

A state you will meet constantly is

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

It has equal amplitude 1/21/\sqrt{2} on both basis kets, so ∣⟨0∣+⟩∣2=∣⟨1∣+⟩∣2=1/2|\langle 0|+\rangle|^2 = |\langle 1|+\rangle|^2 = 1/2: measuring it yields 0 or 1 with equal probability. The Hadamard gate produces it from ∣0⟩|0\rangle, H∣0⟩=∣+⟩H|0\rangle = |+\rangle, which is what you will build below.

Try it

Prepare the ket ∣+⟩=12(∣0⟩+∣1⟩)|+\rangle = \tfrac{1}{\sqrt{2}}(|0\rangle + |1\rangle) on one qubit and return the circuit. The grader checks the full statevector, so both amplitudes must equal 1/21/\sqrt{2}.

Run your code to see the quantum state.

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