Geometric
Applications
Master vector projections and least-squares best fits: the geometric heart of linear algebra that powers everything from 3D graphics to data science.
What is a Projection?
Imagine shining a flashlight straight down onto a line. The shadow a vector casts on that line is its projection. In linear algebra, projecting \(\mathbf{b}\) onto \(\mathbf{a}\) means finding the point on the line through \(\mathbf{a}\) that is closest to \(\mathbf{b}\).
The Projection Formula
To project \(\mathbf{b}\) onto the direction of \(\mathbf{a}\), we use the dot product to measure how much of \(\mathbf{b}\) points along \(\mathbf{a}\):
The error vector is the part left over:
Why Projections Matter
The Projection Theorem
The key insight: \(\hat{\mathbf{b}}\) minimizes \(\|\mathbf{b} - \mathbf{x}\|\) for all \(\mathbf{x} \in W\). This is because the shortest distance from a point to a plane is always perpendicular.
Projection onto a Subspace
When projecting onto the column space of a matrix \(A\), we need the projection matrix \(P\):
Projection vs Reflection
| Projection | Reflection | |
|---|---|---|
| Matrix | \(P = A(A^T\!A)^{-1}A^T\) | \(R = 2P - I\) |
| Effect | Drops component perpendicular to \(W\) | Flips component perpendicular to \(W\) |
| Idempotent? | Yes: \(P^2 = P\) | No: \(R^2 = I\) |
| Eigenvalues | \(0\) and \(1\) | \(-1\) and \(1\) |
| Preserves length? | No (shrinks) | Yes (orthogonal) |
From Projections to Best Fits
When \(A\mathbf{x} = \mathbf{b}\) has no exact solution (more equations than unknowns), we want the \(\hat{\mathbf{x}}\) that makes \(A\hat{\mathbf{x}}\) as close to \(\mathbf{b}\) as possible.
How to Find the Least-Squares Fit
Example: Vector Projection
Project \(\mathbf{b} = \begin{pmatrix} 1 \\ 2 \\ 2 \end{pmatrix}\) onto \(\mathbf{a} = \begin{pmatrix} 1 \\ 0 \\ 1 \end{pmatrix}\).
Example: Best-Fit Line
Find the best-fit line \(y = c + dt\) through the points \((0,1)\), \((1,3)\), \((2,4)\).
Visualizing the Best Fit
Example: Projection Matrix
Find the projection matrix \(P\) that projects onto the column space of \(A = \begin{pmatrix} 1 \\ 2 \end{pmatrix}\).
The Orthogonal Decomposition
Every vector \(\mathbf{b}\) can be uniquely split into two perpendicular components relative to a subspace \(W\):
Common Mistakes to Avoid
Summary of Key Formulas
| Concept | Formula | Key Property |
|---|---|---|
| Scalar projection | \(\frac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{a}\|}\) | Signed length of shadow |
| Vector projection | \(\frac{\mathbf{a} \cdot \mathbf{b}}{\mathbf{a} \cdot \mathbf{a}}\,\mathbf{a}\) | \(\hat{\mathbf{b}} \in \text{span}(\mathbf{a})\) |
| Projection matrix | \(A(A^T\!A)^{-1}A^T\) | \(P^2 = P,\; P^T = P\) |
| Normal equations | \(A^T\!A\,\hat{\mathbf{x}} = A^T\!\mathbf{b}\) | Minimizes \(\|\mathbf{b} - A\mathbf{x}\|^2\) |
| Error vector | \(\mathbf{e} = \mathbf{b} - A\hat{\mathbf{x}}\) | \(\mathbf{e} \perp \text{Col}(A)\) |
Question 1 of 5
What is the projection of \(\mathbf{b} = \begin{pmatrix} 3 \\ 4 \end{pmatrix}\) onto \(\mathbf{a} = \begin{pmatrix} 1 \\ 0 \end{pmatrix}\)?
Question 2 of 5
If \(P\) is a projection matrix, which property must it satisfy?
Question 3 of 5
The least-squares solution \(\hat{\mathbf{x}}\) to \(A\mathbf{x} = \mathbf{b}\) satisfies which equation?
Question 4 of 5
If \(\hat{\mathbf{b}}\) is the orthogonal projection of \(\mathbf{b}\) onto subspace \(W\), and \(\mathbf{e} = \mathbf{b} - \hat{\mathbf{b}}\), what is \(\hat{\mathbf{b}} \cdot \mathbf{e}\)?
Question 5 of 5
What are the eigenvalues of a projection matrix \(P\) that projects onto a 2-dimensional subspace of \(\mathbb{R}^4\)?