Key facts
- Dot product: a · b = a₁b₁ + a₂b₂ + a₃b₃, the sum of the products of matching components.
- For a = ⟨1, 2, 3⟩ and b = ⟨4, −5, 6⟩, a · b = 4 − 10 + 18 = 12.
- Geometrically, a · b = |a| |b| cos θ, so the sign tells you the angle: positive is acute, zero is a right angle, negative is obtuse.
- Two non-zero vectors are perpendicular (orthogonal) exactly when their dot product is 0.
- The dot product is commutative (a · b = b · a) and returns a scalar, unlike the cross product, which returns a vector.
What the dot product measures
The dot product tells you how much two vectors point in the same direction. If they point the same way, the product is large and positive; if they are at right angles, it is zero; if they point in opposite directions, it is negative. That makes it the standard tool for finding angles between vectors, testing for perpendicular lines, projecting one vector onto another and computing work in physics.
How to use the dot product calculator
- Choose 2D or 3D vectors.
- Enter the x, y (and z) components of vectors a and b.
- Read the dot product with the working, the magnitudes, the angle, the projections and whether the vectors are acute, obtuse or perpendicular.
Formulas for the dot product
a · b = a₁b₁ + a₂b₂ + a₃b₃a · b = |a| |b| cos θScalar projection of a on b = a · b ÷ |b|, Vector projection = (a · b ÷ |b|²) bWorked examples: the dot product
Example 1: two 3D vectors
a = ⟨1, 2, 3⟩, b = ⟨4, −5, 6⟩. a · b = 1 × 4 + 2 × (−5) + 3 × 6 = 4 − 10 + 18 = 12. The magnitudes are √14 ≈ 3.742 and √77 ≈ 8.775, so cos θ = 12 ÷ (3.742 × 8.775) ≈ 0.3655 and θ ≈ 68.56°.
Example 2: checking for a right angle
a = ⟨3, 4⟩, b = ⟨4, −3⟩. a · b = 12 − 12 = 0, so the vectors are perpendicular.
Example 3: work done by a force
A force of 10 N pulls a box 5 m along the floor at 60° to the direction of motion. Work = F · d = |F| |d| cos θ = 10 × 5 × cos 60° = 25 J. Only the part of the force along the motion does work.
What the sign tells you
| a · b | Angle between a and b | Meaning |
|---|---|---|
| Positive | Less than 90° | Pointing broadly the same way |
| Zero | Exactly 90° | Perpendicular (orthogonal) |
| Negative | More than 90° | Pointing broadly opposite ways |
Properties worth knowing
- Commutative: a · b = b · a.
- Distributive: a · (b + c) = a · b + a · c.
- Scalars pull out: (k a) · b = k (a · b).
- Length: a · a = |a|², which is how vector length is defined.
- Unit vectors: for unit vectors, the dot product equals the cosine of the angle between them.
Projections
The scalar projection of a onto b is the length of a's shadow on the line of b. In Example 1 it is 12 ÷ √77 ≈ 1.368. The vector projection is that length pointed along b: (12 ÷ 77) × ⟨4, −5, 6⟩ = ⟨48/77, −60/77, 72/77⟩. Projections are used to split forces into components, to find the closest point on a line and in least-squares fitting.
Dot product vs cross product
The dot product returns a number and works in any dimension. The cross product returns a vector perpendicular to both inputs and only exists in three dimensions. Use the dot product for angles and projections, and the cross product for normals, areas and torque. To go straight to the angle, use the angle between two vectors calculator.
Where it shows up
Computer graphics use dot products to work out how brightly a surface is lit (Lambert's cosine law). Machine learning uses them for cosine similarity between text or image embeddings. In physics they give work, power and flux, and in statistics the correlation between centred data sets is a normalized dot product.
The dot product and the birth of vector analysis
The vectors and dot products taught today were shaped in the 1880s by the American physicist Josiah Willard Gibbs at Yale and the English engineer Oliver Heaviside, working separately. Both simplified the quaternions that William Rowan Hamilton had discovered in 1843, famously carving the key formula into Broom Bridge in Dublin. Gibbs’s lecture notes became the 1901 textbook *Vector Analysis* by his student Edwin Bidwell Wilson, which fixed the notation a · b.
The dot product measures how much two vectors point the same way: a · b = |a||b| cos θ. It is zero for perpendicular vectors, which makes it the standard test for right angles in any number of dimensions. In physics, work equals force · displacement, so pushing at an angle wastes effort. In computer graphics, Lambert’s cosine law, published by Johann Heinrich Lambert in *Photometria* in 1760, sets the brightness of a matte surface by the dot product of its normal and the light direction. Search engines and recommendation systems compare items with cosine similarity, a normalized dot product. In US high schools, Common Core standard N-VM.A.1 introduces vector quantities with magnitude and direction. Each entry of a matrix product is the dot product of a row of one matrix with a column of the other. For the angle itself, use the angle between vectors calculator; for a perpendicular vector, the cross product calculator; and for lengths, the vector magnitude calculator.
How this calculator works
- Enter vectors as comma- or space-separated components, in 2D or 3D.
- Shows each step with your numbers, plus exact radical forms where the inputs are whole numbers.
- a · b = a₁b₁ + a₂b₂ (+ a₃b₃), shown term by term.
- Also gives both magnitudes, the angle between the vectors, whether they are perpendicular, parallel or neither, and the scalar and vector projections of a onto b.
Frequently asked questions
How do you calculate a dot product?
Multiply the matching components and add the results: a · b = a₁b₁ + a₂b₂ + a₃b₃. For ⟨1, 2, 3⟩ and ⟨4, −5, 6⟩ that is 4 − 10 + 18 = 12.
What does a dot product of 0 mean?
The vectors are perpendicular (orthogonal), as long as neither is the zero vector.
Is the dot product a vector or a number?
A number (a scalar). That is why it is also called the scalar product.
Can the dot product be negative?
Yes. It is negative when the angle between the vectors is more than 90°.
How is the dot product related to the angle?
a · b = |a| |b| cos θ, so θ = arccos(a · b ÷ (|a| |b|)).
Is the dot product commutative?
Yes. a · b always equals b · a.
What is the dot product of a vector with itself?
The square of its length: a · a = |a|².
What is the difference between the dot and cross product?
The dot product gives a number and measures alignment. The cross product gives a vector perpendicular to both inputs and measures the area they span.