projections

>up
A quick recap of projections and components of vectors. Consider the vectors a and b shown in the figure to the right below. In class, we said that
The component of b along a, which we write as compa b, is just the magnitude of the piece of b pointing in the direction of a. The projection of b onto a is just a vector in the direction of a that has this magnitude.

figure 1: a, b, and projab

So, the component of b along a is just the length of the vector we've labeled projab in the figure to the right below. The easiest way to find this is to use trig: |projab| = |b| cos(theta).

But then, we remember the dot product! a . b = |a||b| cos(theta), so we can find the length we want by dividing by |a|:

compa b = a . b / |a|

That is, if someone gives us two vectors, we can calculate the length of the projection of one on the other by finding the dot product and dividing by the magnitude of the other.

For example, if we're given a = <3,4> and b = <-7,6>, then the length of the projection of b onto a is a . b/|a| = ((-7)(3) + (4)(6))/5 (yes, I picked a to have a nice magnitude, 5). So the length of the projection is 3/5. This is called the "scalar projection of b on a."

Then, suppose someone wants to know what the actual vector in that direction is. To get this we can take a unit vector (with length 1) in that direction, and stretch it out to the right length - that is, start with a unit vector in the direction of a and multiply by the length of the projection. A unit vector in that direction is a/|a|, or (1/5) <3,4>, which is the vector <3/5, 4/5>. So the "vector projection of b on a" is projab = (3/5) <3/5, 4/5> = <9/25, 12/25>.

And in general it's

 projab = (length of the projection) (unit vector) = (|b| cos(theta)) (a/|a|) = (a . b/|a|) (a/|a|)
>up