LINEAR ALGEBRA • INNER PRODUCT SPACES & ORTHOGONALITY

Best Approximation

Finding the closest possible match to a target when a perfect solution doesn't exist.

Historical Context & Motivation

Imagine you need to draw a straight line through a scatter of data points, but no single line passes through every point. What do you do? You find the line that comes as close as possible to all the points. This idea — getting the best answer when a perfect answer is impossible — is at the heart of best approximation. For centuries, mathematicians and scientists have tackled problems where exact solutions simply don't exist. Instead, they looked for the closest match, and this search shaped entire fields of mathematics.

1805
Legendre & Least Squares
Adrien-Marie Legendre published the method of least squares, a technique for fitting the best line to data. This gave scientists a systematic way to handle measurement errors.
1807
Fourier Series
Joseph Fourier showed that complicated waves could be approximated by adding together simple sine and cosine waves. This was an early form of best approximation in function spaces.
1907
Hilbert Spaces Formalized
David Hilbert introduced abstract inner product spaces, providing a rigorous framework for defining "closeness" and proving that best approximations always exist in complete spaces.
1936
Orthogonal Projection Theorem
John von Neumann proved the projection theorem, which guarantees that the best approximation to any vector from a closed subspace is the orthogonal projection. This became a cornerstone of modern linear algebra.

The central question that best approximation answers is: given a vector (or point, or signal) and a subspace where we must find our answer, which element of that subspace is the closest to our target? As we'll see, the answer involves a beautiful geometric idea called orthogonal projection.

Core Principles & Definitions

Before we can find the best approximation, we need a few building blocks. These ideas let us measure distances and angles in vector spaces, much like a ruler and protractor work in everyday geometry.

1

Inner Product

An inner product (also called a dot product in ℝⁿ) is a rule that takes two vectors and returns a number. It tells us how much two vectors "agree" or point in the same direction. Written as ⟨u, v⟩.
2

Norm (Length)

The norm of a vector, written ‖v‖, measures its length. It's defined using the inner product: ‖v‖ = √⟨v, v⟩. We use norms to measure distances between vectors.
3

Subspace

A subspace is a flat subset of a vector space that passes through the origin. Think of a plane through the origin in 3D space, or a line through the origin in 2D.
4

Orthogonality

Two vectors are orthogonal (perpendicular) when their inner product equals zero: ⟨u, v⟩ = 0. This is the key geometric condition behind best approximation.
5

Orthogonal Projection

The orthogonal projection of a vector onto a subspace is the "shadow" it casts straight down onto that subspace. This shadow is the best approximation.
KEY TAKEAWAY
Think of standing under a streetlight at night. Your shadow on the ground is the closest flat version of you. The best approximation works the same way: you "drop a perpendicular" from your target vector straight down onto the subspace, and where it lands is the closest point in that subspace. The error — the gap between you and your shadow — is perfectly perpendicular to the ground.

Visual Explanation

The diagram below shows the geometry of best approximation in three dimensions. A vector b lives in 3D space, but the subspace W (shown as a shaded plane) is only two-dimensional. The best approximation is the point on W that is closest to b. The error vector b − b̂ is perpendicular to the entire subspace.

The vector b (purple) is projected onto the subspace W. The projection (cyan) is the best approximation, and the error b − b̂ (pink dashed) is perpendicular to the plane, as shown by the 90° angle marker.

Notice the right-angle symbol where the error vector meets the subspace. This perpendicularity is not a coincidence — it's the defining property that makes b̂ the closest point in W to the target b. If you moved to any other point on the plane, you'd be farther away. This is the same reason the shortest distance from a point to a line is always the perpendicular distance, an idea you may remember from geometry class.

Mathematical Framework

Now let's write down the math. Suppose W is a subspace of an inner product space V, and b is a vector in V that may or may not be in W. We want to find the vector b̂ in W that minimizes the distance ‖b − b̂‖.

BEST APPROXIMATION THEOREM
b̂ = proj_W(b) minimizes ‖b − w‖ for all w in W
b̂ = the best approximation (the orthogonal projection of b onto W). w = any vector in the subspace W. ‖b − w‖ = the distance between b and w.

When the subspace W has an orthogonal basis {u₁, u₂, …, uₖ}, computing the projection becomes straightforward. You project b onto each basis vector individually and then add the results together.

PROJECTION ONTO AN ORTHOGONAL BASIS
b̂ = (⟨b, u₁⟩ / ⟨u₁, u₁⟩) × u₁ + (⟨b, u₂⟩ / ⟨u₂, u₂⟩) × u₂ + … + (⟨b, uₖ⟩ / ⟨uₖ, uₖ⟩) × uₖ
⟨b, uᵢ⟩ = the inner product (dot product) of b and uᵢ. Each fraction ⟨b, uᵢ⟩ / ⟨uᵢ, uᵢ⟩ is a scalar that tells you how much of b lies in the direction of uᵢ.

If the basis is orthonormal (meaning each basis vector has length 1), the formula simplifies even further because ⟨uᵢ, uᵢ⟩ = 1 for every basis vector.

PROJECTION (ORTHONORMAL BASIS)
b̂ = ⟨b, u₁⟩ × u₁ + ⟨b, u₂⟩ × u₂ + … + ⟨b, uₖ⟩ × uₖ
Each coefficient ⟨b, uᵢ⟩ is called a Fourier coefficient. It measures how much b "agrees with" the direction uᵢ.
ORTHOGONALITY CONDITION (ERROR)
⟨b − b̂, w⟩ = 0 for every w in W
The error vector b − b̂ is orthogonal (perpendicular) to every vector in W. This condition is what guarantees b̂ is the closest point.

Step-by-Step Projection Process

Let's visualize the step-by-step process of finding a best approximation. The diagram below breaks down how we decompose a vector b into a part that lies in the subspace (the projection b̂) and a part that is perpendicular to it (the error). In this example, W is a one-dimensional subspace — simply a line through the origin in 2D.

In 2D, projecting vector b (purple) onto the subspace W (amber line) gives the best approximation (green). The error vector (pink dashed) is perpendicular to W, confirmed by the 90° marker.

The Projection Algorithm

  1. Step 1 — Get an orthogonal basis. If the subspace W doesn't already have an orthogonal basis, use the Gram–Schmidt process to create one.
  2. Step 2 — Compute each projection. For each basis vector uᵢ, calculate the scalar (⟨b, uᵢ⟩ / ⟨uᵢ, uᵢ⟩) and multiply it by uᵢ.
  3. Step 3 — Add them up. Sum all the individual projections to get b̂ = proj_W(b).
  4. Step 4 — Find the error. Compute the error vector as b − b̂. Its length ‖b − b̂‖ is the distance from b to the subspace.

Worked Example

Let's find the best approximation to a vector b from a subspace W using a concrete numerical example.

Find the Best Approximation in ℝ³
1
Step 1 — Identify Given ValuesWe have b = (1, 2, 3) in ℝ³. The subspace W is spanned by two orthogonal vectors: u₁ = (1, 0, 1) and u₂ = (0, 1, 0). We want to find b̂ = proj_W(b), the vector in W closest to b.
b = (1, 2, 3), u₁ = (1, 0, 1), u₂ = (0, 1, 0)
2
Step 2 — Verify OrthogonalityCheck that u₁ and u₂ are orthogonal: ⟨u₁, u₂⟩ = (1)(0) + (0)(1) + (1)(0) = 0. They are orthogonal, so we can use the projection formula directly without Gram–Schmidt.
⟨u₁, u₂⟩ = 0 ✓ Orthogonal
3
Step 3 — Project b onto u₁Compute ⟨b, u₁⟩ = (1)(1) + (2)(0) + (3)(1) = 1 + 0 + 3 = 4. Compute ⟨u₁, u₁⟩ = (1)(1) + (0)(0) + (1)(1) = 2. So the projection onto u₁ is (4/2) × u₁ = 2 × (1, 0, 1) = (2, 0, 2).
proj_{u₁}(b) = (2, 0, 2)
4
Step 4 — Project b onto u₂Compute ⟨b, u₂⟩ = (1)(0) + (2)(1) + (3)(0) = 2. Compute ⟨u₂, u₂⟩ = (0)(0) + (1)(1) + (0)(0) = 1. So the projection onto u₂ is (2/1) × u₂ = 2 × (0, 1, 0) = (0, 2, 0).
proj_{u₂}(b) = (0, 2, 0)
5
Step 5 — Add the ProjectionsThe best approximation is b̂ = proj_{u₁}(b) + proj_{u₂}(b) = (2, 0, 2) + (0, 2, 0) = (2, 2, 2).
b̂ = (2, 2, 2)
6
Step 6 — Compute the ErrorThe error vector is b − b̂ = (1, 2, 3) − (2, 2, 2) = (−1, 0, 1). Let's verify it's orthogonal to W: ⟨(−1, 0, 1), u₁⟩ = −1 + 0 + 1 = 0 ✓ and ⟨(−1, 0, 1), u₂⟩ = 0 + 0 + 0 = 0 ✓. The distance is ‖b − b̂‖ = √((−1)² + 0² + 1²) = √2 ≈ 1.41.
Error = (−1, 0, 1), Distance = √2 ≈ 1.41
💡 Verification Tip
Always check that the error vector is orthogonal to every basis vector of W. If any dot product is not zero, go back and recheck your arithmetic. This orthogonality check is your built-in answer verifier!

Strengths & Limitations

Best approximation via orthogonal projection is a powerful tool, but like any technique, it has situations where it shines and situations where you need to be careful.

Strengths and limitations of best approximation via orthogonal projection
AspectStrengthsLimitations
UniquenessThe best approximation is always unique — there is exactly one closest point in the subspace.Only guaranteed in complete inner product spaces with closed subspaces.
ComputationVery fast with an orthogonal or orthonormal basis — just dot products and scalar multiplication.If the basis is not orthogonal, you first need the Gram–Schmidt process, which adds extra steps.
Geometric IntuitionThe perpendicularity condition gives strong visual and geometric understanding.In very high dimensions, visualizing the geometry becomes impossible (but the math still works).
Error ControlYou can calculate the exact error ‖b − b̂‖, so you know how good your approximation is.The error can only be reduced by enlarging the subspace W — you cannot improve within the same subspace.
KEY TAKEAWAY
Best approximation is like using a GPS that always finds the closest road to your location. It may not put you exactly where you want to go, but it guarantees you'll be on the nearest road. The only way to get closer to your true destination is to build more roads (expand the subspace).

Connection to Advanced Theory

Best approximation is not just an isolated technique. It connects to many powerful ideas in mathematics, science, and engineering. Here's how the concept you just learned relates to more advanced topics.

How best approximation connects to advanced topics
This LessonAdvanced ExtensionWhere It Appears
Projection onto a subspace with orthogonal basisLeast-squares regression — finding the best-fit line through data pointsStatistics, data science, machine learning
Orthogonal projection in ℝⁿFourier series — approximating signals using sine and cosine functionsSignal processing, audio compression, music technology
Minimizing ‖b − b̂‖QR factorization — a matrix decomposition that makes projection computationally efficientNumerical analysis, computer graphics, engineering simulations
Error vector is perpendicularHilbert space theory — projection theorem in infinite-dimensional spacesQuantum mechanics, functional analysis, partial differential equations

The idea you learned here — projecting onto a subspace to find the closest match — is the same idea behind fitting a line to data in statistics, compressing music files on your phone, and even how quantum physics describes the state of a particle. The language gets more sophisticated, but the core geometry of dropping a perpendicular stays exactly the same.

Practice Problems

PROBLEM 1CONCEPTUAL
Explain in your own words why the error vector b − b̂ must be perpendicular to the subspace W. What would go wrong if it weren't perpendicular?
PROBLEM 2BASIC CALCULATION
Let b = (3, 4) and u = (1, 0). The subspace W is the span of u (the x-axis). Find the best approximation b̂ = proj_W(b) and the error ‖b − b̂‖.
PROBLEM 3INTERMEDIATE
Let b = (1, 3, 5) and W = span{u₁, u₂} where u₁ = (1, 1, 0) and u₂ = (−1, 1, 0). Verify that u₁ and u₂ are orthogonal, then find the best approximation b̂ and the approximation error ‖b − b̂‖.
PROBLEM 4APPLIED
A student collects data points (1, 2), (2, 3), and (3, 6) and wants to fit them with a line y = c₁ through the origin. This means solving the inconsistent system [1; 2; 3]c₁ = [2; 3; 6], where a = (1, 2, 3) and b = (2, 3, 6). Use best approximation to find the value of c₁ that gives the best-fit line.
PROBLEM 5CRITICAL THINKING
Suppose W₁ ⊂ W₂ are two subspaces with W₁ contained inside W₂. Let b̂₁ = proj_{W₁}(b) and b̂₂ = proj_{W₂}(b). Which approximation error is smaller — ‖b − b̂₁‖ or ‖b − b̂₂‖? Explain your reasoning carefully and discuss whether adding more basis vectors to a subspace always helps.

Summary

The best approximation to a vector b from a subspace W is the orthogonal projection of b onto W, written b̂ = proj_W(b). It is the unique vector in W that minimizes the distance ‖b − b̂‖. The defining property is the orthogonality condition: the error vector b − b̂ is perpendicular to every vector in W, meaning ⟨b − b̂, w⟩ = 0 for all w in W.

To compute b̂, use an orthogonal basis {u₁, u₂, …, uₖ} for W and apply the formula b̂ = Σ (⟨b, uᵢ⟩ / ⟨uᵢ, uᵢ⟩) × uᵢ. With an orthonormal basis, this simplifies to b̂ = Σ ⟨b, uᵢ⟩ × uᵢ. Best approximation is the foundation of least-squares regression, Fourier analysis, and countless applications in science and engineering.

Varsity Tutors • Linear Algebra • Best Approximation