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*b3

Mag 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 / pi

Variables

VariableDescriptionDefault
a1Vector A: x1
a2Vector A: y2
a3Vector A: z3
b1Vector B: x4
b2Vector B: y5
b3Vector B: z6

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

  • If A · B = 0, the vectors are perpendicular
  • If A · B > 0, the angle is acute (less than 90°)
  • If A · B < 0, the angle is obtuse (greater than 90°)
  • Worked Example

    Dot product of (1,2,3) and (4,5,6).

    a1 = 1a2 = 2a3 = 3b1 = 4b2 = 5b3 = 6
    1. 01A · B = 1×4 + 2×5 + 3×6 = 4 + 10 + 18 = 32
    2. 02|A| = √(1+4+9) = √14 ≈ 3.742
    3. 03|B| = √(16+25+36) = √77 ≈ 8.775
    4. 04cos(theta) = 32/(3.742 × 8.775) ≈ 0.9746
    5. 05theta ≈ 12.93°

    Frequently Asked Questions

    What is the dot product?

    The dot product is a way to multiply two vectors to get a scalar (single number). It measures how much two vectors point in the same direction.

    When is the dot product zero?

    The dot product is zero when the vectors are perpendicular (orthogonal). This is a common test for perpendicularity.

    What is the difference between dot product and cross product?

    The dot product gives a scalar and measures alignment. The cross product gives a vector perpendicular to both inputs and measures the area of the parallelogram they span.

    Learn More

    Guide

    Introduction to Matrices - Complete Guide

    Learn the fundamentals of matrices including notation, operations, determinants, inverses, and applications in systems of equations, transformations, and data science.

    Ready to run the numbers?

    Open Dot Product Calculator