Dirac Notation
Dirac Notation
Dirac's bra–ket notation is the language of the entire field. It is not new mathematics — it is a brilliant repackaging of the inner product spaces you just built, designed so that the algebra reads like sentences and the bookkeeping does itself. Every later lesson, every paper, and the Braket SDK's mental model all speak this dialect. Master it now and the rest of the program reads fluently.
Learning Objectives
After this lesson you will be able to:
- Translate fluently between column-vector/matrix notation and bra–ket notation.
- Interpret a bra as a linear functional (the dual of a ket) via the Riesz lemma.
- Compute inner products and outer products .
- Apply the completeness relation (resolution of the identity) to expand states and operators.
- Read and write matrix elements .
Intuition
Write a state vector as a ket . Its conjugate-transpose — the object that "eats a ket and returns a number via the inner product" — is the bra . Put a bra next to a ket and the notation literally forms a bra(c)ket : a number, the overlap. Put them the other way, , and you get an operator (a matrix). The genius is that the symbols snap together exactly the way the math allows, so manipulations become almost mechanical:
Theory
Kets
A ket is just a vector in a Hilbert space (for us ). In coordinates relative to the computational basis,
For a qubit, |0\rangle = \begin{psmallmatrix}1\\0\end{psmallmatrix}, |1\rangle = \begin{psmallmatrix}0\\1\end{psmallmatrix}. The labels inside the ket are mnemonic — , , , are all just names for vectors.
The dual space and bras
The dual space is the set of linear maps (functionals) . The Riesz representation theorem (finite-dimensional case) says every such is "take the inner product with some fixed vector ":
We name this functional the bra . So a bra is "the inner product, waiting for its second argument." In coordinates, if has components , then
The conjugation is the conjugate-linearity from 0.1.2: $\langle a\phi| = \overline{a},\langle\phi||a\psi\rangle = a,|\psi\rangle$.
Inner product as a bracket
The inner product becomes the bracket
All the 0.1.2 facts restated: ; ; orthonormal basis ; a normalized state has .
Outer products are operators
Reverse the order: is (column)(row) = an matrix, hence a linear operator. It acts on a ket by the associativity of the notation:
The most important case is a projector onto a normalized state: satisfies (it projects, idempotently). Example for a qubit:
The completeness relation (resolution of identity)
For any orthonormal basis ,
This single identity is the most-used trick in the subject. Derivation: apply the left side to an arbitrary : , which is exactly the ONB expansion of from 0.1.2 — i.e. itself. Since it returns every unchanged, the operator is . ∎
You "insert a complete set of states" anywhere to switch into a basis:
Matrix elements
The entry of an operator in the basis is the matrix element
Two completeness insertions reconstruct the whole operator from its matrix elements:
So " as a matrix" and "" are the same statement.
Endianness reminder. For multi-qubit kets we use big-endian labels: with qubit 0 leftmost, matching Braket's bit-strings (see Appendix C). E.g. — tensor products are formalized in 0.1.7.
Worked Examples
Example 1 — Brackets, bras, and a projector
Let .
Bra: (note the sign flip from conjugation). Norm: $\langle\psi|\psi\rangle = \tfrac12(\langle0|0\rangle - i\langle0|1\rangle + i\langle1|0\rangle - i\cdot i\langle1|1\rangle) = \tfrac12(1 + 0 + 0 + 1) = 1$. ✓ Projector:
Example 2 — Completeness in action
Compute by inserting the computational-basis completeness :
(Trivial here, but the technique — insert , split into known overlaps — is exactly how QFT and phase-estimation derivations proceed in Term 2.)
Hands-on (Python)
NumPy makes the bra/ket/outer correspondence literal.
import numpy as np
ket0 = np.array([[1], [0]], dtype=complex) # column vector = ket |0>
ket1 = np.array([[0], [1]], dtype=complex) # column vector = ket |1>
def bra(ket):
"""⟨ψ| = |ψ⟩† : conjugate transpose turns a column ket into a row bra."""
return ket.conj().T
# Bracket ⟨0|1⟩ is a 1x1 matrix (a number):
print((bra(ket0) @ ket1).item()) # 0j (orthogonal)
psi = (ket0 + 1j * ket1) / np.sqrt(2)
print((bra(psi) @ psi).item()) # (1+0j) normalized
# Outer product |ψ⟩⟨ψ| is a 2x2 operator (projector):
P = psi @ bra(psi)
print(np.round(P, 3))
# [[0.5+0.j 0. -0.5j]
# [0. +0.5j 0.5+0.j ]]
print(np.allclose(P @ P, P)) # True: projectors are idempotent# Completeness relation: sum_k |k><k| = I
basis = [ket0, ket1]
completeness = sum(k @ bra(k) for k in basis)
print(np.allclose(completeness, np.eye(2))) # True
# Matrix element A_ij = <i|A|j>:
A = np.array([[1, 2], [3, 4]], dtype=complex)
A01 = (bra(ket0) @ A @ ket1).item()
print(A01) # (2+0j) -> the (0,1) entryMany people work with 1-D arrays (
np.array([1,0])) and rely onnp.vdot/np.outerinstead of explicit columns. Both are fine; we use explicit(n,1)columns here so@mirrors the bra–ket algebra one-to-one. Pick one convention per project and stay consistent.
Exercises
E1 (easy). Write the bra corresponding to and compute .
Solution
. Then . (So is not normalized; dividing by would normalize it.)
E2 (easy). Compute the outer product as a matrix and describe what operator it is.
Solution
$|0\rangle\langle1| = \begin{psmallmatrix}1\0\end{psmallmatrix}\begin{psmallmatrix}0 & 1\end{psmallmatrix} = \begin{psmallmatrix}0 & 1\ 0 & 0\end{psmallmatrix}|1\rangle \mapsto |0\rangle$ and — a "lowering"-type operator (it's the qubit -like map, not unitary).
E3 (medium). Using completeness , prove that for any operator , is independent of the orthonormal basis chosen.
Solution
Let and be two ONBs. Insert completeness of the primed basis: . Rearranging the scalars and using again, . So the trace is basis-independent. ∎
E4 (medium). Show .
Solution
For matrices . Here (column) and (row ). So $\big(|\psi\rangle\langle\phi|\big)^\dagger = \langle\phi|^\dagger |\psi\rangle^\dagger = |\phi\rangle\langle\psi||\psi\rangle\langle\psi|$ are Hermitian.)
E5 (hard). Let be an ONB. Prove the "trace trick" $\langle\phi|A|\psi\rangle = \operatorname{Tr}!\big(A,|\psi\rangle\langle\phi|\big)$, and use it to express an expectation value as a trace.
Solution
$\operatorname{Tr}(A|\psi\rangle\langle\phi|) = \sum_k \langle u_k|A|\psi\rangle\langle\phi|u_k\rangle = \langle\phi|\Big(\sum_k |u_k\rangle\langle u_k|\Big)A|\psi\rangle = \langle\phi|A|\psi\rangle$, using completeness and reordering the scalar . Setting : with — the density-matrix expectation formula previewed for Term 1.5. ∎
Checkpoint
- What is a bra, formally, and how does the Riesz theorem justify the notation?
- Why does forming give a number but give an operator?
- State the completeness relation and explain the "insert the identity" technique.
- How do you read off the matrix element in bra–ket notation?
- Show in one line that is a projector when .
Answers
- A bra is the linear functional ; Riesz guarantees every linear functional has this form for a unique , so bras ↔ kets bijectively (via conjugate transpose).
- (row)(column) contracts all indices → scalar; (column)(row) leaves two free indices → matrix.
- for any ONB; you may insert in this form anywhere to expand in that basis without changing the expression.
- .
- since .
Further Reading
- [NC] Nielsen & Chuang, §2.1.3–2.1.6 — the Dirac formalism, outer products, completeness.
- [Sak] Sakurai & Napolitano, §1.2–1.3 — kets, bras, and operators, the physicist's introduction.
- [Pre] Preskill, Ph219, Ch. 2.
← Prev: Inner Products & Norms · Up: Term 0 · Next: Linear Operators & Matrices →