Dot Product Calculator Formula
Understand the math behind the dot product calculator. Each variable explained with a worked example.
Formulas Used
Dot
dot = a1*b1 + a2*b2 + a3*b3Mag A
mag_a = sqrt(pow(a1,2) + pow(a2,2) + pow(a3,2))Mag B
mag_b = sqrt(pow(b1,2) + pow(b2,2) + pow(b3,2))Angle
angle = acos((a1*b1 + a2*b2 + a3*b3) / (sqrt(pow(a1,2)+pow(a2,2)+pow(a3,2)) * sqrt(pow(b1,2)+pow(b2,2)+pow(b3,2)))) * 180 / piVariables
| Variable | Description | Default |
|---|---|---|
a1 | Vector A: x | 1 |
a2 | Vector A: y | 2 |
a3 | Vector A: z | 3 |
b1 | Vector B: x | 4 |
b2 | Vector B: y | 5 |
b3 | Vector B: z | 6 |
How It Works
Dot Product
Formula
A · B = a₁b₁ + a₂b₂ + a₃b₃
Geometric Interpretation
A · B = |A| × |B| × cos(theta)
So: theta = arccos(A · B / (|A| × |B|))
Properties
Worked Example
Dot product of (1,2,3) and (4,5,6).
a1 = 1a2 = 2a3 = 3b1 = 4b2 = 5b3 = 6
- 01A · B = 1×4 + 2×5 + 3×6 = 4 + 10 + 18 = 32
- 02|A| = √(1+4+9) = √14 ≈ 3.742
- 03|B| = √(16+25+36) = √77 ≈ 8.775
- 04cos(theta) = 32/(3.742 × 8.775) ≈ 0.9746
- 05theta ≈ 12.93°
Ready to run the numbers?
Open Dot Product Calculator