Part I · Chapter 2

Inner & Outer Product

Read ~18 min Prerequisites Ch. 1 Tools projection plane, live matrix, code cell Live

Take two vectors and combine them, and there are two completely different answers depending on which way you multiply them. One gives back a single number. The other gives back a whole matrix. Both show up constantly in quantum mechanics, under the names bra-ket notation gives them: the inner product and the outer product.

The inner product

Bra-ket notation splits a vector into two roles. The ket |ψ⟩ is the column vector you already know from Ch. 1. The bra ⟨ψ| is its conjugate transpose — flip it into a row, and replace every entry with its complex conjugate. The inner product ⟨ψ|φ⟩ multiplies a bra by a ket and produces a single number:

⟨ψ|φ⟩ = ψ₁*φ₁ + ψ₂*φ₂ + …

(the * marks complex conjugate). For real-valued vectors this is exactly the dot product you may already know, with a direct geometric meaning: a·b = |a||b|cos θ, where θ is the angle between them.

Fig. 2.1 — drag either vectora·b and its projection
The green segment is b projected onto a's direction — its signed length is exactly a·b / |a|. Drag b past 90° from a and watch the projection (and a·b) flip negative.

Why complex conjugate?

If you take the inner product of a vector with itself, ⟨ψ|ψ⟩, you get its squared length — and a length has to be a real, non-negative number. Without the conjugate, a complex vector's "length" could come out complex or negative, which is meaningless. The conjugate fixes this: ψᵢ*ψᵢ = |ψᵢ|² is always real and non-negative for every entry, every time.

Norms and orthogonality

The norm (length) of a vector is ‖ψ‖ = √⟨ψ|ψ⟩. A normalized vector has ‖ψ‖ = 1, meaning ⟨ψ|ψ⟩ = 1 — which is exactly the |α|² + |β|² = 1 constraint from Ch. 3, just written in bra-ket notation instead of spelled out.

Two vectors are orthogonal when ⟨ψ|φ⟩ = 0 — geometrically, perpendicular; cos θ = 0. |0⟩ and |1⟩ are orthogonal (⟨0|1⟩ = 0) and each already has norm 1, which makes them orthonormal — the technical term for "a basis where every vector has length 1 and every pair is perpendicular." It's the cleanest possible basis to work with, which is exactly why |0⟩/|1⟩ get used constantly.

The outer product

Multiply the same two vectors the other way around — ket times bra instead of bra times ket — and you get a matrix instead of a number:

$$|\psi\rangle\langle\phi| = \begin{bmatrix}\psi_1\\\psi_2\end{bmatrix}\begin{bmatrix}\phi_1^*&\phi_2^*\end{bmatrix}=\begin{bmatrix}\psi_1\phi_1^*&\psi_1\phi_2^*\\\psi_2\phi_1^*&\psi_2\phi_2^*\end{bmatrix}$$

Every entry of the resulting matrix is just one entry from ψ times one (conjugated) entry from φ — no sum involved at all, unlike the inner product. Drag the same vectors in Fig. 2.1 above and watch this matrix update in real time (shown here for real-valued entries, so no conjugation is visible — Fig. 1.2 from Ch. 1 already showed you what a matrix like this actually does to a vector):

Fig. 2.2 — same a, b as Fig. 2.1ab^T
Notice this matrix is built from outer products one rank-1 piece at a time — every entry is a single product, not a sum. That's the structural difference from the inner product: same two vectors, opposite arrangement, completely different kind of answer.

Projectors

The single most important outer product in this entire book is a vector with itself: |ψ⟩⟨ψ|. Applied to any vector v, it gives back ⟨ψ|v⟩·ψ — the part of v that points along ψ, scaled by how much of v actually lies in that direction. This is called a projector, and it's not just a mathematical curiosity: a projective measurement (Ch. 7) is defined as applying exactly this kind of operator. When you "measure in the |0⟩/|1⟩ basis," you're applying the projectors |0⟩⟨0| and |1⟩⟨1|, and the probability of each outcome is literally how much of your state's "length" that projector keeps.

Fig. 2.3 — code, runs in your browser
np.vdot conjugates its first argument for you — exactly the bra's job. np.dot does not conjugate, which is the right choice for real vectors but the wrong one for complex quantum states.
Check your understanding

What is ⟨a|b⟩ for a = (2, 0) and b = (1, 1)?

2 — for real vectors, ⟨a|b⟩ is just the dot product: 2·1 + 0·1 = 2.

Check your understanding

Why does the inner product need a complex conjugate, when an ordinary dot product doesn't?

So that ⟨ψ|ψ⟩ — a vector's squared length — always comes out real and non-negative, even when the vector's entries are complex numbers. Without conjugating, ψᵢ·ψᵢ could be a negative or complex number, which can't be a length.

Check your understanding

What does it mean for two vectors to be "orthonormal," and why are |0⟩ and |1⟩ a good example?

Orthonormal means every vector has norm 1 and every pair is orthogonal (inner product 0). |0⟩ and |1⟩ each have ⟨ψ|ψ⟩ = 1, and ⟨0|1⟩ = 0, so they satisfy both conditions — the cleanest possible basis to compute with.

Check your understanding

For ψ = (2, 0) and φ = (0, 3), what is |ψ⟩⟨φ| (the outer product, as a 2×2 matrix)?

[[0, 6], [0, 0]] — entry (i,j) is ψᵢ times φⱼ (conjugated, but these are real so it doesn't matter here): (2)(0)=0, (2)(3)=6, (0)(0)=0, (0)(3)=0.

Check your understanding

What does the projector |0⟩⟨0| do when applied to the state |+⟩ = (|0⟩+|1⟩)/√2?

It keeps only the |0⟩ component: |0⟩⟨0|+⟩ = ⟨0|+⟩·|0⟩ = (1/√2)|0⟩. This is exactly the operation behind measuring |+⟩ in the |0⟩/|1⟩ basis — the squared length of the result, 1/2, is the probability of measuring 0.

Check your understanding

In one sentence: what's the structural difference between how the inner product and the outer product combine two vectors?

The inner product sums products of corresponding entries into a single number; the outer product produces every pairwise product separately, arranged as a matrix, with no summing at all.

Review queue

Scroll back to a chapter's quiz cards to review them once they're due — a full cross-chapter queue view is a planned upgrade.