Dot Product: Definition, Formula & Example

The dot product combines two vectors and produces a single scalar value. For vectors with matching dimensions, it is calculated by multiplying corresponding components and adding the products. Geometrically, the dot product is also equal to the product of the vectors’ magnitudes and the cosine of the angle between them. This makes it useful for determining whether vectors are perpendicular, finding angles, calculating projections, and measuring how strongly two vectors point in the same direction. A positive dot product generally indicates an acute angle, a negative result indicates an obtuse angle, and zero indicates orthogonality when both vectors are nonzero. Unlike the cross product, which produces a perpendicular vector in three dimensions, the dot product always produces a scalar. It is one of the fundamental operations linking vector geometry, linear algebra, and multivariable calculus.
What Is the Dot Product?
For two n-dimensional vectors:
a = (a₁, a₂, …, aₙ)
and:
b = (b₁, b₂, …, bₙ)
the dot product is:
a · b = a₁b₁ + a₂b₂ + … + aₙbₙ
Using summation notation:
a · b = Σ aᵢbᵢ
The vectors must have the same number of components.
For example:
a = (2, 3)
b = (4, −1)
Then:
a · b = 2(4) + 3(−1)
= 8 − 3
= 5
The answer is the scalar:
5
not another vector.
Dot Product Formula in Three Dimensions
For:
a = (a₁, a₂, a₃)
and:
b = (b₁, b₂, b₃)
the component formula is:
a · b = a₁b₁ + a₂b₂ + a₃b₃
Consider:
a = (3, −2, 4)
b = (1, 5, −3)
Calculate:
a · b = 3(1) + (−2)(5) + 4(−3)
= 3 − 10 − 12
= −19
Therefore:
a · b = −19
Geometric Formula
The dot product can also be expressed using vector magnitudes and the angle between them:
a · b = |a||b| cos θ
where θ is the smaller angle between the two nonzero vectors.
The vector magnitude of:
a = (a₁, a₂, a₃)
is:
|a| = √(a₁² + a₂² + a₃²)
This geometric formula explains why the sign of the dot product reveals information about direction.
How to Calculate a Dot Product
Suppose:
a = (2, −1, 3)
and:
b = (4, 5, 2)
Multiply matching components:
2(4) = 8
(−1)(5) = −5
3(2) = 6
Add the results:
a · b = 8 − 5 + 6
= 9
Therefore:
a · b = 9
The operation requires only component-wise multiplication followed by addition.
Dot Product in Two Dimensions
For:
a = (a₁, a₂)
and:
b = (b₁, b₂)
the formula is:
a · b = a₁b₁ + a₂b₂
For example:
a = (5, 2)
b = (−1, 4)
Then:
a · b = 5(−1) + 2(4)
= −5 + 8
= 3
Finding the Angle Between Two Vectors
Starting with:
a · b = |a||b| cos θ
solve for cos θ:
cos θ = (a · b)/(|a||b|)
Then:
θ = cos⁻¹[(a · b)/(|a||b|)]
This formula applies when both vectors are nonzero.
Consider:
a = (1, 0)
b = (1, 1)
First calculate the dot product:
a · b = 1(1) + 0(1) = 1
The magnitudes are:
|a| = 1
and:
|b| = √2
Therefore:
cos θ = 1/√2
So:
θ = 45°
The vectors form a 45-degree angle.
Testing Whether Vectors Are Perpendicular
Two nonzero vectors are perpendicular when their dot product equals zero:
a · b = 0
For example:
a = (2, 3)
b = (3, −2)
Then:
a · b = 2(3) + 3(−2)
= 6 − 6
= 0
Therefore the vectors are perpendicular.
This condition is one of the most useful algebraic tests for orthogonality.
Why a Zero Dot Product Means Perpendicular
From the geometric formula:
a · b = |a||b| cos θ
if both vectors are nonzero and:
a · b = 0
then:
cos θ = 0
For the standard angle between vectors:
θ = 90°
So the vectors are perpendicular.
The zero vector is a special case because its magnitude is zero and its direction is undefined.
Positive Dot Product
If:
a · b > 0
then:
cos θ > 0
for nonzero vectors.
Therefore:
0° ≤ θ < 90°
The vectors point generally toward the same side of space.
For instance, vectors that point almost in the same direction usually have a relatively large positive dot product when their magnitudes are fixed.
Negative Dot Product
If:
a · b < 0
then:
cos θ < 0
and the angle satisfies:
90° < θ ≤ 180°
The vectors point more oppositely than together.
A strongly negative value can indicate substantial opposition in direction, although its magnitude also depends on the lengths of the vectors.
Parallel Vectors
If two nonzero vectors point in exactly the same direction:
θ = 0°
and:
cos 0° = 1
Therefore:
a · b = |a||b|
If they point in exactly opposite directions:
θ = 180°
and:
cos 180° = −1
so:
a · b = −|a||b|
These are the extreme possible values of the dot product for vectors with fixed magnitudes.
Dot Product of a Vector With Itself
A vector dotted with itself gives the square of its magnitude:
a · a = |a|²
For:
a = (2, −3, 6)
we have:
a · a = 2² + (−3)² + 6²
= 4 + 9 + 36
= 49
Therefore:
|a| = √49 = 7
This identity provides a direct connection between the dot product and vector length.
Dot Product and Vector Projection
The dot product determines how much one vector extends in the direction of another.
The scalar component of a along a nonzero vector b is:
comp_b a = (a · b)/|b|
The vector projection of a onto b is:
proj_b a = [(a · b)/(b · b)]b
For example, let:
a = (4, 3)
b = (1, 0)
Then:
a · b = 4
and:
b · b = 1
Therefore:
proj_b a = 4(1, 0)
= (4, 0)
This isolates the portion of a pointing along b.
Example: Projection Onto a Non-Unit Vector
Let:
a = (3, 4)
b = (2, 0)
First:
a · b = 3(2) + 4(0) = 6
Next:
b · b = 2² + 0² = 4
Therefore:
proj_b a = (6/4)(2, 0)
= (3, 0)
The fact that b is not a unit vector is handled automatically by dividing by b · b.
Unit Vectors and the Dot Product
If u and v are both unit vectors:
|u| = |v| = 1
then:
u · v = cos θ
This makes the dot product especially easy to interpret.
If:
u · v = 1
the vectors point in the same direction.
If:
u · v = 0
they are perpendicular.
If:
u · v = −1
they point in opposite directions.
Standard Basis Vectors
In three-dimensional Cartesian coordinates:
i = (1, 0, 0)
j = (0, 1, 0)
k = (0, 0, 1)
Their dot products satisfy:
i · i = 1
j · j = 1
k · k = 1
while:
i · j = 0
j · k = 0
k · i = 0
These relationships express the fact that the standard coordinate axes are mutually perpendicular unit directions.
The role of coordinate vectors fits naturally with basis and dimension, where vectors are represented relative to a chosen basis.
Dot Product Properties
The dot product obeys several useful algebraic rules.
Commutative Property
a · b = b · a
Unlike the cross product, reversing the vectors does not change the result.
Distributive Property
a · (b + c) = a · b + a · c
Scalar Multiplication
For scalar k:
(ka) · b = k(a · b)
and:
a · (kb) = k(a · b)
Self-Product
a · a ≥ 0
with equality only when:
a = 0
These properties make the dot product compatible with many algebraic manipulations in vector spaces.
Dot Product and Matrix Multiplication
A dot product is the basic scalar calculation inside ordinary matrix multiplication.
When matrix A is multiplied by matrix B, an entry of the product is obtained by taking the dot product of a row of A with a column of B.
For example:
(1, 2) · (3, 4)
gives:
1(3) + 2(4)
= 11
That value can become one entry in a matrix product.
This relationship helps connect elementary vector arithmetic with larger linear algebra calculations.
Dot Product and Linear Transformations
A linear transformation can change the coordinates, lengths, or directions of vectors.
Dot products are particularly important when asking whether a transformation preserves lengths and angles.
Transformations that preserve the standard dot product also preserve Euclidean geometric relationships such as orthogonality and distance.
This is one reason inner-product structure is central to geometric linear algebra.
Dot Product and Eigenvectors
Dot products can test whether vectors are orthogonal, including eigenvectors arising from certain matrices.
For a real symmetric matrix, eigenvectors associated with distinct eigenvalues can be chosen to be orthogonal.
If two such vectors are v₁ and v₂, their orthogonality can be checked by:
v₁ · v₂ = 0
The associated eigenvalue tells how a corresponding eigenvector is scaled by the matrix, while the dot product supplies geometric information about relationships between vectors.
Dot Product and Directional Derivatives
In multivariable calculus, the directional derivative is calculated using a dot product:
Dᵤf = ∇f · u
Here ∇f is the gradient and u is a unit direction vector.
The formula measures the component of the gradient along the desired direction.
If θ is the angle between ∇f and u:
Dᵤf = |∇f| cos θ
So the same geometric interpretation used for vectors directly determines rates of change on multivariable surfaces.
Dot Product and Differentials
For a differentiable scalar function of several variables, differentials can also be written using a dot product.
For:
f(x, y)
the differential is:
df = fₓ dx + fᵧ dy
Let:
∇f = (fₓ, fᵧ)
and:
dr = (dx, dy)
Then:
df = ∇f · dr
This form expresses the local output change as the interaction between the gradient and a small displacement.
Dot Products in Differential Equations
Vector-valued systems of differential equations can involve geometric quantities measured through dot products.
For example, a dot product may describe a component of a vector field along a trajectory, test orthogonality of solution directions, or appear in energy-like expressions.
The differential equation determines how the unknown function evolves, while the dot product supplies a scalar relationship between vectors involved in that evolution.
Dot Product Versus Cross Product
The dot product and cross product should not be confused.
For the dot product:
a · b = |a||b| cos θ
and the output is a scalar.
For the cross product:
|a × b| = |a||b| sin θ
and the output is a vector perpendicular to the original vectors.
The dot product is naturally suited to angle, alignment, orthogonality, and projection. The cross product is naturally suited to normals, orientation, and parallelogram area.
Dot Product Versus Double Integral
A double integral and a dot product can both appear in multivariable problems, but they perform completely different operations.
A dot product combines vectors at a point and returns a scalar.
A double integral accumulates a scalar quantity across a two-dimensional region.
For example, a vector field calculation may first use a dot product to select a directional component and later integrate a related quantity over a domain, but those are distinct mathematical steps.
Dot Products in Multivariable Calculus
The multivariable calculus setting makes extensive use of vector operations because functions can vary across several spatial directions.
Dot products connect gradients with directions, tangent vectors with other vectors, and components with coordinate systems.
These interactions explain why the dot product belongs naturally within the broader Calculus & Linear Algebra framework even though its component formula is purely algebraic.
Cauchy–Schwarz Bound
For real vectors:
|a · b| ≤ |a||b|
This follows from the geometric formula because:
|cos θ| ≤ 1
The equality occurs when the vectors are linearly dependent, meaning they point in the same or opposite direction, provided both are nonzero.
This inequality also guarantees that:
(a · b)/(|a||b|)
lies between −1 and 1 when computing an angle.
Example: Check Orthogonality
Let:
a = (1, 2, −1)
b = (4, −1, 2)
Calculate:
a · b = 1(4) + 2(−1) + (−1)(2)
= 4 − 2 − 2
= 0
Therefore:
a ⟂ b
The vectors are perpendicular.
Example: Find the Angle in Three Dimensions
Let:
a = (1, 2, 2)
b = (2, 1, 2)
First:
a · b = 1(2) + 2(1) + 2(2)
= 8
Now calculate the magnitudes:
|a| = √(1² + 2² + 2²)
= √9 = 3
Similarly:
|b| = √(2² + 1² + 2²)
= √9 = 3
Therefore:
cos θ = 8/(3·3)
= 8/9
So:
θ = cos⁻¹(8/9)
θ ≈ 27.27°
Common Mistakes
A frequent mistake is returning a vector instead of a scalar. The dot product always returns one scalar value.
Another error is multiplying mismatched components. Corresponding positions must be paired before their products are added.
When finding an angle, both vector magnitudes must appear in the denominator:
cos θ = (a · b)/(|a||b|)
It is also incorrect to conclude that a zero dot product always defines an angle of 90°. That statement requires both vectors to be nonzero because the zero vector has no defined direction.
Projection formulas present another common source of mistakes. When projecting onto a non-unit vector b, the denominator must account for its length through b · b.
Finally, the dot product should not be confused with component-wise multiplication that leaves the individual products unadded. The defining operation includes both multiplication and summation.
Frequently Asked Questions
What is the dot product formula?
For:
a = (a₁, a₂, …, aₙ)
and:
b = (b₁, b₂, …, bₙ)
the formula is:
a · b = a₁b₁ + a₂b₂ + … + aₙbₙ
What does a dot product produce?
It produces a scalar, not a vector.
What is the geometric dot product formula?
For two nonzero vectors:
a · b = |a||b| cos θ
where θ is the angle between them.
When are two vectors perpendicular?
Two nonzero vectors are perpendicular when:
a · b = 0
Can a dot product be negative?
Yes. A negative result indicates an obtuse angle between two nonzero vectors.
What does a positive dot product mean?
It means the angle between two nonzero vectors is acute, except for the limiting same-direction case at 0°.
What is a vector dotted with itself?
a · a = |a|²
So the self-dot-product equals the square of the vector’s magnitude.
Does order matter in a dot product?
No. The dot product is commutative:
a · b = b · a
How is a dot product used to find an angle?
Use:
θ = cos⁻¹[(a · b)/(|a||b|)]
provided neither vector is zero.
How is the dot product related to projection?
The dot product measures the component of one vector along another and appears directly in the vector projection formula.
What is the difference between dot product and cross product?
The dot product returns a scalar related to cos θ. The cross product returns a perpendicular vector whose magnitude is related to sin θ.
Can dot products be used in more than three dimensions?
Yes. The component definition works for real vectors of any finite dimension as long as both vectors have the same number of components.



