metamerist

Friday, March 16, 2007

Dot products of orthogonal vectors

This is post #2 of a series discussing the expression (X'X)-1X'Y used in multiple linear regression. Post #1 is here.

If you have two vectors that are perpendicular to each other (i.e., orthogonal), their dot product is zero. I'm going to devote this post to convincing us of this fact.

The dot product of two vectors is the sum of the products of all of the corresponding components of those two vectors. It applies in any number of dimensions. In the two dimensional case, the dot product of vectors U and V is Ux* Vx + Uy* Vy.

First, let's see if this works in the simplest case I can imagine, the case of a unit vector pointing up (0,1) and another unit vector pointing to the right (1,0). The dot product of these two vectors is 0*1 + 1*0, which is, of course, zero.



Next, let's rotate our two unit vectors by some angle theta and see what we can conclude.



Our "up" vector rotates from (0,1) to (-sinq, cosq) and our "right" vector rotates from (1,0) to (cosq, sinq).



The dot product of the rotated vectors is (-sinq*cosq + sinq*cosq). Since the first term negates the second, we can see that the dot product remains zero regardless of rotation.

Now that we've shown the dot product of our two perpendiculars vectors is zero regardless of their rotation, we have two more degrees of freedom to consider. So far we've constrained our vectors to unit length.

Finally, let's scale our first vector by A and our second vector by B. This leaves us with two vectors: (-A*sinq, A*cosq) and (B*cosq, B*sinq). The dot product of these two vectors is (-A*B*sinq*cosq + A*B*sinq*cosq). Once again, the two terms negate each other and result in a sum of zero for all possible combinations of A and B.

Speaking more generally, the dot product of two unit vectors is the cosine of the angle between them. This rule holds true with the orthogonal vectors we just discussed, because the angle between orthogonal vectors is 90 degrees (pi/2) and the cosine of 90 is zero.

Up next: A simple vector projection

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home