Given two point A and B. If the initial point of coordinate system is O, then we get vector OA and vector OB. We do not use it in common. If vector OA = v, and the later is u, we know that O, A, and B form a triangle that follow the law of Cosines.
This law is below
|AB|^2 = |OA|^2 + |OB|^2 - 2. |OA|. |OB| cos x, if x is angle AOB.
We represent the equation above in vector u and v as below.
|v - u|^2 = |u|^2 + |v|^2 - 2|v||u|cos x
Remember that |v|^2 = v.v (dot product of vector v)
(v - u).(v - u) = u.u + v.v - 2.|u|.|v| cos x
v.v - 2.u.v + u.u = u.u + v.v - 2 |u||v| cos x
so cos x is equal to
cos x = u.v / |u||v|
No comments:
Post a Comment