Lesson 4 · 55 min · core
Dirac Bra–Ket Notation & Outer Products
Kets as column vectors, bras as their conjugate transposes (the Riesz map), inner products as bra–ket brackets, outer products as matrices, rank-one projectors, the completeness relation and the resolution of any operator into matrix elements .
Prerequisites: Inner Products, Norms & Gram–Schmidt
Objectives and key results
Translate between kets and column vectors, and between bras and row vectors (conjugate transposes).
Compute outer products and their matrices .
Recognise and verify projectors : , .
Use the completeness relation to insert resolutions of the identity and expand operators as .
- definition · Bra of a ket
- identity · Outer product action
- theorem · Rank-one projector
- identity · Completeness relation
- identity · Operator resolution
Kets, bras and brackets#
Paul Dirac introduced a notation in which the type of every object is visible at a glance. A ket is a vector of the state space, which for us is a column in . A bra is the conjugate-transposed row. Putting a bra next to a ket closes the bracket and produces a number, the inner product ("bra-c-ket"). Putting a ket next to a bra, , leaves the bracket open and produces an operator. With these two rules, long calculations become mechanical: juxtapose symbols, and whenever a meets a collapse them into a complex number.
The label inside the ket is just a name. For a qubit, and are the computational basis vectors; , , , are the vectors met in the previous lessons, and for several qubits names the computational basis vector with index .
Definition
Ket and bra
For the corresponding bra is the row vector . As a function, sends a ket to the number , which is precisely the inner product of the previous lesson written as a row times a column.
Riesz representation: every linear functional is a bra
Let be linear. There is exactly one with for all ; its entries are . Hence bras are exactly the linear functionals (the dual space), and the map is a bijection.
Proof (5 steps)
- Step 1:Expand in the standard basis and use linearity of .
- Step 2:Define entry by entry; conjugating twice returns the original number.
- Step 3:Substitute; this is the definition of the inner product. Existence is proved.
- Step 4:Uniqueness: suppose two vectors represent ; subtract using antilinearity in the first slot.
- Step 5:Choose and use positive-definiteness.
∎
The ket-to-bra map is antilinear:
- Step 1:Scalar multiplication of a ket is entry-wise.
- Step 2:Definition of the bra as conjugate transpose.
- Step 3:Conjugation respects products, .
- Step 4:Combine with additivity of the conjugate transpose: sums go to sums, scalars get conjugated.
Worked example. Let . It is normalised because . Its bra is
The amplitude of is , while is its conjugate. The overlap with is , so measuring in the basis gives with probability .
Outer products#
Definition
Outer product
For kets and the outer product is the linear map defined by . As a matrix it is the column times the row , an matrix of rank one (when ).
Action and matrix of an outer product
, and the matrix entries are .
Proof (4 steps)
- Step 1:Matrix multiplication (column times row times column) is associative.
- Step 2:A row times a column is the matrix , a scalar, which commutes with the vector.
- Step 3:Product of an matrix and a matrix: the inner index runs over a single value.
- Step 4:The column has entries and the bra has entries .
∎
Worked examples. The four outer products of computational basis vectors are the matrix units:
Adding them gives the Pauli operators in Dirac form: (it maps and ), and . For example .
A complex example: with and the rule gives
and applying it to yields the first column , since .
Projectors#
Rank-one projectors
If , the operator satisfies (idempotent), (Hermitian) and . It maps every to its component along .
Proof (5 steps)
- Step 1:Associativity: the middle bra and ket close into a bracket.
- Step 2:.
- Step 3:The adjoint is the conjugate transpose; use the entry formula from the outer-product proposition.
- Step 4:The trace is the sum of the diagonal entries; each is a modulus squared; normalisation.
- Step 5:Outer-product action with .
∎
Worked example. For the rule gives . Squaring, , and . Applied to it returns , whose squared length is the probability of the outcome when is measured in the basis. In general , which is how the Born rule will be written in the measurement postulate.
For the circular state the projector has complex off-diagonal entries: and , so the matrix is Hermitian but not symmetric. Writing in the top-right corner is the classic symptom of forgetting to conjugate the bra.
Completeness and operator resolution#
Completeness relation (resolution of the identity)
For any orthonormal basis of : .
Proof (4 steps)
- Step 1:Expansion in an orthonormal basis (Parseval theorem of the previous lesson).
- Step 2:The scalar may be written on either side; then factor out by linearity of matrix multiplication.
- Step 3:The operator in brackets acts as the identity on every vector.
- Step 4:Two matrices that agree on every vector (in particular on each standard basis vector, which reads off every column) are equal.
∎
Worked example. In the computational basis, . In the basis, and
The completeness relation is the single most useful trick in Dirac notation: you may insert anywhere in an expression. Inserting it between a bra and a ket gives , recovering the component formula for the inner product.
Every operator is a sum of its matrix elements times outer products
- Step 1:Multiplying by the identity on both sides changes nothing.
- Step 2:Insert the completeness relation twice, with independent summation indices.
- Step 3:Distribute the sums (matrix multiplication is bilinear) and regroup by associativity.
- Step 4:is a matrix, i.e. a scalar, so it can be moved to the front.
- Step 5:In the standard basis is column of and picks its -th entry; so the matrix elements are the ordinary entries, and the sum is the matrix written as a combination of matrix units.
Worked example (matrix elements in another basis). Compute the matrix elements of in the basis. Since and , we get , , and . The resolution formula therefore gives
In the basis is diagonal, exactly as is diagonal in the computational basis. This is a first glimpse of the spectral theorem studied in the next module: an operator written as a weighted sum of projectors onto an orthonormal basis.
Worked example (an expectation value, symbolically). Take from the first section and . Sandwiching between the bra and the ket and closing every bracket,
We used , so each term is a modulus squared. No matrix was ever written down: the calculation is pure symbol manipulation, and it would read the same in . This is the practical reason for Dirac notation. Matrices are best for small numeric checks and for code; bra–ket algebra is best for proofs and for reasoning about structure. Throughout the curriculum you should be able to move freely between the two, and the translator widget above exists precisely to train that reflex.
import { c, cconj, cmul, type Complex } from '@/lib/quantum-simulator/complex';
/** Outer product |a><b| as a dense matrix: entry (i, j) = a_i * conj(b_j). */
function outer(a: Complex[], b: Complex[]): Complex[][] {
return a.map((ai) => b.map((bj) => cmul(ai, cconj(bj))));
}
const s = Math.SQRT1_2;
const plusI = [c(s), c(0, s)]; // |+i> = (|0> + i|1>)/sqrt(2)
const P = outer(plusI, plusI);
// P = [[0.5, -0.5i], [0.5i, 0.5]] : Hermitian, idempotent, trace 1
console.log(P.map((row) => row.map((z) => z.re.toFixed(2) + (z.im < 0 ? '-' : '+') + Math.abs(z.im).toFixed(2) + 'i').join(' ')).join('; '));Expected output
0.50+0.00i 0.00-0.50i; 0.00+0.50i 0.50+0.00i
Check your understanding#
Quick check
If , which row vector is ?
Quick check
Evaluate the matrix element for .
Quick check
What is for ?
Quick check
Which matrix is ?
References
- M. A. Nielsen, I. L. Chuang, Quantum Computation and Quantum Information, 10th anniversary ed., Cambridge University Press (2010), §2.1.4 (outer products, completeness relation) and §2.1.2 (matrix representations).
- P. A. M. Dirac, The Principles of Quantum Mechanics, 4th ed., Oxford University Press (1958), Ch. II (bra and ket vectors).
- J. J. Sakurai, J. Napolitano, Modern Quantum Mechanics, 3rd ed., Cambridge University Press (2020), §1.2–1.3 (kets, bras, operators, base kets and matrix representations).
- S. Axler, Linear Algebra Done Right, 4th ed., Springer (2024), §6B (Riesz representation theorem) and Ch. 3 (matrices of linear maps).linear.axler.net
Hands-on labs
Build a rank-one projector
1 step · auto-gradedOpen labWrite the matrix of using .