Dot Product of Two Vectors: Formula, Meaning + Examples
Learn the dot product formula for 2D, 3D, and n-dimensional vectors, what the sign means, how to find an angle, and where projections come from.

The dot product of two vectors is the sum of the products of matching components. For vectors
aandb, the formula isa · b = a1*b1 + a2*b2 + ... + an*bn. The answer is one number that measures alignment, not another vector.
Use the dot product calculator when you want the arithmetic, angle, and step-by-step work checked automatically.
Dot product formula
For two vectors with the same number of components, multiply each matching pair and add the results. That rule works in 2D, 3D, and any higher dimension.
The vectors must have the same dimension because every component in the first vector needs a partner in the second vector.
How to calculate the dot product step by step
The safest manual process is short: line up the vectors, multiply matching entries, then add the products. Most mistakes happen when a negative sign gets dropped or when someone forgets the final addition.
Step 1: multiply matching components
6·3, (−1)·4, 2·5
Step 2: add the products
18 − 4 + 10 = 24
Answer: a · b = 24The result is a scalar. If you ended with a vector like (18, -4, 10), you stopped one step too early.
What the dot product means
The dot product measures how much two vectors point in the same direction. A large positive result means strong alignment. A result near zero means little alignment. A negative result means the vectors lean in opposite directions.
a · b > 0 → angle is less than 90°
a · b = 0 → vectors are perpendicular
a · b < 0 → angle is greater than 90°This is why the dot product is useful even before you calculate an exact angle. The sign alone tells you the rough geometry.
Geometric formula and angle
The component formula is not the only way to describe the dot product. It also equals the product of the two vector lengths and the cosine of the angle between them.
That formula lets you solve for the angle when you already know the dot product and both vector lengths.
For example, take a = (3, 4) and b = (4, 0). Their dot product is 12, their lengths are 5 and 4, and the cosine of the angle is 12 / 20 = 0.6.
a · b = 3·4 + 4·0 = 12 |a| = √(3² + 4²) = 5 |b| = √(4² + 0²) = 4 cos(θ) = 12 / (5·4) = 0.6 θ ≈ 53.13°
Projection and work
A projection asks how much of one vector lies in the direction of another. The scalar projection of a onto b divides the dot product by the length of b.
That is the same idea behind the physics formula for work. Only the part of the force that points in the direction of motion contributes to work.
The same alignment idea also appears in computer graphics, where lighting depends on the dot product between a surface normal and a light direction.
Dot product rules
A few rules make dot products easier to simplify. The order does not matter, the dot product distributes over vector addition, and a vector dotted with itself gives its length squared.
The self-dot rule is especially useful. If a = (3, 4), then a · a = 3² + 4² = 25, so |a| = 5.
Dot product vs cross product vs inner product
The dot product and scalar product are two names for the same operation. Both return one number.
The cross product is different. It only applies to 3D vectors and returns a vector perpendicular to both inputs.
An inner product is the broader idea. The standard dot product is the usual inner product on real coordinate vectors, but inner products can also be weighted or defined for functions. For the abstract version, read the inner product guide.
Common mistakes
Using vectors with different dimensions. A 2D vector and a 3D vector cannot be paired component by component, so their dot product is undefined.
Stopping before the addition. Pairwise products are only the middle step. The final answer is the sum of those products.
(2, 3) · (4, 5)
wrong: (8, 15)
right: 8 + 15 = 23Reading a negative answer as a negative length. The dot product can be negative because it measures direction as well as size. Lengths are never negative, but dot products can be.
Mixing up the dot and cross products. Dot product returns a scalar. Cross product returns a vector.
The takeaway
Multiply matching components, add the products, and read the sign. Positive means the vectors generally point the same way, zero means perpendicular, and negative means they point more in opposite directions. From that same number you can find angles, projections, and work.
Common questions
It is one number found by multiplying matching vector components and adding the products. For a = (a1, a2, ..., an) and b = (b1, b2, ..., bn), the dot product is a1*b1 + a2*b2 + ... + an*bn.
A dot product of zero means the vectors are perpendicular, also called orthogonal. Their alignment cancels out exactly, so the angle between them is 90 degrees.
Yes. A negative dot product means the angle between the vectors is greater than 90 degrees, so they point more away from each other than toward each other.
Yes. Dot product and scalar product are the same operation. The name scalar product emphasizes that the result is a scalar, not a vector.
Calculate the dot product, calculate each vector's length, then use θ = arccos((a · b) / (|a| · |b|)). The dot product calculator shows those steps automatically.


