DotProduct.md (1610B)
1 # Dot Product 2 3 CS331 + Khan 4 5 **Definition:** The dot product of two vectors is the sum of their corresponding components. 6 7 This can be visualized as the length of one vector, v, projected onto another vector, y, multiplied by the length of the vector y. Additionally, if two vectors generally have a different direction, their dot product is negative. This is why the on same side of plane algorithm works (see cs331 code), because if two vectors are on the same side of the normal vector of a plane, then they will both have negative or positive dot products. 8 9 This value is zero if the vectors are orthogonal. 10 11 ### Additional Thoughts 12 13 The dotproduct in a geometric sense is u dot v = ||u|| ||v|| cos(theta) where theta is the angle between the two vectors. As such, when the angle between them is greater than 90 and less than 270 we find the dot product is negative. 14 15 ### Intuition Of DP 16 17 By definition, the dot product can be stated as follows where || defines lenghts of vectors and theta is the angle between the two vectors: 18 19 a dot b = ||a|| ||b|| cos(theta) 20 21 The dot product is the projection of the second vector onto the first vector multiplied by the length of the first vector where the first vector is the one that has a lesser angle. 22 23 Based on this information, it is intuitive that when two vectors are almost orthogonal the dot product is very small. Conversely, when two vectors are almost dependent, the dot product will then be large. 24 25 This explains why orthogonal vectors have a dot product of zero. 26 27 **Product of the lengths of the vectors that are moving in the same direction.**