Angle Between 3D vectors

Question:

Please can you tell me how do you find the angle between two 3-d vectors, when you are given the x, y and z co-ord's???

Answer:

Suppose we had the two vectors (1,2,3) and (4,5,6). The length, L, of each vector is the square root of the sum of the squares of the components. L1 is (1+4+9)^.5=3.74. L2 is (16+25+36)^.5=8.77. The dot product of two vectors is defined as the product of the lengths times the cosine of the angle between them. 3.74*8.77*cos(ang)=dot product. Here comes the neat trick. The dot product may also be calculated by adding the products of like components. For example the dot product of the two vectors (1,2,3) and (4,5,6) is 1*4+2*5+3*6 = 32. Setting the two ways of calculating the dot product equal we get:
32=3.74*8.77*cos(ang), or cos(ang)=32/(3.74*8.77)=0.976. The angle between them then will be the angle whose cosine is 0.976, or about 12.7 degrees.

This information is brought to you by M. Casco Associates, a company dedicated to helping humankind reach the stars through understanding how the universe works. My name is James D. Jones. If I can be of more help, please let me know.

JDJ