Dot Product Calculator
Dot product calculator for 2D, 3D and n-dimensional vectors. Compute scalar product, vector lengths, angle between vectors, and projection, with step-by-step expansion.
Full original guide (expanded)
Dot Product Calculator
This dot product calculator works with 2D, 3D, and general n-dimensional vectors. Enter the components of two vectors and get the scalar product a·b, the length of each vector, the angle between them, and the projection of A onto B, with step-by-step expansion.
It is designed for students and professionals in linear algebra, physics, engineering, and data science who need a precise and readable breakdown of vector computations.
1. Enter vectors
Use comma or space separated values. The two vectors must have the same dimension. Examples: 1, 2, 3, 0.5 -1.2 4.0, 2 0 -3 5.
Dot product – algebraic and geometric definitions
For two vectors \( \mathbf{a}, \mathbf{b} \in \mathbb{R}^n \) with components \( \mathbf{a} = (a_1, a_2, \dots, a_n) \) and \( \mathbf{b} = (b_1, b_2, \dots, b_n) \), the dot product (or scalar product) is defined as
Geometrically, the dot product relates to the angle \( \theta \) between the two vectors:
where \( \|\mathbf{a}\| \) and \( \|\mathbf{b}\| \) denote the Euclidean norms (lengths). This gives
Orthogonality and angle between vectors
- Orthogonal vectors: \( \mathbf{a} \) and \( \mathbf{b} \) are orthogonal if and only if \( \mathbf{a} \cdot \mathbf{b} = 0 \). Geometrically, the angle between them is \( 90^\circ \).
- Parallel vectors: If \( \theta = 0^\circ \) or \( 180^\circ \), the vectors are parallel or anti-parallel. In practice we test whether the unit vectors have the same or opposite direction within a tolerance.
- Zero vector: If one of the vectors is zero, its direction is undefined, so the angle is also undefined even though the dot product is 0.
Projection of one vector onto another
The projection of \( \mathbf{a} \) onto a non-zero vector \( \mathbf{b} \) is the component of \( \mathbf{a} \) that lies in the direction of \( \mathbf{b} \). It is given by
The scalar factor \( (\mathbf{a} \cdot \mathbf{b}) / \|\mathbf{b}\|^2 \) tells you how many “copies” of \( \mathbf{b} \) you need to reach the shadow of \( \mathbf{a} \) along \( \mathbf{b} \). The length of this projection is \( \|\operatorname{proj}_{\mathbf{b}}(\mathbf{a})\| = \|\mathbf{a}\|\cos\theta \).
Typical applications of the dot product
- Work in physics: Work done by a constant force \(\mathbf{F}\) along a displacement \(\mathbf{s}\) is \( W = \mathbf{F} \cdot \mathbf{s} = \|\mathbf{F}\|\|\mathbf{s}\|\cos\theta \).
- Projections and decompositions: Splitting a vector into components along and orthogonal to a direction.
- Similarity in data science: The cosine of the angle between feature vectors is a measure of similarity used in information retrieval and recommender systems.
- Linear algebra: Orthogonality, orthogonal projections, and orthonormal bases are all built on the dot product.
Dot product – FAQ
Formula (LaTeX) + variables + units
\mathbf{a} \cdot \mathbf{b} = \sum_{i=1}^{n} a_i b_i = a_1 b_1 + a_2 b_2 + \dots + a_n b_n.
\mathbf{a} \cdot \mathbf{b} = \|\mathbf{a}\| \, \|\mathbf{b}\| \cos\theta,
\cos\theta = \frac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{a}\| \, \|\mathbf{b}\|}, \qquad \theta = \arccos\!\left(\frac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{a}\| \, \|\mathbf{b}\|}\right).
\operatorname{proj}_{\mathbf{b}}(\mathbf{a}) = \frac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{b}\|^2}\,\mathbf{b}.
','\
\[ \mathbf{a} \cdot \mathbf{b} = \sum_{i=1}^{n} a_i b_i = a_1 b_1 + a_2 b_2 + \dots + a_n b_n. \]
\[ \mathbf{a} \cdot \mathbf{b} = \|\mathbf{a}\| \, \|\mathbf{b}\| \cos\theta, \]
\[ \cos\theta = \frac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{a}\| \, \|\mathbf{b}\|}, \qquad \theta = \arccos\!\left(\frac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{a}\| \, \|\mathbf{b}\|}\right). \]
\[ \operatorname{proj}_{\mathbf{b}}(\mathbf{a}) = \frac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{b}\|^2}\,\mathbf{b}. \]
- No variables provided in audit spec.
- NIST — Weights and measures — nist.gov · Accessed 2026-01-19
https://www.nist.gov/pml/weights-and-measures - FTC — Consumer advice — consumer.ftc.gov · Accessed 2026-01-19
https://consumer.ftc.gov/
Last code update: 2026-01-19
- Initial audit spec draft generated from HTML extraction (review required).
- Verify formulas match the calculator engine and convert any text-only formulas to LaTeX.
- Confirm sources are authoritative and relevant to the calculator methodology.