4.5 Inner products and orthogonality

The vector-space axioms — addition and scalar multiplication — let you add and stretch arrows but say nothing about length or angle. Pythagoras’ theorem, the cosine rule, the very idea of “perpendicular” — none of these are part of the bare vector-space structure. To recover them, you need one extra piece of equipment: an inner product.

This lesson defines the inner product, develops the geometric notions it makes possible (length, angle, projection, orthogonality), and walks through the Gram–Schmidt procedure that turns any linearly-independent set of vectors into an orthonormal basis. The same machinery, lifted to function spaces, is what makes Fourier expansion and modal projection work — it is the algebraic structure underlying Foundations 6.5.

The dot product

In Rn\mathbb{R}^n the inner product is the familiar dot product:

u⋅v  =  u1v1+u2v2+⋯+unvn  =  ∑k=1nukvk.\mathbf{u} \cdot \mathbf{v} \;=\; u_1 v_1 + u_2 v_2 + \cdots + u_n v_n \;=\; \sum_{k=1}^n u_k v_k.

This is just a single number — the inner product of two vectors is a scalar, not another vector. Three properties pin it down and generalise to other inner-product spaces:

Any operation on a vector space with these three properties is called an inner product, often written ⟨u,v⟩\langle \mathbf{u}, \mathbf{v} \rangle in more abstract settings. The integral ∫0Lf(x)g(x) dx\int_0^L f(x) g(x)\, dx, for instance, satisfies all three properties (with functions f,gf, g as the “vectors”), and so it is an inner product on the space of integrable functions on [0,L][0, L]. That fact is what makes the Fourier-projection formula in Foundations 6.5 work mechanically the same way as the projection of a 2-D vector onto an axis.

Length and angle

The inner product gives you a norm (length):

∥v∥  =  v⋅v.\|\mathbf{v}\| \;=\; \sqrt{\mathbf{v} \cdot \mathbf{v}}.

In R2\mathbb{R}^2 this is just Pythagoras: ∥(x,y)∥=x2+y2\|(x, y)\| = \sqrt{x^2 + y^2}. The norm satisfies the triangle inequality ∥u+v∥≤∥u∥+∥v∥\|\mathbf{u} + \mathbf{v}\| \leq \|\mathbf{u}\| + \|\mathbf{v}\| — a consequence of the Cauchy–Schwarz inequality ∣u⋅v∣≤∥u∥ ∥v∥|\mathbf{u} \cdot \mathbf{v}| \leq \|\mathbf{u}\|\, \|\mathbf{v}\|, which is one of the most-used inequalities in mathematics.

The inner product also encodes the angle between two vectors:

cos⁡θ  =  u⋅v∥u∥ ∥v∥.\cos \theta \;=\; \frac{\mathbf{u} \cdot \mathbf{v}}{\|\mathbf{u}\|\, \|\mathbf{v}\|}.

Two vectors are orthogonal (perpendicular) if their inner product is zero. In Rn\mathbb{R}^n orthogonality is the algebraic condition ∑kukvk=0\sum_k u_k v_k = 0; in function-space settings it becomes ∫f(x)g(x) dx=0\int f(x) g(x)\, dx = 0. The integral version is what makes the Fourier sine series of Foundations 6.3 work:

∫0Lsin⁡(mπx/L) sin⁡(nπx/L) dx  =  L2 δmn,\int_0^L \sin(m \pi x / L)\, \sin(n \pi x / L)\, dx \;=\; \tfrac{L}{2}\, \delta_{mn},

— different-mode sines are orthogonal as elements of the function space L2[0,L]L^2[0, L].

Projection

If u\mathbf{u} is a unit vector (i.e. ∥u∥=1\|\mathbf{u}\| = 1), the projection of any vector v\mathbf{v} onto u\mathbf{u} is

proju(v)  =  (v⋅u) u.\text{proj}_\mathbf{u}(\mathbf{v}) \;=\; (\mathbf{v} \cdot \mathbf{u})\, \mathbf{u}.

The scalar v⋅u\mathbf{v} \cdot \mathbf{u} is the length of the projection — how much of v\mathbf{v} points along u\mathbf{u}. The vector (v⋅u) u(\mathbf{v} \cdot \mathbf{u})\, \mathbf{u} is the projection itself, a vector parallel to u\mathbf{u}.

The residual w=v−proju(v)\mathbf{w} = \mathbf{v} - \text{proj}_\mathbf{u}(\mathbf{v}) is the component of v\mathbf{v} perpendicular to u\mathbf{u}. Two checks: u⋅w=u⋅v−(v⋅u)⋅1=0\mathbf{u} \cdot \mathbf{w} = \mathbf{u} \cdot \mathbf{v} - (\mathbf{v} \cdot \mathbf{u}) \cdot 1 = 0 (so w⊥u\mathbf{w} \perp \mathbf{u} ✓), and v=proju(v)+w\mathbf{v} = \text{proj}_\mathbf{u}(\mathbf{v}) + \mathbf{w} (so the decomposition is exact ✓).

Projection is the bread-and-butter geometric operation of linear algebra. If {e1,…,en}\{\mathbf{e}_1, \ldots, \mathbf{e}_n\} is an orthonormal basis, then any vector decomposes as

v  =  ∑k=1n(v⋅ek) ek.\mathbf{v} \;=\; \sum_{k=1}^n (\mathbf{v} \cdot \mathbf{e}_k)\, \mathbf{e}_k.

That formula is the Fourier expansion of v\mathbf{v} in the basis {ek}\{\mathbf{e}_k\}. When the basis is the modes of a PDE rather than Rn\mathbb{R}^n basis vectors, the same formula extracts modal coefficients from initial data; that is the Fourier-projection step in Foundations 6.5.

▶ Project a vector onto another (acoustic intensity direction) Worked Example

An acoustic intensity vector is v=(3,4,0) W/m2\mathbf{v} = (3, 4, 0)\,\text{W/m}^2. Find its component along the corridor direction u=(1,1,0)/2\mathbf{u} = (1, 1, 0)/\sqrt{2}.

Projection scalar: v⋅u=12(3+4+0)=72≈4.95 W/m2.\mathbf{v}\cdot\mathbf{u} = \frac{1}{\sqrt{2}}(3 + 4 + 0) = \frac{7}{\sqrt{2}} \approx 4.95\,\text{W/m}^2.

Projection vector: proju(v)=72⋅12(1,1,0)=72(1,1,0)=(3.5,3.5,0).\text{proj}_\mathbf{u}(\mathbf{v}) = \frac{7}{\sqrt{2}}\cdot\frac{1}{\sqrt{2}}(1,1,0) = \frac{7}{2}(1,1,0) = (3.5, 3.5, 0).

Residual (perpendicular component): v−proju(v)=(3−3.5,  4−3.5,  0)=(−0.5,0.5,0).\mathbf{v} - \text{proj}_\mathbf{u}(\mathbf{v}) = (3-3.5,\; 4-3.5,\; 0) = (-0.5, 0.5, 0).

Check orthogonality: (−0.5,0.5,0)⋅(1,1,0)=−0.5+0.5=0(-0.5, 0.5, 0)\cdot(1,1,0) = -0.5 + 0.5 = 0.

▶ Verify orthogonality of two sine modes Worked Example

Are f(x)=sin⁡(πx/L)f(x) = \sin(\pi x/L) and g(x)=sin⁡(2πx/L)g(x) = \sin(2\pi x/L) orthogonal on [0,L][0, L]? Compute:

⟨f,g⟩=∫0Lsin⁡(πx/L) sin⁡(2πx/L) dx.\langle f, g\rangle = \int_0^L \sin(\pi x/L)\,\sin(2\pi x/L)\,dx.

Using the product-to-sum identity: sin⁡Asin⁡B=12[cos⁡(A−B)−cos⁡(A+B)]\sin A \sin B = \tfrac12[\cos(A-B) - \cos(A+B)]:

=12∫0L[cos⁡(πx/L)−cos⁡(3πx/L)]dx=L2[sin⁡(πx/L)π/L−sin⁡(3πx/L)3π/L]0L=0.= \frac{1}{2}\int_0^L \left[\cos(\pi x/L) - \cos(3\pi x/L)\right]dx = \frac{L}{2}\left[\frac{\sin(\pi x/L)}{\pi/L} - \frac{\sin(3\pi x/L)}{3\pi/L}\right]_0^L = 0.

Both terms vanish at the endpoints, confirming ⟨f,g⟩=0\langle f, g\rangle = 0. The first two sine modes are orthogonal — as guaranteed by the Sturm-Liouville theory for different eigenvalues.

Gram–Schmidt orthogonalisation

Given a set of linearly-independent vectors {a1,a2,…,ak}\{\mathbf{a}_1, \mathbf{a}_2, \ldots, \mathbf{a}_k\}, we want to produce an orthonormal set {e1,e2,…,ek}\{\mathbf{e}_1, \mathbf{e}_2, \ldots, \mathbf{e}_k\} spanning the same space — orthogonal to each other and each of unit length. The Gram–Schmidt procedure does this iteratively, by subtracting projections.

The recipe for two input vectors a\mathbf{a} and b\mathbf{b}:

  1. e1=a/∥a∥\mathbf{e}_1 = \mathbf{a} / \|\mathbf{a}\|. (Normalise the first vector.)
  2. w=b−(b⋅e1) e1\mathbf{w} = \mathbf{b} - (\mathbf{b} \cdot \mathbf{e}_1)\, \mathbf{e}_1. (Subtract from b\mathbf{b} its component along e1\mathbf{e}_1.)
  3. e2=w/∥w∥\mathbf{e}_2 = \mathbf{w} / \|\mathbf{w}\|. (Normalise.)

For three or more inputs the procedure continues: subtract from each subsequent vector its components along all previously orthonormalised vectors, then normalise.

abstep1 of 4a(1.60, 0.50), ‖a‖ = 1.676b(0.40, 1.40)
Initial input: two linearly-independent vectors a and b.

Drag the blue and red circles to set the input vectors a and b. Step through the procedure: normalise a, subtract its component from b to get a perpendicular remainder w, then normalise w. The small right-angle marker confirms that the green w is perpendicular to e₁. The output {e₁, e₂} is an orthonormal basis for the same plane that {a, b} spanned.

Drag the blue and red input vectors a\mathbf{a} and b\mathbf{b}. Step through the three operations. The little right-angle marker in step 2 confirms that the green residual w\mathbf{w} is perpendicular to e1\mathbf{e}_1; in step 3 it gets normalised to e2\mathbf{e}_2. The output basis {e1,e2}\{\mathbf{e}_1, \mathbf{e}_2\} spans the same plane as the input but with orthogonal axes.

Worked example

▶ Worked example: Gram–Schmidt on three vectors in R³ Derivation

The problem. Find an orthonormal basis for the span of

a1=(1,1,0),a2=(1,0,1),a3=(0,1,1).\mathbf{a}_1 = (1, 1, 0), \quad \mathbf{a}_2 = (1, 0, 1), \quad \mathbf{a}_3 = (0, 1, 1).

These three vectors are linearly independent (verify by computing det⁡=2≠0\det = 2 \neq 0) and so span all of R3\mathbb{R}^3; the output will be an orthonormal basis of R3\mathbb{R}^3.

Step 1 — Normalise a1\mathbf{a}_1.

∥a1∥=12+12+02=2,e1=12(1,1,0).\|\mathbf{a}_1\| = \sqrt{1^2 + 1^2 + 0^2} = \sqrt{2}, \qquad \mathbf{e}_1 = \frac{1}{\sqrt{2}} (1, 1, 0).

Step 2 — Subtract the e1\mathbf{e}_1-component from a2\mathbf{a}_2 to get w2\mathbf{w}_2.

a2⋅e1=12(1⋅1+0⋅1+1⋅0)=12.\mathbf{a}_2 \cdot \mathbf{e}_1 = \frac{1}{\sqrt{2}} (1 \cdot 1 + 0 \cdot 1 + 1 \cdot 0) = \frac{1}{\sqrt{2}}.w2=a2−(a2⋅e1) e1=(1,0,1)−12⋅12(1,1,0)=(1,0,1)−12(1,1,0)=(12,−12,1).\mathbf{w}_2 = \mathbf{a}_2 - (\mathbf{a}_2 \cdot \mathbf{e}_1)\, \mathbf{e}_1 = (1, 0, 1) - \frac{1}{\sqrt{2}} \cdot \frac{1}{\sqrt{2}} (1, 1, 0) = (1, 0, 1) - \tfrac12 (1, 1, 0) = (\tfrac12, -\tfrac12, 1).

Check that w2\mathbf{w}_2 is orthogonal to e1\mathbf{e}_1: w2⋅e1=12(12−12+0)=0\mathbf{w}_2 \cdot \mathbf{e}_1 = \tfrac{1}{\sqrt{2}} (\tfrac12 - \tfrac12 + 0) = 0. ✓

Step 3 — Normalise w2\mathbf{w}_2.

∥w2∥=(12)2+(12)2+12=32=62.\|\mathbf{w}_2\| = \sqrt{(\tfrac12)^2 + (\tfrac12)^2 + 1^2} = \sqrt{\tfrac{3}{2}} = \frac{\sqrt{6}}{2}.e2=26(12,−12,1)=16(1,−1,2).\mathbf{e}_2 = \frac{2}{\sqrt{6}} (\tfrac12, -\tfrac12, 1) = \frac{1}{\sqrt{6}} (1, -1, 2).

Step 4 — Subtract e1\mathbf{e}_1- and e2\mathbf{e}_2-components from a3\mathbf{a}_3.

a3⋅e1=12(0+1+0)=12.\mathbf{a}_3 \cdot \mathbf{e}_1 = \frac{1}{\sqrt{2}} (0 + 1 + 0) = \frac{1}{\sqrt{2}}.a3⋅e2=16(0⋅1+1⋅(−1)+1⋅2)=16.\mathbf{a}_3 \cdot \mathbf{e}_2 = \frac{1}{\sqrt{6}} (0 \cdot 1 + 1 \cdot (-1) + 1 \cdot 2) = \frac{1}{\sqrt{6}}.w3=a3−(a3⋅e1) e1−(a3⋅e2) e2=(0,1,1)−12⋅12(1,1,0)−16⋅16(1,−1,2)=(0,1,1)−(12,12,0)−(16,−16,13)=(−23,23,23).\begin{aligned} \mathbf{w}_3 &= \mathbf{a}_3 - (\mathbf{a}_3 \cdot \mathbf{e}_1)\, \mathbf{e}_1 - (\mathbf{a}_3 \cdot \mathbf{e}_2)\, \mathbf{e}_2 \\ &= (0, 1, 1) - \frac{1}{\sqrt{2}} \cdot \frac{1}{\sqrt{2}} (1, 1, 0) - \frac{1}{\sqrt{6}} \cdot \frac{1}{\sqrt{6}} (1, -1, 2) \\ &= (0, 1, 1) - (\tfrac12, \tfrac12, 0) - (\tfrac16, -\tfrac16, \tfrac13) \\ &= (-\tfrac23, \tfrac23, \tfrac23). \end{aligned}

Check orthogonality: w3⋅e1=12(−23+23+0)=0\mathbf{w}_3 \cdot \mathbf{e}_1 = \tfrac{1}{\sqrt{2}} (-\tfrac23 + \tfrac23 + 0) = 0 ✓, and w3⋅e2=16(−23−23+43)=0\mathbf{w}_3 \cdot \mathbf{e}_2 = \tfrac{1}{\sqrt{6}} (-\tfrac23 - \tfrac23 + \tfrac43) = 0 ✓.

Step 5 — Normalise w3\mathbf{w}_3.

∥w3∥=(23)2⋅3=23.\|\mathbf{w}_3\| = \sqrt{(\tfrac23)^2 \cdot 3} = \tfrac{2}{\sqrt{3}}.e3=32⋅(−23,23,23)=13(−1,1,1).\mathbf{e}_3 = \frac{\sqrt{3}}{2} \cdot (-\tfrac23, \tfrac23, \tfrac23) = \frac{1}{\sqrt{3}} (-1, 1, 1).

Step 6 — Final answer. The orthonormal basis is

  e1=12(1,1,0),e2=16(1,−1,2),e3=13(−1,1,1).  \boxed{\;\mathbf{e}_1 = \tfrac{1}{\sqrt{2}}(1, 1, 0), \quad \mathbf{e}_2 = \tfrac{1}{\sqrt{6}}(1, -1, 2), \quad \mathbf{e}_3 = \tfrac{1}{\sqrt{3}}(-1, 1, 1).\;}

Each has length 1; each pair is orthogonal; together they span R3\mathbb{R}^3.

Inner products on function spaces

The bridge to PDEs: the same recipe — projection, orthogonality, Gram–Schmidt — works on infinite-dimensional spaces of functions, provided the inner product is the integral

⟨f,g⟩  =  ∫abf(x) g(x) dx\langle f, g \rangle \;=\; \int_a^b f(x)\, g(x)\, dx

(possibly weighted; the Sturm–Liouville theorem describes which weight functions are appropriate for which differential operators). The functions sin⁡(nπx/L)\sin(n \pi x / L) on [0,L][0, L] are pairwise orthogonal under this inner product, with ∥sin(nπx/L)∥2=L/2\|sin(n \pi x / L)\|^2 = L/2. Therefore the Fourier sine series

f(x)=∑ncnsin⁡(nπx/L),cn=2L∫0Lf(x) sin⁡(nπx/L) dx,f(x) = \sum_n c_n \sin(n \pi x / L), \qquad c_n = \frac{2}{L} \int_0^L f(x)\, \sin(n \pi x / L)\, dx,

is exactly the orthonormal-basis expansion v=∑k(v⋅ek) ek\mathbf{v} = \sum_k (\mathbf{v} \cdot \mathbf{e}_k)\, \mathbf{e}_k from the finite-dimensional case, lifted to the function space. The arithmetic is identical; the only difference is that “sum” becomes “integral” in the inner product, and "sin⁡(nπx/L)\sin(n\pi x/L)" plays the role of en\mathbf{e}_n. This is the deep reason separation of variables and Fourier expansion work: the natural eigenfunctions of self-adjoint differential operators are orthogonal under an appropriate inner product, and the spectral theorem in 4.6 guarantees their completeness as a basis.

What we use this for

Inner products are everywhere across the bookshelf:

The next lesson, 4.6, ties together everything in the chapter: the eigenvalues of 4.4, the orthogonality of this lesson, and the spectral theorem that guarantees a self-adjoint operator’s eigenvectors form a complete orthonormal basis. That theorem is what makes mode expansions for PDEs not just convenient but mathematically complete.