Last verified · v1.0
Calculator · math
Dot Product Calculator
Compute the dot product of two 2D or 3D vectors by entering their components. Returns the scalar result instantly.
Inputs
Dot Product
—
Explain my result
Get a plain-English breakdown of your result with practical next steps.
The formula
How the
result is
computed.
What Is the Dot Product?
The dot product (also called the scalar product or inner product) is a fundamental vector operation that takes two vectors and returns a single scalar value. Unlike cross multiplication, which yields another vector, the dot product collapses two vectors into one real number — making it indispensable in physics, engineering, computer graphics, and machine learning.
The Dot Product Formula
For two vectors A = (a₁, a₂, a₃) and B = (b₁, b₂, b₃) in three-dimensional space, the algebraic definition is:
A · B = a₁b₁ + a₂b₂ + a₃b₃
For two-dimensional vectors A = (a₁, a₂) and B = (b₁, b₂), the formula simplifies to:
A · B = a₁b₁ + a₂b₂
According to Whitman College Calculus Online, Section 12.3, this algebraic definition is equivalent to the geometric formula A · B = |A||B|cos(θ), where |A| and |B| are the magnitudes of each vector and θ is the angle between them. Both definitions are provably equivalent and together give the dot product its full power.
Derivation and Geometric Meaning
The algebraic definition emerges from expanding the geometric formula using the law of cosines. For a third vector C = A − B, the squared magnitude |C|² = |A|² + |B|² − 2|A||B|cos(θ). Expanding each magnitude in component form and simplifying yields the multiply-and-sum rule directly.
As demonstrated in MIT OpenCourseWare Multivariable Calculus, Lecture 1, this equivalence is essential: it means the dot product simultaneously encodes algebraic structure and angular geometry, enabling engineers and scientists to extract angle information from pure component arithmetic.
Variables Explained
- a₁, a₂, a₃ — The x, y, and z components of Vector A. These accept any real numbers: positive, negative, or zero.
- b₁, b₂, b₃ — The x, y, and z components of Vector B, aligned to the same coordinate axes.
- Result (scalar) — The dot product output is always a single real number, never a vector.
- θ (theta) — The angle between the vectors, recoverable via θ = arccos(A · B / (|A||B|)).
Key Algebraic Properties
- Commutative: A · B = B · A
- Distributive: A · (B + C) = A · B + A · C
- Scalar associativity: (kA) · B = k(A · B) for any scalar k
- Self dot product: A · A = |A|², the square of the vector magnitude
Geometric Interpretation of the Result
The sign of the dot product directly encodes the angle between the two vectors. A positive result means θ < 90° — the vectors lean toward each other. A zero result means θ = 90° — the vectors are perpendicular (orthogonal). A negative result means θ > 90° — the vectors point in broadly opposing directions. This sign test is the standard method for verifying orthogonality in linear algebra.
Worked Examples
Example 1 — 3D Dot Product
Let A = (3, −2, 5) and B = (1, 4, −1). Then: A · B = (3)(1) + (−2)(4) + (5)(−1) = 3 − 8 − 5 = −10. The negative result confirms the vectors form an obtuse angle greater than 90°.
Example 2 — Physics: Work Calculation
A force F = (6, 4) N pushes an object along displacement d = (3, 0) m. Work W = F · d = (6)(3) + (4)(0) = 18 joules. Only the force component aligned with displacement contributes energy — the perpendicular component does zero work.
Example 3 — Orthogonality Check
Are A = (2, 3) and B = (−3, 2) perpendicular? A · B = (2)(−3) + (3)(2) = −6 + 6 = 0. The zero result confirms orthogonality.
Real-World Applications
- Physics: Work equals the dot product of force and displacement (W = F · d); power equals force dotted with velocity.
- Computer graphics: Lambertian shading models compute brightness as the dot product of the surface normal and incoming light direction vector.
- Machine learning: Fully connected neural network layers perform dot products between weight vectors and input activations at every node.
- Search and NLP: Cosine similarity — used in search engines, recommendation systems, and embedding comparisons — is derived directly from the dot product formula.
Reference