Inner Product Spaces: Functions as Vectors

April 13, 2026

Problem

Compute the inner product ⟨f, g⟩ = ∫₀¹ f(x)g(x) dx for f(x) = x and g(x) = x². Interpret the result geometrically.

Explanation

Generalizing the dot product

An inner product on a vector space VV is a function ,:V×VR\langle \cdot, \cdot \rangle : V \times V \to \mathbb{R} satisfying four axioms for all u,v,wV\mathbf{u}, \mathbf{v}, \mathbf{w} \in V and scalars cc:

  1. Symmetric: u,v=v,u\langle \mathbf{u}, \mathbf{v} \rangle = \langle \mathbf{v}, \mathbf{u} \rangle.
  2. Linear in first slot: cu+w,v=cu,v+w,v\langle c \mathbf{u} + \mathbf{w}, \mathbf{v} \rangle = c \langle \mathbf{u}, \mathbf{v} \rangle + \langle \mathbf{w}, \mathbf{v} \rangle.
  3. Positive: u,u0\langle \mathbf{u}, \mathbf{u} \rangle \ge 0.
  4. Definite: u,u=0    u=0\langle \mathbf{u}, \mathbf{u} \rangle = 0 \implies \mathbf{u} = \mathbf{0}.

A vector space with an inner product is an inner product space. All the geometric concepts that work in Rn\mathbb{R}^n (length, angle, orthogonality, projections) generalize immediately.

The standard inner products

  • Euclidean on Rn\mathbb{R}^n: u,v=uivi\langle \mathbf{u}, \mathbf{v} \rangle = \sum u_i v_i — the ordinary dot product.
  • L2L^2 on continuous functions: f,g=abf(x)g(x)dx\langle f, g \rangle = \int_a^b f(x) g(x) \, dx.
  • Weighted: u,v=uTWv\langle \mathbf{u}, \mathbf{v} \rangle = \mathbf{u}^T W \mathbf{v} for positive-definite WW.
  • Matrix (Frobenius): A,B=tr(ATB)=AijBij\langle A, B \rangle = \operatorname{tr}(A^T B) = \sum A_{ij} B_{ij}.

Step-by-step

f(x)=xf(x) = x, g(x)=x2g(x) = x^2 on [0,1][0, 1].

f,g=01xx2dx=01x3dx=[x44]01=14\langle f, g \rangle = \int_0^1 x \cdot x^2 \, dx = \int_0^1 x^3 \, dx = \left[\dfrac{x^4}{4}\right]_0^1 = \dfrac{1}{4}

f,g=14\boxed{\langle f, g \rangle = \tfrac{1}{4}}

Norms and angles

Once you have an inner product, you get a norm \|\cdot\| and an angle θ\theta via: u=u,u,cosθ=u,vuv\|\mathbf{u}\| = \sqrt{\langle \mathbf{u}, \mathbf{u} \rangle}, \quad \cos \theta = \dfrac{\langle \mathbf{u}, \mathbf{v} \rangle}{\|\mathbf{u}\| \, \|\mathbf{v}\|}

For our example: f2=01x2dx=13    f=13\|f\|^2 = \int_0^1 x^2 \, dx = \tfrac{1}{3} \implies \|f\| = \tfrac{1}{\sqrt{3}} g2=01x4dx=15    g=15\|g\|^2 = \int_0^1 x^4 \, dx = \tfrac{1}{5} \implies \|g\| = \tfrac{1}{\sqrt{5}}

cosθ=1/41315=1415=1540.968\cos \theta = \dfrac{1/4}{\tfrac{1}{\sqrt{3}} \cdot \tfrac{1}{\sqrt{5}}} = \dfrac{1}{4} \cdot \sqrt{15} = \dfrac{\sqrt{15}}{4} \approx 0.968

So the "angle" between ff and gg is about arccos(0.968)14.5°\arccos(0.968) \approx 14.5°. They're almost parallel as functions on [0,1][0,1] — both increasing and positive on the interval.

Cauchy–Schwarz inequality

For any u,v\mathbf{u}, \mathbf{v} in an inner product space: u,vuv|\langle \mathbf{u}, \mathbf{v} \rangle| \le \|\mathbf{u}\| \, \|\mathbf{v}\|

Equality iff u\mathbf{u} and v\mathbf{v} are linearly dependent. This is the most important inequality in inner product spaces — it's what lets you define an angle at all.

For our f,gf, g: 1/4=0.25(1/3)(1/5)=1/150.258|1/4| = 0.25 \le (1/\sqrt{3})(1/\sqrt{5}) = 1/\sqrt{15} \approx 0.258

Orthogonality in function spaces

Two functions are orthogonal under abfgdx\int_a^b f g \, dx when their product integrates to zero. Classic examples:

  • sin(nx)\sin(nx) and cos(mx)\cos(mx) on [π,π][-\pi, \pi] for any m,nm, n: ππsin(nx)cos(mx)dx=0\int_{-\pi}^{\pi} \sin(nx) \cos(mx) \, dx = 0.
  • sin(nx)\sin(nx) and sin(mx)\sin(mx) for mnm \ne n: orthogonal.
  • cos(nx)\cos(nx) and cos(mx)\cos(mx) for mnm \ne n: orthogonal.

This is the foundation of Fourier series — functions are decomposed onto the orthogonal basis {1,sin(nx),cos(nx)}\{1, \sin(nx), \cos(nx)\}.

Where inner product spaces matter

  • Fourier series and transforms: expand signals onto orthonormal function bases.
  • Quantum mechanics: states are vectors in an inner product (Hilbert) space, observables are Hermitian operators.
  • Statistics: variance is a squared norm, correlation is essentially cosθ\cos \theta on centered random variables.
  • Machine learning: kernel methods define inner products in infinite-dimensional feature spaces without computing them directly.

Common mistakes

  • Forgetting the axioms. Not every bilinear form is a valid inner product; it must be symmetric and positive-definite.
  • Treating inner products of functions like of vectors. The computation now involves an integral, not a sum, but the geometric intuition transfers directly.
  • Missing the weight. In weighted inner products abfgwdx\int_a^b f g w \, dx, forgetting ww gives the wrong answer.

Try it in the visualization

Two functions are drawn on [0,1][0, 1]. Their product is shaded; the area under the product curve equals the inner product. Drag function parameters and watch how the area (and hence f,g\langle f, g \rangle) changes.

Interactive Visualization

Parameters

x
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day