Everything you didn't want to know about dot and cross product
The dot product is the product of the cosine of the angle between two vectors and their length/magnitude. It can be written it as:
A⋅B = |A||B|cos theta
A⋅B = B⋅A
(kA)⋅B = k(A⋅B)
A⋅(B+C) = A⋅B + A⋅C
Now define 3 perpendicular vectors i, j and k, we can now state:
i.i = j.j = k.k = 1 i.j = j.k = k.i = 0
If we have our vectors A and B in component form:
A = i*x1 + j*y1 + k*z1 B = i*x2 + j*y2 + k*z2We can then find a component form expression for the dot product.
A⋅B = (i*x1 + j*y1 + k*z1)⋅(i*x2 + j*y2 + k*z2)
= (i*x1 + j*y1 + k*z1)⋅(i*x2)
+ (i*x1 + j*y1 + k*z1)⋅(j*y2)
+ (i*x1 + j*y1 + k*z1)⋅(k*z2)
= (i*x1)⋅(i*x2) + (j*y1)⋅(i*x2) + (k*z1)⋅(i*x2)
+ (i*x1)⋅(j*y2) + (j*y1)⋅(j*y2) + (k*z1)⋅(j*y2)
+ (i*x1)⋅(k*z2) + (j*y1)⋅(k*z2) + (k*z1)⋅(k*z2)
= (i⋅i)*x1*x2 + (j⋅i)*y1*x2 + (k⋅i)*z1*x2
+ (i⋅j)*x1*y2 + (j⋅j)*y1*y2 + (k⋅j)*z1*y2
+ (i⋅k)*x1*z2 + (j⋅k)*y1*z2 + (k⋅k)*z1*z2
= (1)*x1*x2 + (0)*y1*x2 + (0)*z1*x2
+ (0)*x1*y2 + (1)*y1*y2 + (0)*z1*y2
+ (0)*x1*z2 + (0)*y1*z2 + (1)*z1*z2
= x1*x2 + y1*y2 + z1*z2
Now the cross product is defined as the product of the sine of the angle between two vectors, their magnitude and a unit vector perpendicular to those vectors.
AxB = |A||B|sin(theta)n
= (i*x1 + j*y1 + k*z1)×(i*x2 + j*y2 + k*z2)
We can make the following observations about the cross of the perpendicular vectors i, j, k:
x | i | j | k |
i | 0 | k | -j |
j | -k | 0 | i |
k | j | -i | 0 |
A×B = (i*×1 + j*y1 + k*z1)×(i*×2 + j*y2 + k*z2)
= (i*×1 + j*y1 + k*z1)×(i*×2)
+ (i*×1 + j*y1 + k*z1)×(j*y2)
+ (i*×1 + j*y1 + k*z1)×(k*z2)
= (i*×1 + j*y1 + k*z1)×(i*×2)
+ (i*×1 + j*y1 + k*z1)×(j*y2)
+ (i*×1 + j*y1 + k*z1)×(k*z2)
= (i*×1)×(i*×2) + (j*y1)×(i*×2) + (k*z1)×(i*×2)
+ (i*×1)×(j*y2) + (j*y1)×(j*y2) + (k*z1)×(j*y2)
+ (i*×1)×(j*z2) + (j*y1)×(k*z2) + (k*z1)×(k*z2)
= 0*×1*×2 + -k*y1*×2 + j*z1*×2
+ k*×1*y2 + 0*y1*y2 + -i*z1*y2
+ -j*×1*z2 + i*y1*z2 + 0*z1*z2
= i*(y1*z2-z1*y2) + j*(×1*y2-y1*×2) + k*(×1*y2-y1*×2)
/x1 y1 z1\ |x2 y2 z2| \ i j k/