The scalar product of two vectors is a way to multiply them together to obtain a scalar quantity. This is written as a multiplication of the two vectors, with a dot in the middle representing the multiplication. As such, it is often called the dot product of two vectors.
To calculate the dot product of two vectors, you consider the angle between them, as shown in the diagram. In other words, if they shared the same starting point, what would be the angle measurement (theta) between them. The dot product is defined as:
a * b = ab cos thetaIn other words, you multiply the magnitudes of the two vectors, then multiply by the cosine of the angle separation. Though a and b - the magnitudes of the two vectors - are always positive, cosine varies so the values can be positive, negative, or zero. It should also be noted that this operation is commutative, so a * b = b * a.
In cases when the vectors are perpendicular (or theta = 90 degrees), cos theta will be zero. Therefore, the dot product of perpendicular vectors is always zero. When the vectors are parallel (or theta = 0 degrees), cos theta is 1, so the scalar product is just the product of the magnitudes.
These neat little facts can be used to prove that, if you know the components, you can eliminate the need for theta entirely, with the (two-dimensional) equation:
a * b = ax bx + ay by