How to Calculate a Vector Dot Product

By Ariel Balter
Velocity is a vector quantity with magnitude and direction.
serega_one/iStock/Getty Images

A vector is an object that has both magnitude and direction. It is usually written as an ordered pair or triplet of coordinates, such as (x,y) or (x,y,z). There are two ways you can multiply vectors: the cross-product gives you another vector, while the dot product gives you a quantity that has only magnitude, called a scalar. The dot product of a vector with itself is equal to its magnitude squared; the dot product of two different vectors is the angle between them.


To calculate the dot product, multiply the corresponding coordinates of the two vectors, and add these products. If A = (x,y,z) and B = (u,v,w), then the dot product is AB = xu + yv + zw. For example, if A = (5,1,-3) and B = (-1,10,30) then AB = -5 + 10 - 90 = -85.

The Magnitude of Vectors

One important application of the dot product is to calculate the magnitude of a vector, which is denoted by ||A||. The magnitude of a vector is equivalent to its length, which you find using the Pythagorean theorem. The square of the length of A = (x,y,z) is ||A||^2 = x^2 + y^2 + z^2. But this is also the dot product of A with itself. Therefore ||A|| = the square root of (A * A), where "*" is the symbol for multiplication. For example if A = (5,1,3), then ||A|| = the square root of (25 + 1 + 9) = the square root of 35 = 5.92.

Angle Between Two Vectors

A property of the dot product is that, if θ is the angle between A and B, then AB = ||A|| * ||B||cos(θ). Suppose one airplane is moving with a velocity vector A = (10,15) and another is moving with a velocity vector B = (-3, 23). The speed of A is the magnitude of its velocity vector: the square root of (100 + 225) = 18. The speed of B is the square root of (9 + 529) = 23.2. You can find the angle between the flight paths using cos(θ) = AB / (||A|| * ||B|| ) = 315 / (418.2) = 0.753. Calculating the inverse cosine yields 41.1°.

About the Author

Ariel Balter started out writing, editing and typesetting, changed gears for a stint in the building trades, then returned to school and earned a PhD in physics. Since that time, Balter has been a professional scientist and teacher. He has a vast area of expertise including cooking, organic gardening, green living, green building trades and many areas of science and technology.