Another service from Omega

The Law of Cosines


*****


Theorem:


If u and v are vectors then

> ;

                        2    2    2
                 (u - v)  = u  + v  - 2 u.v 

where by the square of a vector u, we mean u.u, the inner product of the vector with itself.

Proof:


we show that this follows from applying the pythagorean theorem twice on the following figure,
picture a picture here

First recall that the projection of v onto u is the vector,

> ;

                            (v.u) 
                             ---  u
                              2
                             u

Applying pythagoras to the right triangle with diagonal v we get that,

> ;

                                   2 
                     2    2   (v.u)   2
                    w  = v  - -----  u
                                4
                               u

and pythagoras again now applied to the right triangle with diagonal (v-u) produces,

> ;

                           2   /    v.u  \2    2
                    (v - u)  = |u - --- u|  + w
                               |      2  |
                               \     u   /       
			       
			       
			        /    v.u \2  2    2 
			     =  |1 - --- |  u  + w  
			        |      2 |       
 			        \     u  /       

replacing the previous expression for the square of w and expanding the square in big brackets we obtain,

> ;

                          /                  2\                2
                      2   |      v.u    (v.u) |  2    2   (v.u)
               (v - u)  = |1 - 2 ---- +  ---  | u  + v  -  ----
                          |        2       4  |              2
                          \       u       u  /              u

simplifying we obtain the result,

> ;

                           2    2    2
                    (v - u)  = u  + v  - 2 u.v

q.e.d.


Corollary:

If in a given orthonormal coordinate system,

> u := vector([u1,u2,u3]);

                               u := [u1, u2, u3]
> v := vector([v1,v2,v3]);
                               v := [v1, v2, v3]

then,

> uDOTv := innerprod(u,v);

                        uDOTv := u1 v1 + u2 v2 + u3 v3


Proof:


From the Law of cosines we have that,

> ;

                           2        2              2
                u.v = 1/2 u  + 1/2 v  - 1/2 (v - u)

but the square of the length of a vector is just the sum of the squares of its coordinates. This can be verified easily by applying (twice again) the pythagorean theorem. Just consider the vector emanating from the origin of a given coordinate system and notice that the projection of the vector on the floor (xy plane) is the leg of a right triangle that has the vector as hypotenuse. The projection onto the floor itself is the hypotenuse of another right angle triangle. Thus... (do it!) it follows that

> ;

                                2    2    2    2
               (x i + y j + z k)  = x  + y  + z

replacing the corresponding square lengths into the previous equation for u.v we obtain,

> ;

             2         2         2         2         2         2
u.v := 1/2 u1  + 1/2 u2  + 1/2 u3  + 1/2 v1  + 1/2 v2  + 1/2 v3

                    2                2                2
     - 1/2 (v1 - u1)  - 1/2 (v2 - u2)  - 1/2 (v3 - u3)

simplifying we obtain

> ;

                       u.v =  v1 u1 + v2 u2 + v3 u3

q.e.d.


Link to the commands in this file
Carlos Rodriguez <carlos@math.albany.edu>
Last modified: Tue Jan 30 15:31:47 EST 2001