## Projection - Theory

Given vectors V and W, we seek a vector which is the perpendicular projection of V on W. (Actually, most of the work is in algebraic manipulation, which gives us a nice formula in terms of dot products.)

This projection will be a multiple of W - it's pointed in the same direction as W.

What multiple? Look at the right triangle formed by a, b, and c (where the line perpendicular to W goes through b). Well, one side's length is the same as the projection's. It has length equal to the hypoteneuse time the cosine of the angle at a, i.e., the length of the projection is |V| cos a. (This is a perfectly good formula, but we'll proceed to write an even better one in terms of the dot product).

Recall that cos a is the dot product of UNIT vectors making an angle a, and we can make vectors unit vectors by dividing by their length, so cos a = (V/|V|)(W/|W|) and the length of the projection is |V| cos a = |V| (V/|V|)(W/|W|) = (V)(W/|W|).

So that's the length, and we know the direction, namely that of W. So if we multiply the length times a UNIT vector in that direction, we get a vector with the correct length and direction.