Dot Product Calculator
Calculate the dot product of two vectors in 2D to 6D, with the angle between them and an orthogonality test. u · v = u₁v₁ + u₂v₂ + … + uₙvₙ = |u||v| cos θ. Example: with vector u 1 2 3, …, the result is Dot product u · v = 12.
Last updated · By S. Dilshan · Runs in your browser, nothing is uploaded
Step-by-Step Solution
How do you use the Dot Product Calculator?
Enter two vectors with the same number of components. The calculator multiplies matching components, adds them for the dot product, finds each vector’s length and uses them to compute the angle between the vectors. When the result is zero, the two vectors meet at a right angle.
What formula does the Dot Product Calculator use?
u · v = u₁v₁ + u₂v₂ + … + uₙvₙ = |u||v| cos θ. Rearranging gives the angle θ = arccos((u · v)/(|u||v|)). The dot product is positive for angles under 90°, zero at 90° and negative beyond.
Worked example: Vector u 1 2 3, Vector v 4 -5 6
For u = (1, 2, 3) and v = (4, −5, 6): u · v = 4 − 10 + 18 = 12. The lengths are √14 ≈ 3.742 and √77 ≈ 8.775, so cos θ = 12 ÷ 32.84 = 0.3654 and θ ≈ 68.57°.
With the default values the calculator returns Dot product u · v = 12; |u| and |v| = 3.74165739 and 8.77496439; Angle between the vectors = 68.562447°; Orthogonal (perpendicular)? = No.
Where Is This Calculation Used?
The dot product tests perpendicularity, finds angles, projects one vector onto another and computes work in physics (force · displacement). In machine learning, cosine similarity (the normalised dot product) compares documents and embeddings.
Dot products measure alignment: vectors pointing the same way give the maximum |u||v|, perpendicular vectors give 0 and opposite directions give −|u||v|. In physics, work is force · displacement: pushing with 50 N along a 3 m displacement at 60° to the force does 50 × 3 × cos 60° = 75 J. Recommendation engines use cosine similarity, which is the dot product of two normalised vectors.
What are the most common mistakes with the Dot Product Calculator?
- Confusing the dot product (a number) with the cross product (a vector).
- Using vectors of different lengths.
- Forgetting that the angle formula needs non-zero vectors.
What Is the Tested Example for the Default Values?
This example is computed by the same code that powers the calculator above, so you can compare it with your own numbers or a textbook answer.
| Input: Vector u | 1 2 3 |
|---|---|
| Input: Vector v | 4 -5 6 |
| Dot product u · v | 12 |
| |u| and |v| | 3.74165739 and 8.77496439 |
| Angle between the vectors | 68.562447° |
| Orthogonal (perpendicular)? | No |
Where Can You Verify These Formulas?
The definitions and formulas on this page follow standard references. Check them against these sources:
Built and maintained by S. Dilshan. Found a mistake? Email [email protected] with the page address.
Frequently Asked Questions
What is the dot product?
The sum of the products of matching components of two vectors, a single number.
How do I know if two vectors are perpendicular?
Their dot product is zero.
How do I get the angle between two vectors from their dot product?
θ = arccos of the dot product divided by the product of the lengths.