A point floats above a tilted plane. Which point of the plane is nearest? Watch three ways down, and see which is shortest.
Closest point
Three ways from b down to the plane C(B). Which is shortest?
The plane of B's columns, where the third number is the sum of the first two, and the point b = (1, 2, 6).
Describe this picture
A slowly turning view of three axes in space, a tilted plane through the origin, and the point above it. The plane is every point whose third number is the sum of the first two. In turn, three paths drop from to the plane, each labelled with its length. The first goes straight down, parallel to the third axis, and lands at : length 3. The second slants and lands at : length 2.236. The third lands at , where it meets the plane at a right angle, marked with a small square; it is 1.732 long and drawn thicker than the others, which fade. Readouts give , the length of the leftover , and the straight-down length. When the clip has finished, can be dragged, or moved with the arrow keys in steps of 0.5: left and right along the floor, up and down along the third axis. The three drops follow it, the right angle holds, and the readouts change.
Straight down is not the shortest
Most people expect the nearest point to be straight below, as if the point fell under gravity. The picture says otherwise. Straight down is 3 long. A slanted path to is shorter, 2.236. The shortest path of all, 1.732 long, lands at , and it is the one that meets the plane at a right angle.
That is the rule for the nearest point. Call it , and call what is left over . I write the leftover in bold, , with no number under it; the unit arrows always carry a number. At the nearest point, is at a right angle to the plane.
Why is that the nearest? Take any other point of the plane. The step from to lies in the plane, so it is at a right angle to . The path from to is the leftover followed by that step, and by the right-angle rule for lengths,
So every other point is farther. For , the point straight below: .
After the clip, drag . The foot follows it, and the right angle never breaks. Drag straight along the right-angle path, and the foot does not move at all.
Onto a line
Start with the simplest case, which you met as a shadow in Length and the dot product: project onto the line through .
Shadow on a line
The point of a line closest to b is the foot of a right angle.
The arrow a = (2, 1), its line, and the arrow b = (1, 2).
Describe this picture
The plane with the arrow , its line drawn dashed through the origin, and the arrow . A dashed path drops from the tip of to the line at a right angle, marked with a small square. The foot, , is labelled, and the leftover is drawn from the foot to the tip of . The picture has no control.
The foot is some multiple of , say . The leftover must be at a right angle to , so its dot product with is zero:
Here and , so , and . Check the right angle: . And the lengths: .
Onto a plane
Now the plane at the top of the page. It is the column space of
the plane where the third number is the sum of the first two, from The four fundamental subspaces. Every point of it is for some weights , so the foot is for the right weights . The hat marks the best choice.
The leftover must be at a right angle to the whole plane, which means at a right angle to both columns. Two dot products must be zero, and together they are one matrix equation:
These are the normal equations; “normal” is an old word for “at a right angle”. Here and . Solving, . So and .
Check: . So lies in the left null space , the line of on that page. The lengths split as before: .
That is the whole picture of a projection. The column space and the left null space meet at a right angle, and every splits into one piece in each: .
The projection matrix
Put the steps together. , and , so with
This is the projection matrix. It is not the permutation matrix of Transposes and permutations, which shares the letter. Check it: .
Three facts about follow from the picture.
- Projecting twice changes nothing. A point already on the plane is its own nearest point: . So .
- It is symmetric. , as you can read off the matrix above.
- It cannot be undone. Every point on the right-angle path through lands on the same foot, so no matrix can send the foot back to the one you started from. has no inverse.
The diagonal of adds up to , the dimension of the plane. For a line, the projection matrix is : for it is , and its diagonal adds up to 1.
Worked example
- Onto a line. onto the line of : and .
- Onto a plane. onto the plane of : , , .
- Already there. If is on the plane, and .
- Twice. .
- The diagonal. For a projection onto a plane in three dimensions, the diagonal of adds up to 2.
- Predict. Drag along the right-angle path through it. The foot stays where it is.
Where you’ll meet this
A mains hum has a known shape. Suppose the shape is and a recording is . The hum’s share is , and removing it leaves , which is at a right angle to .
Removing the mean of a list is a projection too. Project onto : the foot is , the mean repeated, and the leftover is the list with its mean removed. The shadow of a game character under an overhead light is a projection onto the floor, with the matrix that keeps the first two numbers and sets the height to 0.
In signal processing · orthogonal projection
The Wiener filter is a projection: its error is at a right angle to every input sample it uses, and its equations are the normal equations of this page. Resonators, notches and combs removes a hum with a notch, a soft version of this projection. One difference in counting: vector entries count from 1 here, while samples count from 0 there.
Where this leads · fitting data
When has no exact answer, the best one projects onto the column space. That is Least squares.
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| Split | at a right angle to the subspace | |
| Onto a line | the shadow | |
| Normal equations | is perpendicular to every column | |
| Foot | in | |
| Leftover | in | |
| Projection matrix | , , no inverse | |
| Lengths | the right-angle rule |