For AI agents: use /llms.txt for the Nakafa content index.
An important question that arises is whether the best approximation really exists and whether its solution is unique? The answer is yes. Let V be a Euclidean vector space and S⊂V be a finite-dimensional vector subspace. Then for every f∈V there exists a unique best approximation with
This theorem guarantees that the best approximation always exists and is unique. Like finding the closest point from a location to a highway, there is always one point that gives the shortest distance.
Let n be the dimension of S and ψ1,…,ψn be a basis of S. Using the Gram-Schmidt process, we can compute an orthonormal basis φ1,…,φn of S with ⟨φi,φk⟩=δik.
Every g∈S has a unique representation as g=∑i=1nαiφi. Then it follows that
Using the identity (αi−⟨f,φi⟩)2=αi2−2αi⟨f,φi⟩+⟨f,φi⟩2, we obtain
Function g∈S is the best approximation of f if and only if αi=⟨f,φi⟩ for i=1,…,n.
For an orthonormal basis φ1,…,φn of S, the best approximation is given by
The best approximation satisfies the distance formula
The best approximation g of f in S is the orthogonal projection of f onto S. This means
Geometrically, the vector from g to f is perpendicular to the subspace S. Imagine dropping a ball from the air to the floor, the point where it lands is the orthogonal projection of the ball onto the floor.
When an orthonormal basis of S is not known, we can use an arbitrary basis ψ1,…,ψn of S. Let g=∑i=1nαiψi be the unique representation of g with respect to this basis.
Since ψk∈S, the orthogonality condition gives
This yields the linear system
The coefficient matrix A=(⟨ψi,ψk⟩)i=1,…,n,k=1,…,n is called the Gram matrix of the basis ψ1,…,ψn. This matrix is symmetric and positive definite. For α=0 it holds
However, matrix A can become very ill-conditioned in practice. For example, for the monomial basis 1,x,…,xn, the matrix becomes very unstable so that computing g becomes difficult for large n.
The Gauss approximation with an orthonormal basis of S has the advantage of easy computation of the best approximation
without needing to solve a linear system. With an orthonormal basis, we can directly compute the projection coefficients like using a coordinate system that is already neatly arranged and mutually perpendicular.