Dot Product Calculator — Free Scalar Product, Angle & Projection 2026 | AllInOneTools
· Free Calculator

Dot Product Calculator

Calculate the dot product (scalar product) of two vectors in 2D or 3D. Get angle, orthogonality check, projection, cosine similarity, and work — all with interactive visualization and step-by-step solutions.

Dot Product Calculator
Input Mode:
Dimension:
VECTOR A
VECTOR B
A·B = Σaᵢbᵢ| = |A||B|cos θ| θ = arccos(A·B/(|A||B|))
A · B — Dot Product
--
A · B
--
Angle θ
--
|A|
--
|B|
--
Cos Similarity
--
proj_B(A)
--
Dot Product Properties at a Glance
PropertyFormulaValueMeaning
💡 Geometric Insight

Related Math Tools

The Dot Product: A Complete Guide

What Is the Dot Product?

The dot product (also called the scalar product or inner product) is a fundamental operation that takes two vectors and produces a single number (scalar). For vectors A = (a₁, a₂, …, aₙ) and B = (b₁, b₂, …, bₙ), the dot product is A·B = a₁b₁ + a₂b₂ + … + aₙbₙ. The dot product encodes the relationship between two vectors' magnitudes and the angle between them through the identity A·B = |A||B|cos(θ), making it one of the most important operations in linear algebra, physics, and computer science.

Algebraic: A · B = a₁b₁ + a₂b₂ + a₃b₃
Geometric: A · B = |A| · |B| · cos(θ)
Angle: θ = arccos(A·B / (|A| · |B|))
Properties: Commutative, Distributive, NOT Associative

Algebraic vs Geometric Definition

The algebraic definition (sum of component products) is computational: multiply corresponding components and add. The geometric definition (|A||B|cos θ) reveals meaning: the dot product measures how much two vectors "agree" in direction. When θ = 0° (parallel, same direction), cos(0°) = 1 and A·B = |A||B| — maximum positive value. When θ = 90° (perpendicular), cos(90°) = 0 and A·B = 0. When θ = 180° (antiparallel), cos(180°) = −1 and A·B = −|A||B| — maximum negative value. That these two definitions are equivalent is a consequence of the law of cosines.

Example: Component Calculation
A = (3, 4), B = (−2, 5).
A·B = (3)(−2) + (4)(5) = −6 + 20 = 14.
|A| = √(9+16) = 5, |B| = √(4+25) = √29 ≈ 5.385.
cos(θ) = 14/(5 × 5.385) = 0.5197, θ = arccos(0.5197) ≈ 58.67°.

Orthogonality: The Zero Dot Product

The most important geometric fact about the dot product: A·B = 0 if and only if A and B are perpendicular (orthogonal), assuming neither is the zero vector. This test is the foundation of orthogonal bases, the Gram-Schmidt process, Fourier analysis, and countless algorithms. In higher dimensions where "perpendicular" is hard to visualize, A·B = 0 is the precise mathematical definition of orthogonality. Orthogonal vectors are independent — knowing one tells you nothing about the other.

Vector Projection

The scalar projection of A onto B is comp_B(A) = A·B/|B|, the signed length of A's "shadow" on B. The vector projection is proj_B(A) = (A·B/|B|²)·B, a vector along B representing A's component in B's direction. The rejection (perpendicular component) is A − proj_B(A). Together, projection and rejection decompose any vector into parallel and perpendicular components relative to another vector, which is essential for physics (force decomposition), computer graphics (lighting), and data analysis (PCA).

Scalar projection: comp_B(A) = A·B / |B|
Vector projection: proj_B(A) = (A·B / |B|²) · B
Rejection: rej_B(A) = A − proj_B(A)
Verify: proj + rej = A ✓

Cosine Similarity

Cosine similarity = A·B/(|A|·|B|) = cos(θ) measures directional similarity on a scale from −1 to +1. A value of 1 means identical direction, 0 means orthogonal, and −1 means opposite directions. This metric ignores magnitude — only direction matters. It's the backbone of modern information retrieval: search engines rank documents by cosine similarity between query and document vectors. In NLP, word embeddings use cosine similarity to capture semantic relationships ("king" − "man" + "woman" ≈ "queen"). In recommendation systems, it measures user preference similarity.

Work Done by a Force

In physics, work is the dot product of force and displacement: W = F·d = |F||d|cos(θ). When you push a box horizontally (θ = 0°), all force contributes to work. When you carry a box horizontally (force upward, θ = 90°), work is zero — you're not moving it in the force direction. When pushing against motion (θ = 180°), work is negative (friction). This extends to variable forces: W = ∫F·ds is a line integral of the dot product along a path.

Example: Physics — Work
Force F = (6, 8) N along displacement d = (10, 0) m.
W = F·d = 6×10 + 8×0 = 60 J.
|F| = 10N, |d| = 10m, θ = arccos(60/100) = 53.13°.
Only the horizontal component (6N) does work.

Properties of the Dot Product

The dot product is commutative (A·B = B·A), distributive (A·(B+C) = A·B + A·C), bilinear ((kA)·B = k(A·B)), and positive-definite (A·A ≥ 0, equals 0 only if A = 0). The Cauchy-Schwarz inequality states |A·B| ≤ |A||B|, with equality when A and B are parallel. This is not just a theoretical bound — it guarantees cos(θ) always falls between −1 and 1, which is why arccos always produces a valid angle.

Dot Product in n Dimensions

Unlike the cross product (only 3D), the dot product generalizes to any number of dimensions: A·B = Σᵢ aᵢbᵢ. In data science, feature vectors may have hundreds or thousands of components. In quantum mechanics, the inner product 〈ψ|φ〉 generalizes the dot product to complex vector spaces. The formula θ = arccos(A·B/(|A||B|)) defines angle in any dimension, even where geometric intuition fails.

Dot Product vs Cross Product

The dot product returns a scalar, measures how parallel vectors are, and works in any dimension. The cross product returns a vector, measures how perpendicular vectors are, and works only in 3D. Numerically: A·B = |A||B|cos(θ) while |A×B| = |A||B|sin(θ). When vectors are parallel, the dot product is maximum and the cross product is zero; when perpendicular, the opposite. Together they provide a complete picture of vector relationships.

Pro Tip: Quick Checks
If the dot product is positive → acute angle. If zero → right angle. If negative → obtuse angle. Also: A·A = |A|² always, which gives an efficient way to compute magnitude squared without a square root.

How to Use This Calculator

Choose Component Mode to enter x, y (and z for 3D) values directly, or Magnitude & Angle Mode if you know |A|, |B|, and the angle θ between them. Click "Calculate Dot Product" to see: the scalar result, angle θ in degrees and radians, orthogonality badge, scalar and vector projections, cosine similarity, work interpretation, and a full step-by-step solution. The visualization shows both vectors, the angle arc, and the projection shadow on an interactive coordinate grid.

Common Mistake
The dot product is NOT a vector — it's a scalar (a single number). Writing A·B = (something, something) is always wrong. Also, the dot product is NOT associative: (A·B)·C doesn't make sense because A·B is a scalar, not a vector. Finally, A·B = 0 means perpendicular ONLY if neither A nor B is the zero vector.

Frequently Asked Questions

What is the dot product of two vectors?
A·B = a₁b₁+a₂b₂+a₃b₃ = |A||B|cos(θ). A scalar that measures how parallel two vectors are. Max when parallel, zero when perpendicular.
How to find the angle between vectors?
θ = arccos(A·B/(|A||B|)). Always 0°–180°. If A·B=0 → 90°. Positive → acute. Negative → obtuse.
When is the dot product zero?
When vectors are perpendicular (orthogonal): θ = 90°. A·B = 0 is the mathematical definition of orthogonality (for non-zero vectors).
What is the difference between dot and cross product?
Dot → scalar, any dimension, measures parallelism. Cross → vector, 3D only, measures perpendicularity. A·B = |A||B|cos θ vs |A×B| = |A||B|sin θ.
What is vector projection?
Scalar projection = A·B/|B|. Vector projection = (A·B/|B|²)·B. Gives the component of A along B's direction.
What is cosine similarity?
cos(θ) = A·B/(|A||B|). Ranges from −1 to 1. Used in ML, NLP, search engines to measure directional similarity regardless of magnitude.
How is the dot product used in physics?
W = F·d (work). When force and displacement align: max work. When perpendicular: zero work. When opposite: negative work.
Can you calculate dot product from magnitudes and angle?
Yes. A·B = |A|·|B|·cos(θ). Enter magnitudes and angle in our Magnitude & Angle mode to compute directly.