What Is the Dot Product?
The dot product of two vectors $\vec{a}$ and $\vec{b}$ is a scalar — a single number — equal to the product of their magnitudes and the cosine of the angle between them. It is also called the scalar product, precisely because the answer is a scalar and not a vector. It is written with a centred dot, $\vec{a} \cdot \vec{b}$, which is where the name comes from.
Unlike adding or subtracting vectors, the dot product does not give you back a vector. It gives a number that measures direction-agreement: positive when the vectors point broadly the same way, negative when they point apart, and exactly zero when they meet at a right angle. The dot product is one of the two ways to take a product of vectors — the other being the cross product, which returns a vector instead.
What Is the Dot Product Formula?
There are two formulas, and they always give the same answer. Which one you use depends on what the problem hands you.
Geometric form — use it when you know the magnitudes and the angle:
$$\vec{a} \cdot \vec{b} = |\vec{a}|,|\vec{b}|\cos\theta,$$
where $|\vec{a}|$ and $|\vec{b}|$ are the magnitudes (lengths) of the vectors and $\theta$ is the angle between them.
Component form — use it when you know the coordinates. For $\vec{a} = (a_1, a_2, a_3)$ and $\vec{b} = (b_1, b_2, b_3)$:
$$\vec{a} \cdot \vec{b} = a_1 b_1 + a_2 b_2 + a_3 b_3.$$
Multiply matching components, add the results. In two dimensions you simply drop the third term. The two formulas are connected by the law of cosines, which is also why the dot product quietly proves the Pythagorean theorem when the vectors are perpendicular.
Why is there a cosine in the dot product?
Because cosine is the function that measures agreement. At $0°$ (same direction) $\cos\theta = 1$, the largest value — full agreement. At $90°$ (perpendicular) $\cos\theta = 0$ — no agreement. At $180°$ (opposite) $\cos\theta = -1$ — full disagreement. The cosine slides smoothly from $+1$ down to $-1$ as the vectors swing apart, so $|\vec{a}||\vec{b}|\cos\theta$ reads off exactly how aligned they are, scaled by their lengths.
How Do You Find the Angle Between Two Vectors?
Rearrange the geometric formula to solve for the angle. Since $\vec{a}\cdot\vec{b} = |\vec{a}||\vec{b}|\cos\theta$, dividing both sides by the magnitudes isolates the cosine:
$$\cos\theta = \frac{\vec{a}\cdot\vec{b}}{|\vec{a}|,|\vec{b}|}, \qquad \theta = \arccos!\left(\frac{\vec{a}\cdot\vec{b}}{|\vec{a}|,|\vec{b}|}\right).$$
Compute the dot product from components, compute each magnitude, divide, and take the inverse cosine. This single relationship is why the dot product is the standard tool for "find the angle between" problems — Example 4 below works one end to end.
What Is Vector Projection?
The projection of $\vec{a}$ onto $\vec{b}$ is the shadow $\vec{a}$ casts along the direction of $\vec{b}$ — how much of $\vec{a}$ points the way $\vec{b}$ does. It comes in two flavours.
Scalar projection (the length of the shadow): $$\text{comp}_{\vec{b}}\vec{a} = \frac{\vec{a}\cdot\vec{b}}{|\vec{b}|}.$$
Vector projection (the shadow as an actual vector): $$\text{proj}_{\vec{b}}\vec{a} = \left(\frac{\vec{a}\cdot\vec{b}}{|\vec{b}|^2}\right)\vec{b}.$$
The work example from the hook is a projection in disguise: the part of the force that does work is the projection of the force onto the direction of motion. Projection is where the dot product stops being a definition and starts being a workhorse — it powers everything from physics work calculations to the cosine similarity behind search and recommendation systems.
What Are the Properties of the Dot Product?
The dot product obeys a short, clean list of rules. Each one is worth knowing because it lets you rearrange expressions without recomputing from scratch.
Commutative: $\vec{a}\cdot\vec{b} = \vec{b}\cdot\vec{a}$. Order doesn't matter — unlike the cross product.
Distributive over addition: $\vec{a}\cdot(\vec{b}+\vec{c}) = \vec{a}\cdot\vec{b} + \vec{a}\cdot\vec{c}$.
Scalar multiplication: $(k\vec{a})\cdot\vec{b} = k(\vec{a}\cdot\vec{b})$ for any scalar $k$.
Self-dot gives magnitude squared: $\vec{a}\cdot\vec{a} = |\vec{a}|^2$. This is how the dot product computes lengths.
Zero for perpendicular vectors: $\vec{a}\cdot\vec{b} = 0$ when $\vec{a}$ and $\vec{b}$ are orthogonal (and neither is zero).
Unit vectors: $\hat{i}\cdot\hat{i} = \hat{j}\cdot\hat{j} = \hat{k}\cdot\hat{k} = 1$, while $\hat{i}\cdot\hat{j} = \hat{j}\cdot\hat{k} = \hat{i}\cdot\hat{k} = 0$. These six facts are what the component formula is built from.
Examples of Dot Product
The examples build from a plain component calculation, through perpendicularity and the most common sign mistake, to an angle, a projection, and finally a real-world work computation.
Example 1
Find the dot product of $\vec{a} = (2, 3, 1)$ and $\vec{b} = (4, -1, 5)$.
Multiply matching components and add:
$$\vec{a}\cdot\vec{b} = (2)(4) + (3)(-1) + (1)(5) = 8 - 3 + 5 = 10.$$
Final answer: $\vec{a}\cdot\vec{b} = 10$. Positive, so the two vectors point broadly the same way.
Example 2
A common slip — find $\vec{a}\cdot\vec{b}$ for $\vec{a} = (3, -2)$ and $\vec{b} = (-1, 4)$.
Wrong attempt. A student multiplies the components but drops the sign on the second term, treating $-2$ and $4$ as if both were positive: $(3)(-1) + (2)(4) = -3 + 8 = 5$. The answer looks reasonable, which is exactly why the error survives.
Test it against meaning. Both vectors have a large component pulling in opposite directions ($+x$ vs $-x$, and the signs in the second slot disagree once read correctly), so a result this positive is suspicious.
Correct. Keep every sign:
$$\vec{a}\cdot\vec{b} = (3)(-1) + (-2)(4) = -3 - 8 = -11.$$
Final answer: $\vec{a}\cdot\vec{b} = -11$. The negative sign says the vectors point more apart than together — which matches the geometry.
Example 3
Are $\vec{a} = (2, -1, 3)$ and $\vec{b} = (1, 5, 1)$ perpendicular?
A zero dot product means perpendicular. Compute it:
$$\vec{a}\cdot\vec{b} = (2)(1) + (-1)(5) + (3)(1) = 2 - 5 + 3 = 0.$$
Final answer: the dot product is $0$, so yes — the vectors are perpendicular. This is faster than finding the angle directly.
Example 4
Find the angle between $\vec{a} = (1, 2, 2)$ and $\vec{b} = (2, 0, 1)$.
Dot product: $\vec{a}\cdot\vec{b} = (1)(2) + (2)(0) + (2)(1) = 4$. Magnitudes: $|\vec{a}| = \sqrt{1 + 4 + 4} = 3$ and $|\vec{b}| = \sqrt{4 + 0 + 1} = \sqrt{5}$. Then:
$$\cos\theta = \frac{4}{3\sqrt{5}} \approx 0.596, \qquad \theta = \arccos(0.596) \approx 53.4°.$$
Final answer: $\theta \approx 53.4°$.
Example 5
Find the scalar and vector projection of $\vec{a} = (4, 3)$ onto $\vec{b} = (2, 0)$.
Dot product: $\vec{a}\cdot\vec{b} = (4)(2) + (3)(0) = 8$. Magnitude of $\vec{b}$: $|\vec{b}| = 2$, so $|\vec{b}|^2 = 4$. Scalar projection:
$$\text{comp}_{\vec{b}}\vec{a} = \frac{8}{2} = 4.$$
Vector projection:
$$\text{proj}_{\vec{b}}\vec{a} = \frac{8}{4}(2, 0) = 2(2, 0) = (4, 0).$$
Final answer: scalar projection $4$, vector projection $(4, 0)$. Since $\vec{b}$ lies along the $x$-axis, the shadow of $\vec{a}$ is just its $x$-component — a useful sanity check.
Example 6
A force $\vec{F} = (12, 5)$ newtons moves an object along displacement $\vec{d} = (3, 0)$ metres. Find the work done.
Work is force dotted with displacement, $W = \vec{F}\cdot\vec{d}$:
$$W = (12)(3) + (5)(0) = 36 + 0 = 36 \text{ J}.$$
Final answer: $36$ joules. Only the part of the force along the motion does work — the $5$-newton vertical component contributes nothing, which the dot product handles automatically by multiplying it against the zero $y$-displacement.
Why the Dot Product Earns Its Place
"How much of this effort actually moves the load?"
The dot product was distilled, alongside the cross product, from the quaternions that William Rowan Hamilton (1805–1865, Ireland) built in 1843. By the 1880s Josiah Willard Gibbs had separated out the clean scalar product we use now, because physics kept needing the same single number — how much one quantity acts along another.
Where it does real work today:
Physics — work and energy. Work is the dot product of force and displacement. The angled-sled calculation in Example 6 is the everyday version; the same formula sizes the energy a rocket's thrust delivers along its flight path.
Computer graphics and lighting. A surface looks bright when its normal vector points toward the light. The dot product of the two sets the brightness — every shaded pixel in a 3D game is, underneath, a dot product.
Machine learning and search. Cosine similarity — the dot product of two normalised vectors — measures how alike two documents, images, or word-embeddings are. It is the arithmetic behind "find me more like this."
Geometry and navigation. Testing perpendicularity, finding angles, computing distances between mapped points — all run on the dot product.
Where Students Trip Up on the Dot Product
Mistake 1: Expecting a vector instead of a scalar
Where it slips in: A student finishes a dot product and writes the answer as a vector, like $(8, -3, 5)$, instead of summing to a single number.
Don't do this: Leave the three products as a triple. The dot product is defined to collapse them into one scalar.
The correct way: Add the three products into a single number: $8 - 3 + 5 = 10$. The result of a dot product is always a scalar.
Mistake 2: Dropping a negative sign
Where it slips in: Multiplying components when one or more is negative, the rusher writes $(3)(-1) + (2)(4)$ instead of $(3)(-1) + (-2)(4)$.
Don't do this: Treat a negative component as positive once it's inside the multiplication.
The correct way: Carry every sign through. $(3)(-1) + (-2)(4) = -3 - 8 = -11$. A single dropped sign can flip the result from negative to positive and reverse the geometric conclusion entirely.
Mistake 3: Confusing the perpendicular and parallel conditions
Where it slips in: Reasoning that a zero dot product means the vectors are parallel.
Don't do this: Pair "zero" with "parallel." That's the cross product's rule, not the dot product's.
The correct way: A zero dot product means perpendicular ($\cos 90° = 0$). The dot product is largest for parallel vectors, not zero. The second-guesser who has just studied the cross product flips these under pressure — anchoring on "cosine peaks when aligned" keeps it straight.
Key Takeaways
The dot product of two vectors is a scalar: $\vec{a}\cdot\vec{b} = |\vec{a}||\vec{b}|\cos\theta = a_1 b_1 + a_2 b_2 + a_3 b_3$.
Use the geometric form when you have magnitudes and an angle; use the component form when you have coordinates.
A zero dot product means the vectors are perpendicular; a positive one means an acute angle, a negative one an obtuse angle.
Rearranging the formula gives the angle between two vectors via $\cos\theta = \tfrac{\vec{a}\cdot\vec{b}}{|\vec{a}||\vec{b}|}$.
Vector projection — how much of one vector lies along another — is built directly on the dot product.
The dot product powers work calculations, 3D lighting, and the cosine similarity behind search and recommendation systems.
Practice These Before Moving On
Find the dot product of $\vec{a} = (1, -3, 2)$ and $\vec{b} = (4, 1, -2)$.
Find the angle between $\vec{a} = (1, 0)$ and $\vec{b} = (1, \sqrt{3})$.
Find the vector projection of $\vec{a} = (5, 2)$ onto $\vec{b} = (0, 4)$.
Answer to Question 1: $4 - 3 - 4 = -3$. Answer to Question 2: $\cos\theta = \tfrac{1}{2}$, so $\theta = 60°$. Answer to Question 3: $(0, 2)$. If Question 1 came out positive, return to Mistake 2 and recheck your signs.
Want a live Bhanzu trainer to walk through more dot product problems? Book a free demo class — online globally.
Was this article helpful?
Your feedback helps us write better content
