
# Inner Products & Norms

> The inner product is how quantum mechanics measures *overlap* between states — and overlap is
> probability. The Born rule, orthogonality of distinguishable outcomes, normalization of states,
> and the geometry of the Bloch sphere all reduce to the single structure we build here. Get the
> **conjugate-linear** convention right and everything downstream is clean.

## Learning Objectives

After this lesson you will be able to:

1. State the axioms of a complex inner product and compute $\langle u, v\rangle$ on $\mathbb{C}^n$.
2. Prove and apply the **Cauchy–Schwarz** and **triangle** inequalities.
3. Test vectors for **orthogonality** and **normalize** them.
4. Run **Gram–Schmidt** to produce an orthonormal basis.
5. Expand a vector in an orthonormal basis via projection, and state **Parseval's identity**.

---

## Intuition

In $\mathbb{R}^n$ the dot product $u \cdot v = \sum_k u_k v_k$ measures how much two vectors "agree":
it's largest when they point the same way, zero when perpendicular. It also defines length:
$\|u\| = \sqrt{u\cdot u}$.

Over $\mathbb{C}$ we need a twist. If we naïvely used $\sum_k u_k v_k$, the "length squared" of
$v = (i, 0)^T$ would be $i^2 + 0 = -1 < 0$ — nonsense for a length. The fix is to **conjugate one
factor**: $\langle v, v\rangle = \sum_k v_k^* v_k = \sum_k |v_k|^2 \ge 0$. That single conjugation is
the whole story of complex inner products, and it's exactly what makes $|\langle i\text{-state}\rangle|^2$
a valid probability later.

---

## Theory

### Definition: complex inner product

An **inner product** on a complex vector space $V$ is a map $\langle\cdot,\cdot\rangle : V\times V \to
\mathbb{C}$ satisfying, for all $u,v,w \in V$ and $a \in \mathbb{C}$:

$$
\begin{aligned}
&\textbf{(I1) conjugate symmetry:} && \langle u, v\rangle = \overline{\langle v, u\rangle} \\
&\textbf{(I2) linearity in the 2nd argument:} && \langle u,\, a v + w\rangle = a\langle u,v\rangle + \langle u,w\rangle \\
&\textbf{(I3) positive-definiteness:} && \langle v, v\rangle \ge 0,\quad \langle v,v\rangle = 0 \iff v = 0
\end{aligned}
$$

> **Convention (physics / this program).** We make the inner product **linear in the second
> argument** and **conjugate-linear in the first**: $\langle a u, v\rangle = \overline{a}\langle u,v\rangle$,
> which follows from (I1)+(I2). This matches Dirac notation $\langle\phi|\psi\rangle$ (next lesson) and
> [NC]. Many *mathematics* texts (e.g. [Axl]) put linearity in the first argument instead — be alert
> when reading across sources. See [Appendix C](../../appendix/C-notation-glossary.md).

A vector space with an inner product is an **inner product space**. (Finite-dimensional inner product
spaces over $\mathbb{C}$ are automatically complete, hence are **Hilbert spaces** — the term you'll
hear constantly. Completeness only bites in infinite dimensions, which we avoid.)

### The standard inner product on $\mathbb{C}^n$

$$
\langle u, v\rangle := \sum_{k=1}^{n} \overline{u_k}\, v_k = u^\dagger v,
$$

where $u^\dagger = \overline{u}^{\,T}$ is the **conjugate transpose** (a row vector). Check the axioms:
(I1) $\overline{\langle v,u\rangle} = \overline{\sum \overline{v_k} u_k} = \sum v_k \overline{u_k} =
\langle u,v\rangle$; (I2) is linearity of the sum in $v$; (I3) $\langle v,v\rangle = \sum |v_k|^2 \ge 0$
with equality iff every $v_k = 0$.

> ⚠️ **NumPy:** `np.vdot(u, v)` conjugates its **first** argument, matching our convention exactly.
> `np.dot` does **not** conjugate — wrong for complex vectors.

### Norm

The inner product induces a **norm** (length):

$$
\|v\| := \sqrt{\langle v, v\rangle} = \sqrt{\textstyle\sum_k |v_k|^2}.
$$

A vector with $\|v\| = 1$ is a **unit vector**; **normalizing** means $v \mapsto v / \|v\|$.
**Physical quantum states are unit vectors** — this is the normalization condition
$\langle\psi|\psi\rangle = 1$ you'll impose in [Term 1](../../term-1-quantum-mechanics/c01-postulates/01-state-postulate.md).

### Cauchy–Schwarz inequality

For all $u, v$ in an inner product space,

$$
\boxed{\,|\langle u, v\rangle| \le \|u\|\,\|v\|\,}
$$

with equality iff $u$ and $v$ are linearly dependent.

**Proof.** If $v = 0$ both sides are $0$. Otherwise, for any $\lambda \in \mathbb{C}$,
$0 \le \|u - \lambda v\|^2 = \langle u-\lambda v,\, u-\lambda v\rangle$. Expand using the axioms:

$$
0 \le \langle u,u\rangle - \overline{\lambda}\langle v,u\rangle - \lambda\langle u,v\rangle + |\lambda|^2\langle v,v\rangle.
$$

Choose $\lambda = \dfrac{\langle v, u\rangle}{\langle v, v\rangle}$ (the projection coefficient). Using
$\langle v,u\rangle = \overline{\langle u,v\rangle}$, the cross terms combine and simplify to

$$
0 \le \|u\|^2 - \frac{|\langle u,v\rangle|^2}{\|v\|^2}
\;\;\Longrightarrow\;\; |\langle u,v\rangle|^2 \le \|u\|^2\|v\|^2 .
$$

Taking square roots gives the result. Equality holds iff $u - \lambda v = 0$, i.e. $u,v$ are
dependent. ∎

Cauchy–Schwarz is *the* workhorse inequality of quantum information — it bounds state overlaps,
underlies the uncertainty principle (Term 1.3), and guarantees fidelities lie in $[0,1]$.

### Triangle inequality

$\|u + v\| \le \|u\| + \|v\|$. **Proof:** $\|u+v\|^2 = \|u\|^2 + 2\,\mathrm{Re}\langle u,v\rangle + \|v\|^2
\le \|u\|^2 + 2|\langle u,v\rangle| + \|v\|^2 \le \|u\|^2 + 2\|u\|\|v\| + \|v\|^2 = (\|u\|+\|v\|)^2$,
using $\mathrm{Re}(z)\le|z|$ then Cauchy–Schwarz. ∎

### Orthogonality and orthonormal bases

- $u \perp v$ (**orthogonal**) means $\langle u, v\rangle = 0$. Physically, orthogonal states are
  **perfectly distinguishable** by a measurement.
- A set $\{e_1,\dots,e_n\}$ is **orthonormal** if $\langle e_i, e_j\rangle = \delta_{ij}$ (orthogonal
  and each of unit norm).
- Orthonormal sets are automatically independent, so an orthonormal spanning set is an **orthonormal
  basis (ONB)**.

**Expansion in an ONB.** If $\{e_k\}$ is an ONB, then for any $v$,

$$
v = \sum_k \langle e_k, v\rangle\, e_k .
$$

The coordinate is just the projection $\langle e_k, v\rangle$ — *no linear system to solve.* This is
why orthonormal bases are so convenient, and why the computational basis $\{|0\rangle,\dots\}$ is
chosen orthonormal. The squared coordinates obey **Parseval's identity**:

$$
\|v\|^2 = \sum_k |\langle e_k, v\rangle|^2 .
$$

For a normalized state and a measurement basis $\{e_k\}$, the terms $|\langle e_k, v\rangle|^2$ are
exactly the **Born-rule probabilities** and Parseval says they sum to $1$.

### Gram–Schmidt orthonormalization

Any basis can be turned into an orthonormal one. Given independent $\{v_1,\dots,v_n\}$, define

$$
u_k = v_k - \sum_{j<k} \langle e_j, v_k\rangle\, e_j, \qquad e_k = \frac{u_k}{\|u_k\|}.
$$

Each step subtracts off the components already accounted for, leaving a vector orthogonal to the
previous $e_j$, then normalizes. The result $\{e_1,\dots,e_n\}$ is an ONB with the same span.

---

## Worked Examples

### Example 1 — Inner product, norm, and a probability

Let $|\psi\rangle = \tfrac{1}{\sqrt2}(1,\, i)^T$ and the measurement basis $\{|0\rangle, |1\rangle\}$.

Norm: $\langle\psi,\psi\rangle = \tfrac12(\overline{1}\cdot 1 + \overline{i}\cdot i) = \tfrac12(1 + (-i)(i)) = \tfrac12(1+1) = 1.$
So $|\psi\rangle$ is already normalized. The overlap with $|1\rangle = (0,1)^T$ is
$\langle 1|\psi\rangle = \overline{0}\cdot\tfrac{1}{\sqrt2} + \overline{1}\cdot\tfrac{i}{\sqrt2} = \tfrac{i}{\sqrt2}$,
so the probability of outcome "1" is $|\langle 1|\psi\rangle|^2 = \big|\tfrac{i}{\sqrt2}\big|^2 = \tfrac12$.
By Parseval the two outcome probabilities are $\tfrac12,\tfrac12$ and sum to $1$. ✓

### Example 2 — Gram–Schmidt in $\mathbb{C}^2$

Orthonormalize $v_1 = (1, 1)^T$, $v_2 = (1, 0)^T$.

$e_1 = v_1/\|v_1\| = \tfrac{1}{\sqrt2}(1,1)^T$. Then

$$
u_2 = v_2 - \langle e_1, v_2\rangle e_1,\qquad
\langle e_1, v_2\rangle = \tfrac{1}{\sqrt2}(\overline{1}\cdot 1 + \overline{1}\cdot 0) = \tfrac{1}{\sqrt2}.
$$

$u_2 = (1,0)^T - \tfrac{1}{\sqrt2}\cdot\tfrac{1}{\sqrt2}(1,1)^T = (1,0)^T - \tfrac12(1,1)^T = (\tfrac12, -\tfrac12)^T.$
Norm $\|u_2\| = \sqrt{\tfrac14+\tfrac14} = \tfrac{1}{\sqrt2}$, so $e_2 = \tfrac{1}{\sqrt2}(1,-1)^T$.
The ONB $\{\tfrac{1}{\sqrt2}(1,1)^T, \tfrac{1}{\sqrt2}(1,-1)^T\}$ is exactly $\{|+\rangle, |-\rangle\}$.
Check: $\langle e_1, e_2\rangle = \tfrac12(1 - 1) = 0$. ✓

---

## Hands-on (Python)

```python
import numpy as np

def inner(u, v):
    """⟨u, v⟩ with our convention: conjugate-linear in u, linear in v."""
    return np.vdot(u, v)            # vdot conjugates its FIRST argument — exactly right

def norm(v):
    return np.sqrt(np.real(inner(v, v)))   # ⟨v,v⟩ is real & ≥ 0; drop tiny imaginary noise

def normalize(v):
    return v / norm(v)

psi = normalize(np.array([1, 1j], dtype=complex))
print(norm(psi))                                   # 1.0
ket1 = np.array([0, 1], dtype=complex)
print(abs(inner(ket1, psi))**2)                    # 0.4999... = Born probability of outcome "1"
```

```python
def gram_schmidt(vectors):
    """Return an orthonormal basis spanning the same space (modified Gram–Schmidt)."""
    basis = []
    for v in vectors:
        w = v.astype(complex).copy()
        for e in basis:
            w = w - inner(e, v) * e               # subtract projections onto earlier vectors
        n = norm(w)
        if n > 1e-12:                              # skip vectors that are (numerically) dependent
            basis.append(w / n)
    return basis

E = gram_schmidt([np.array([1, 1]), np.array([1, 0])])
for e in E:
    print(np.round(e, 3))
# [0.707+0.j 0.707+0.j]   -> |+>
# [ 0.707+0.j -0.707+0.j] -> |->

# Verify orthonormality: the Gram matrix G[i,j] = ⟨e_i, e_j⟩ should be the identity.
G = np.array([[inner(a, b) for b in E] for a in E])
print(np.allclose(G, np.eye(len(E))))              # True
```

```python
# Expansion in an ONB via projection (no linear solve needed):
v = np.array([2, 3j], dtype=complex)
coords = [inner(e, v) for e in E]                  # ⟨e_k, v⟩
recon = sum(c * e for c, e in zip(coords, E))
print(np.allclose(recon, v))                       # True
print(np.isclose(norm(v)**2, sum(abs(c)**2 for c in coords)))  # Parseval: True
```

---

## Exercises

**E1 (easy).** Compute $\langle u, v\rangle$, $\|u\|$, and $\|v\|$ for $u = (1, i)^T$, $v = (2, -i)^T$,
and verify Cauchy–Schwarz numerically.

<details><summary>Solution</summary>

$\langle u,v\rangle = \overline{1}\cdot 2 + \overline{i}\cdot(-i) = 2 + (-i)(-i) = 2 + i^2 = 2 - 1 = 1$.
$\|u\| = \sqrt{1+1} = \sqrt2$, $\|v\| = \sqrt{4+1} = \sqrt5$. Then $|\langle u,v\rangle| = 1 \le \sqrt{10}
= \|u\|\|v\|$. ✓
</details>

**E2 (easy).** Show $|+\rangle = \tfrac1{\sqrt2}(1,1)^T$ and $|-\rangle = \tfrac1{\sqrt2}(1,-1)^T$ form an
ONB, and expand $|0\rangle = (1,0)^T$ in it.

<details><summary>Solution</summary>

$\langle +|-\rangle = \tfrac12(1\cdot1 + 1\cdot(-1)) = 0$ and both have norm $1$, so they're an ONB.
Coordinates: $\langle +|0\rangle = \tfrac1{\sqrt2}$, $\langle -|0\rangle = \tfrac1{\sqrt2}$. Hence
$|0\rangle = \tfrac1{\sqrt2}|+\rangle + \tfrac1{\sqrt2}|-\rangle$. (Born check: each outcome probability
is $\tfrac12$, summing to 1.)
</details>

**E3 (medium).** Prove the **parallelogram law** $\|u+v\|^2 + \|u-v\|^2 = 2\|u\|^2 + 2\|v\|^2$ from the
inner-product axioms.

<details><summary>Solution</summary>

Expand both: $\|u\pm v\|^2 = \|u\|^2 \pm 2\,\mathrm{Re}\langle u,v\rangle + \|v\|^2$. Adding the $+$ and
$-$ versions cancels the cross terms, leaving $2\|u\|^2 + 2\|v\|^2$. ∎
</details>

**E4 (medium).** When does equality $|\langle u,v\rangle| = \|u\|\|v\|$ hold? Prove your claim and give
the physical meaning for normalized quantum states.

<details><summary>Solution</summary>

Equality iff $u - \lambda v = 0$ for the $\lambda$ in the Cauchy–Schwarz proof, i.e. $u,v$ are linearly
dependent ($u = \lambda v$). For normalized states $|\langle\psi|\phi\rangle| = 1$ means $|\psi\rangle =
e^{i\theta}|\phi\rangle$ — they are the *same physical state up to global phase* and are
**indistinguishable** by any measurement.
</details>

**E5 (hard).** Let $\{e_k\}$ be an ONB and define the **Gram matrix** of vectors $\{v_i\}$ by
$G_{ij} = \langle v_i, v_j\rangle$. Prove $\{v_i\}$ is linearly independent iff $G$ is invertible.

<details><summary>Solution</summary>

Suppose $\sum_i c_i v_i = 0$ for some coefficients $c=(c_i)$. Take $\langle v_j, \cdot\rangle$ of both
sides: $\sum_i \langle v_j, v_i\rangle c_i = 0$ for all $j$, i.e. $G^\top$... more carefully, with our
convention $\langle v_j, \sum_i c_i v_i\rangle = \sum_i c_i G_{ji} = (Gc)_j = 0$, so $Gc = 0$.
If $G$ is invertible the only solution is $c=0$ ⇒ independence. Conversely if the $v_i$ are dependent,
a nonzero $c$ gives $\sum c_i v_i = 0$, hence $Gc = 0$ with $c \neq 0$, so $G$ is singular. ∎
(This is exactly the `matrix_rank` independence test, recast through the inner product.)
</details>

---

## Checkpoint

1. Why must a complex inner product conjugate one argument? What goes wrong otherwise?
2. State Cauchy–Schwarz and its equality condition; what does equality mean for quantum states?
3. What does it mean physically for two states to be orthogonal?
4. Why is expanding a vector in an *orthonormal* basis easier than in a general basis?
5. State Parseval's identity and connect it to the Born rule summing to $1$.

<details><summary>Answers</summary>

1. Without conjugation $\langle v,v\rangle$ could be negative/complex (e.g. $v=(i,0)$ gives $-1$), so it
   couldn't define a length or a probability. Conjugating gives $\sum|v_k|^2 \ge 0$.
2. $|\langle u,v\rangle| \le \|u\|\|v\|$, equality iff $u,v$ dependent; for normalized states equality
   means equal up to global phase — physically identical, indistinguishable.
3. Orthogonal states are perfectly distinguishable: a measurement can tell them apart with certainty.
4. Coordinates are projections $\langle e_k, v\rangle$ — no linear system to solve — and Parseval gives
   the norm instantly.
5. $\|v\|^2 = \sum_k |\langle e_k,v\rangle|^2$. For a normalized state the right side is the sum of Born
   probabilities, which equals $\|v\|^2 = 1$.

</details>

---

## Further Reading

- **[Axl]** Axler, *Linear Algebra Done Right*, Ch. 6 — inner product spaces, Gram–Schmidt (note: linear
  in the *first* argument there).
- **[NC]** Nielsen & Chuang, §2.1.4 — inner products, Gram–Schmidt, our conjugate convention.
- **[Pre]** Preskill, *Ph219*, Ch. 2 — Hilbert spaces.

---

← Prev: [Complex Vector Spaces](01-complex-vector-spaces.md) · Up: [Term 0](../README.md) · Next: [Dirac Notation](03-dirac-notation.md) →
