Dot Product Operator

The dot product of two vectors produces a number which represents how aligned the vectors are with each other. The dot product of and can be interpretted as projecting onto the line formed by and multiplying the length of the projected vector by the length of .

The geometry of the dot product of two 2D vectors.
The dot product of two 2d vectors.

Algebraically, the dot product of two vectors is given by the product of their components.

When the two vectors point in the same direction, the dot product is positive.

Positive dot product example.

When the two vectors are perpendicular, the dot product is zero.

Zero dot product example.

When the two vectors point in opposite directions, the dot product is negative.

Negative dot product example.

Sometimes, we define the dot product of two vectors in terms of their magnitudes and the angle between them.

Related Operators

Cross Product

The cross product operates on two vectors and produces another vector as a result.

Magnitude

The magnitude (or length) of a vector gives a scalar representation of its size, irrespective of its direction.