Programmers and Teachers:
Dot Product Calculator
Dot Product Lesson
What is a Dot Product?
The calculator above computes the dot product of the two inputted vectors. The result of calculating a dot product is a scalar, which is a numerical value without direction (a vector has a numerical value AND a direction). The common notation of a dot product is A∙B where A and B are the vectors, and the dot operator ∙ represents that a dot product is being calculated.
Calculating the dot product of two vectors is a very simple and useful mathematical operation that only requires simple multiplication and addition operations. It can be used to determine the angle between vectors. It can also be calculated with the angle between two vectors. Below we will show the two methods for calculating a dot product.
Dot Product Calculation Method #1
Method #1 is given as:
Where A and B are the original vectors, × is pure multiplication, the absolute value bars represent vector magnitude, and θ is the angle between the two vectors.
This method is great for use in 2-dimensional vector systems where the angle between the vectors is a known value since the Pythagorean theorem can be implemented to find the magnitude of each vector. Then, only two multiplication operations need to be performed.
Additionally, this method can be used in a 3-dimensional vector system if we can determine the angle between the two vectors (if not given in the problem). If we are unable to determine the angle between two vectors in a 3-dimensional system, we consider using method #2 which is explained in the next section.
Method #1 Example Problem:
Find the dot product of vectors A and B, where A = 3i + 5j and B = 2i – 6j. The angle between A and B is measured to be 131°.
1.) First, let’s find the magnitude of each vector since that is our only unknown still needed to employ method #1.
2.) Using the Pythagorean theorem on the two components of vector A (imagine each component is a leg in a right triangle) we find the magnitude to be 5.83.
3.) Using the Pythagorean theorem on the two components of vector B we find the magnitude to be 6.32.
4.) Now we plug our known values into the equation.
A∙B = 5.83×6.32×cos(131°) = -24
Dot Product Calculation Method #2
Method #2 is given as:
Method #2 is very easy to use because we simply perform three pure multiplication operations using the components from each vector, which are often provided in the problem. We then perform basic summing of the multiplied terms to get the final dot product solution.
This method is not very simple to use if we are only given vector directions and magnitudes without the i, j, and k components. Method #1 is simpler to use for those kinds of problems. However, when we cannot determine the angle between vectors, we must use method #2.
Method #2 Example Problem:
Find the dot product of vectors A and B, where A = 2i + 8j – 3k and B = -3i + j + 2k.
1.) We already have every one of the values required for plugging into the method #2 equation.
2.) Let’s plug in the vector components into A∙B = (a1)(b1) + (a2)(b2) + (a3)(b3).
A∙B = (2)(-3) + (8)(1) + (-3)(2) = – 6 + 8 – 6 = -4
How the Calculator Works
The main routine of the calculator is a computerized version of method #2 above. Each component of your two input vectors is fed into the dot product formula. The components are multiplied, then summed which results in the dot product of a and b. That answer is converted to LaTeX (a math rendering language) and displayed in the answer area of the calculator.