In short
The dot product (scalar product) of two vectors \vec{A} and \vec{B} is \vec{A} \cdot \vec{B} = |\vec{A}||\vec{B}|\cos\theta, where \theta is the angle between them. In component form: \vec{A} \cdot \vec{B} = A_x B_x + A_y B_y + A_z B_z. The result is a scalar, not a vector. Two vectors are perpendicular if and only if their dot product is zero. The most important application: work done by a force is W = \vec{F} \cdot \vec{d} = Fd\cos\theta.
You are at a railway station, dragging a heavy suitcase across the platform to catch a train. The handle is at an angle — you are pulling upward and forward at the same time. Common sense tells you that only the forward part of your pull actually moves the suitcase forward. The upward part lifts against gravity but does not move the suitcase along the platform. So if someone asked "how much of your force is actually doing the job of moving the suitcase?", the answer is not the full force — it is the piece of the force that points in the direction the suitcase is moving.
That "piece of the force in the direction of motion" is exactly what the dot product calculates. It takes two vectors — your force and the displacement of the suitcase — and returns a single number that captures how much one vector acts along the other. That number is not a vector. It has no direction. It is a pure scalar, which is why this operation is called the scalar product.
The dot product shows up everywhere in physics: work, power, flux, the angle between two directions, testing whether two vectors are perpendicular. Every time you need to ask "how much of this vector points along that vector?", the answer is a dot product.
The geometry: projection
Before writing any formula, look at what the dot product is doing geometrically.
Take two vectors \vec{A} and \vec{B} placed tail-to-tail, with an angle \theta between them. Drop a perpendicular from the tip of \vec{A} onto the line of \vec{B}. The foot of that perpendicular marks a length along \vec{B} — this length is called the projection of \vec{A} onto \vec{B}, and it equals |\vec{A}|\cos\theta.
Think of it as a shadow. If you shine a light straight down (perpendicular to \vec{B}), the shadow of \vec{A} on the line of \vec{B} has length |\vec{A}|\cos\theta. When \theta = 0 (the vectors point in the same direction), the shadow is the full length of \vec{A}. When \theta = 90°, the shadow has zero length — \vec{A} is perpendicular to \vec{B} and contributes nothing along it.
The dot product takes this projection and multiplies it by the magnitude of \vec{B}:
Why multiply by |\vec{B}|: The projection |\vec{A}|\cos\theta tells you how much of \vec{A} points along \vec{B}, but it does not know how long \vec{B} is. Multiplying by |\vec{B}| scales the result so that both magnitudes matter symmetrically — the dot product is just as much "the projection of \vec{B} onto \vec{A}, times |\vec{A}|" as it is the other way around.
Scalar (dot) product
The scalar product (or dot product) of two vectors \vec{A} and \vec{B} is
where \theta is the angle between \vec{A} and \vec{B} when placed tail-to-tail, and 0° \leq \theta \leq 180°.
The result is a scalar — a single number with no direction.
Reading the definition. |\vec{A}| is the magnitude (length) of \vec{A}. |\vec{B}| is the magnitude of \vec{B}. \cos\theta encodes the alignment between them: it equals 1 when they are parallel (\theta = 0°), 0 when they are perpendicular (\theta = 90°), and -1 when they are anti-parallel (\theta = 180°). So the dot product is largest when the vectors are aligned, zero when they are at right angles, and negative when they point in roughly opposite directions.
Notice how the \cos\theta factor does all the work of extracting "how much of one vector points along the other." The magnitudes just scale the answer.
The dot product in component form
The geometric definition is elegant, but in practice you rarely know the angle \theta between two vectors. You usually know their components. So you need a way to compute the dot product from components alone — and deriving this form teaches you something about unit vectors along the way.
Write the two vectors in component form using the unit vectors \hat{i}, \hat{j}, \hat{k}:
To find \vec{A} \cdot \vec{B}, use the distributive property (which you will prove in the next section) and expand:
Why: treat the dot product like multiplication — each term in the first bracket dots with each term in the second. This gives nine terms.
Now apply the geometric definition to the unit vector dot products. Each unit vector has magnitude 1, and the angles between them are known:
- \hat{i}\cdot\hat{i} = |\hat{i}||\hat{i}|\cos 0° = 1 \times 1 \times 1 = 1. Similarly, \hat{j}\cdot\hat{j} = 1 and \hat{k}\cdot\hat{k} = 1.
Why: any unit vector dotted with itself gives \cos 0° = 1. The vector is perfectly aligned with itself.
- \hat{i}\cdot\hat{j} = |\hat{i}||\hat{j}|\cos 90° = 1 \times 1 \times 0 = 0. Similarly, \hat{j}\cdot\hat{k} = 0 and \hat{i}\cdot\hat{k} = 0.
Why: the coordinate axes are perpendicular to each other, so the angle between any two different unit vectors is 90°, and \cos 90° = 0.
Six of the nine terms vanish. The three survivors are the terms where the same unit vector appears on both sides:
Why this is powerful: you no longer need to know the angle \theta. Given the components of two vectors, you multiply corresponding components and add. Three multiplications and two additions — that is the entire calculation.
This is the component form of the dot product. It is equivalent to the geometric form; they give the same number. The component form is what you will use in almost every calculation.
Finding the angle between two vectors
Combining the two forms gives you a tool for finding angles. Since both forms give the same result:
Solve for \cos\theta:
Why: you used the component form to compute the numerator and the magnitude formula to compute the denominator. The angle \theta drops out from the geometric form. This is the standard method for finding the angle between two vectors when you know their components.
This formula is the reason the dot product matters in geometry. Given any two vectors in 2D or 3D, you can find the angle between them without drawing anything — just plug in the components.
Properties of the dot product
1. Commutative: \vec{A} \cdot \vec{B} = \vec{B} \cdot \vec{A}
From the definition: |\vec{A}||\vec{B}|\cos\theta = |\vec{B}||\vec{A}|\cos\theta. Multiplication of real numbers is commutative, so the order does not matter.
Why this matters: unlike the cross product (which flips sign when you swap the order), the dot product does not care which vector comes first.
2. Distributive: \vec{A} \cdot (\vec{B} + \vec{C}) = \vec{A} \cdot \vec{B} + \vec{A} \cdot \vec{C}
This is the property that let you expand the nine-term product earlier. To see why it holds, think in terms of projections. The projection of (\vec{B} + \vec{C}) onto \vec{A} is the sum of the individual projections — adding the vectors first and then projecting gives the same result as projecting each one separately and then adding. The distributive law is the algebraic statement of this geometric fact.
Why this matters: it lets you expand dot products involving sums of vectors, just like expanding brackets in ordinary algebra. Without this property, the component form derivation above would not work.
3. Scalar multiplication: (c\vec{A}) \cdot \vec{B} = c(\vec{A} \cdot \vec{B})
If you scale a vector by a constant c, its magnitude gets multiplied by |c| and (if c is negative) its direction reverses. The dot product scales linearly:
When c > 0, \theta' = \theta and this equals c|\vec{A}||\vec{B}|\cos\theta = c(\vec{A}\cdot\vec{B}). When c < 0, the direction of \vec{A} reverses so \theta' = 180° - \theta, and \cos(180° - \theta) = -\cos\theta. This gives |c||\vec{A}||\vec{B}|(-\cos\theta) = c(\vec{A}\cdot\vec{B}), since c = -|c|.
4. Dot product with itself: \vec{A} \cdot \vec{A} = |\vec{A}|^2
Set \vec{B} = \vec{A} in the definition. The angle between a vector and itself is 0°, so \cos 0° = 1:
Why this is useful: it connects the dot product to the magnitude. You can always find the length of a vector by taking |\vec{A}| = \sqrt{\vec{A}\cdot\vec{A}}. In component form: |\vec{A}| = \sqrt{A_x^2 + A_y^2 + A_z^2}.
5. Zero when perpendicular: \vec{A} \cdot \vec{B} = 0 \iff \vec{A} \perp \vec{B}
When \theta = 90°, \cos 90° = 0, so \vec{A} \cdot \vec{B} = 0. And conversely, if \vec{A} \cdot \vec{B} = 0 (and neither vector is the zero vector), then \cos\theta = 0, which means \theta = 90°. The vectors are perpendicular.
This is the perpendicularity test. To check whether two vectors are at right angles, compute their dot product. If it is zero, they are perpendicular. No trigonometry, no protractor, no drawing — just arithmetic.
Summary table
| Property | Statement | Notes |
|---|---|---|
| Commutative | \vec{A} \cdot \vec{B} = \vec{B} \cdot \vec{A} | Order does not matter |
| Distributive | \vec{A} \cdot (\vec{B} + \vec{C}) = \vec{A}\cdot\vec{B} + \vec{A}\cdot\vec{C} | Brackets expand like ordinary algebra |
| Scalar factor | (c\vec{A})\cdot\vec{B} = c(\vec{A}\cdot\vec{B}) | Constants slide out |
| Self-dot | $\vec{A}\cdot\vec{A} = | \vec{A} |
| Perpendicular | \vec{A}\cdot\vec{B} = 0 \iff \vec{A} \perp \vec{B} | The perpendicularity test |
| Parallel (same) | $\vec{A}\cdot\vec{B} = | \vec{A} |
| Anti-parallel | $\vec{A}\cdot\vec{B} = - | \vec{A} |
Work done by a force — the dot product in action
The single most important application of the dot product in mechanics is the definition of work.
Imagine you are pushing a heavy almirah across a room. You push with a force \vec{F} and the almirah slides through a displacement \vec{d}. If your force is exactly in the direction of motion, every bit of your effort goes into moving the almirah. But if your force is at an angle — say you are pushing partly downward — only the component of force along the direction of motion does work. The component perpendicular to the motion just presses the almirah into the floor.
The work done by the force is:
Why \cos\theta: the factor F\cos\theta is the component of \vec{F} in the direction of \vec{d}. Only this component contributes to moving the object. The perpendicular component F\sin\theta pushes the object into the floor (or lifts it off the floor) but does not displace it forward.
Three special cases make this concrete:
-
\theta = 0° (force in the direction of motion): W = Fd. All of your effort goes into moving the object. Example: dragging a boat along a canal with the rope horizontal.
-
\theta = 90° (force perpendicular to motion): W = 0. You exert a force but do no work. Example: carrying a heavy bag while walking on a level road — gravity pulls the bag down, you walk forward, and gravity does zero work because the force (downward) is perpendicular to the displacement (horizontal).
-
\theta = 180° (force opposite to motion): W = -Fd. The force opposes the motion. Example: friction on the almirah as you push it — friction points backward while the almirah moves forward, so friction does negative work (removes energy from the almirah).
Worked examples
Example 1: Work done pulling a suitcase at a railway station
A passenger pulls a 20 kg suitcase across a platform with a force of 40 N at an angle of 30° above the horizontal. The suitcase travels 50 m. How much work does the pulling force do?
Step 1. Write down what you know.
F = 40 N, d = 50 m, \theta = 30° (angle between force and displacement).
Why: the displacement is horizontal (the suitcase moves along the platform), and the force makes a 30° angle with the horizontal. So \theta = 30° is the angle between the force vector and the displacement vector.
Step 2. Apply the work formula.
Why: \cos 30° = \sqrt{3}/2 \approx 0.866. The full force is 40 N, but only 40 \times 0.866 = 34.6 N acts in the direction of motion. This effective force acts over 50 m, giving 1732 J of work.
Step 3. Check the limiting cases.
If the passenger pulled horizontally (\theta = 0°), the work would be 40 \times 50 = 2000 J. At 30°, the work is 1732 J — about 87% of the maximum. If they pulled straight up (\theta = 90°), the work would be zero — the suitcase would not move forward at all.
Result: The pulling force does 1732 J of work.
What this shows: Pulling at an angle costs you efficiency. About 13% of the force is wasted lifting the suitcase instead of moving it forward. The dot product captures this automatically through the \cos\theta factor — you do not need to resolve forces into components separately. The formula W = Fd\cos\theta does it in one step.
Example 2: Finding the angle between two vectors
Two vectors are given: \vec{A} = 3\hat{i} + 4\hat{j} and \vec{B} = -2\hat{i} + 5\hat{j}. Find the angle between them.
Step 1. Compute the dot product using components.
Why: multiply corresponding components — x with x, y with y — and add. The x-components contribute -6 (they point in opposite directions along x), the y-components contribute +20 (both point upward).
Step 2. Compute the magnitudes.
Step 3. Find \cos\theta.
Why: the formula gives \cos\theta directly from the dot product and magnitudes. A positive value means \theta < 90° — the vectors are less than a right angle apart.
Step 4. Find \theta.
Result: The angle between \vec{A} = 3\hat{i} + 4\hat{j} and \vec{B} = -2\hat{i} + 5\hat{j} is approximately 58.7°.
What this shows: Even though \vec{A} and \vec{B} point into different quadrants, the dot product formula finds the angle between them purely from arithmetic — no protractor, no careful drawing required. The positive dot product (14) immediately tells you the angle is acute, before you even compute it.
Common confusions
-
"The dot product gives a vector." No — the dot product of two vectors is always a scalar (a plain number). That is the whole point of calling it the "scalar product." If you want an operation that gives a vector from two vectors, that is the cross product.
-
"\vec{A}\cdot\vec{B} = AB." Only when \theta = 0° (the vectors are parallel and in the same direction). In general, \vec{A}\cdot\vec{B} = AB\cos\theta. Forgetting the \cos\theta is the most common error in work calculations — it makes you overestimate the work done by a force that is not in the direction of motion.
-
"A negative dot product means the vectors are perpendicular." No — a negative dot product means the angle between the vectors is greater than 90° (they point in roughly opposite directions). Perpendicular vectors have a dot product of exactly zero, not a negative number.
-
"You can dot a vector with a scalar." The dot product is defined only between two vectors. Writing \vec{A} \cdot 5 is meaningless. If you want to scale a vector by a number, that is ordinary scalar multiplication: 5\vec{A}.
-
"Work is always positive." Work can be negative. When the force opposes the displacement (\theta > 90°), \cos\theta < 0 and the work is negative. Friction always does negative work — it opposes motion, so the angle between friction and displacement is 180°, and \cos 180° = -1.
-
"If the dot product is zero, one of the vectors must be zero." Not necessarily. Two nonzero vectors can have a zero dot product — they just need to be perpendicular. The vectors 3\hat{i} + 4\hat{j} and 4\hat{i} - 3\hat{j} are both nonzero, but their dot product is 3(4) + 4(-3) = 12 - 12 = 0. They are at right angles.
If you came here to understand what the dot product is, how to compute it, and how it connects to work, you have everything you need. What follows is for readers who want the dot product in n dimensions and a formal proof of the perpendicularity test.
The dot product in n dimensions
Nothing in the component form \vec{A}\cdot\vec{B} = A_x B_x + A_y B_y + A_z B_z depends on there being exactly three dimensions. The pattern generalises immediately: for vectors in n dimensions,
This is not just a mathematical curiosity. In machine learning and data science, vectors with hundreds or thousands of components are routine — a word embedding might be a vector in 300-dimensional space — and the dot product is how you measure similarity between them. The formula is the same: multiply corresponding components and add.
The angle formula also generalises:
This always gives a value between -1 and 1 (a consequence of the Cauchy–Schwarz inequality), so \theta is well-defined even in high dimensions.
The perpendicularity test — a formal proof
You want to prove: if \vec{A}\cdot\vec{B} = 0 and neither \vec{A} nor \vec{B} is the zero vector, then \vec{A} and \vec{B} are perpendicular.
Start from the geometric definition:
Since |\vec{A}| > 0 and |\vec{B}| > 0 (neither is the zero vector), you can divide both sides by |\vec{A}||\vec{B}|:
Why: a product of real numbers is zero if and only if at least one factor is zero. You have ruled out |\vec{A}| = 0 and |\vec{B}| = 0, so the only remaining factor that can be zero is \cos\theta.
The solutions to \cos\theta = 0 in the range 0° \leq \theta \leq 180° are:
Why: in the restricted range [0°, 180°], \cos\theta = 0 has exactly one solution: \theta = 90°. The angle between two vectors is always defined in this range, so there is no ambiguity.
Therefore \vec{A} \perp \vec{B}.
The converse is immediate: if \theta = 90°, then \cos\theta = 0, so \vec{A}\cdot\vec{B} = |\vec{A}||\vec{B}| \times 0 = 0.
Using the dot product to decompose a vector
Given a vector \vec{A} and a direction specified by a unit vector \hat{n}, the component of \vec{A} along \hat{n} is:
Why: since |\hat{n}| = 1, the dot product \vec{A}\cdot\hat{n} = |\vec{A}||\hat{n}|\cos\theta simplifies to |\vec{A}|\cos\theta, which is the projection of \vec{A} along \hat{n}.
The projection vector (the actual vector along \hat{n}) is:
And the perpendicular component is:
This decomposition is used everywhere in physics — resolving gravity along and perpendicular to an inclined plane, finding the component of velocity along a particular direction, decomposing electric fields into normal and tangential components at a surface.
Dot product and the law of cosines
The dot product is secretly related to the law of cosines. Consider the vector \vec{C} = \vec{A} - \vec{B}. Compute |\vec{C}|^2:
Expanding using distributivity:
Write a = |\vec{A}|, b = |\vec{B}|, c = |\vec{C}|:
This is the law of cosines — the generalisation of the Pythagorean theorem to non-right triangles. The dot product naturally encodes this relationship. When \theta = 90°, the \cos\theta term vanishes and you get c^2 = a^2 + b^2 — the Pythagorean theorem falls out as a special case.
Where this leads next
- Vector (Cross) Product — the other way to multiply two vectors, giving a vector result perpendicular to both. Where the dot product measures alignment, the cross product measures "how much the vectors span a parallelogram."
- Work and Energy — the full treatment of work done by constant and variable forces, building on W = \vec{F}\cdot\vec{d}.
- Power — instantaneous power is P = \vec{F}\cdot\vec{v}, another dot product — force dotted with velocity.
- Vectors: Introduction and Notation — if the component notation in this article felt unfamiliar, start here.
- Vector Addition and Subtraction — the operations you need before you can use the distributive property of the dot product.