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.

Projection of vector A onto vector B Two vectors A and B start from the same point. A dashed perpendicular drops from the tip of A onto the line of B, marking the projection length |A| cos theta along B. The angle theta is marked between the two vectors. B A |A| cos θ θ |A|
The projection of $\vec{A}$ onto $\vec{B}$ is the shadow of $\vec{A}$ cast along $\vec{B}$ by a light shining perpendicular to $\vec{B}$. Its length is $|\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}:

\vec{A} \cdot \vec{B} = |\vec{A}|\cos\theta \times |\vec{B}| = |\vec{A}||\vec{B}|\cos\theta

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

\vec{A} \cdot \vec{B} = |\vec{A}||\vec{B}|\cos\theta

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}:

\vec{A} = A_x\hat{i} + A_y\hat{j} + A_z\hat{k}
\vec{B} = B_x\hat{i} + B_y\hat{j} + B_z\hat{k}

To find \vec{A} \cdot \vec{B}, use the distributive property (which you will prove in the next section) and expand:

\vec{A} \cdot \vec{B} = (A_x\hat{i} + A_y\hat{j} + A_z\hat{k}) \cdot (B_x\hat{i} + B_y\hat{j} + B_z\hat{k})

Why: treat the dot product like multiplication — each term in the first bracket dots with each term in the second. This gives nine terms.

= A_x B_x(\hat{i}\cdot\hat{i}) + A_x B_y(\hat{i}\cdot\hat{j}) + A_x B_z(\hat{i}\cdot\hat{k})
+ A_y B_x(\hat{j}\cdot\hat{i}) + A_y B_y(\hat{j}\cdot\hat{j}) + A_y B_z(\hat{j}\cdot\hat{k})
+ A_z B_x(\hat{k}\cdot\hat{i}) + A_z B_y(\hat{k}\cdot\hat{j}) + A_z B_z(\hat{k}\cdot\hat{k})

Now apply the geometric definition to the unit vector dot products. Each unit vector has magnitude 1, and the angles between them are known:

Why: any unit vector dotted with itself gives \cos 0° = 1. The vector is perfectly aligned with itself.

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:

\boxed{\vec{A} \cdot \vec{B} = A_x B_x + A_y B_y + A_z B_z}

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:

|\vec{A}||\vec{B}|\cos\theta = A_x B_x + A_y B_y + A_z B_z

Solve for \cos\theta:

\boxed{\cos\theta = \frac{\vec{A} \cdot \vec{B}}{|\vec{A}||\vec{B}|} = \frac{A_x B_x + A_y B_y + A_z B_z}{\sqrt{A_x^2 + A_y^2 + A_z^2}\;\sqrt{B_x^2 + B_y^2 + B_z^2}}}

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:

(c\vec{A}) \cdot \vec{B} = |c\vec{A}||\vec{B}|\cos\theta' = |c||\vec{A}||\vec{B}|\cos\theta'

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 , so \cos 0° = 1:

\vec{A} \cdot \vec{A} = |\vec{A}||\vec{A}|\cos 0° = |\vec{A}|^2

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.

Perpendicular vectors have zero dot product Two vectors A and B at 90 degrees to each other, with a right-angle symbol at their junction and the annotation A dot B equals zero. B A θ = 90° A · B = 0 projection of A onto B = 0
When two vectors are perpendicular, neither has any component along the other. The projection is zero, so the dot product is zero.

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:

W = \vec{F} \cdot \vec{d} = |\vec{F}||\vec{d}|\cos\theta = Fd\cos\theta

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.

Work equals F d cos theta: force at angle to displacement A suitcase on a platform with a person pulling it by a handle at angle theta to the horizontal. The force vector F is along the handle. The displacement vector d is horizontal. The horizontal component F cos theta is shown along the displacement direction. suitcase F d F cos θ F sin θ θ
Pulling a suitcase at angle $\theta$ to the horizontal. Only the horizontal component $F\cos\theta$ acts in the direction of motion. The work done is $W = Fd\cos\theta = \vec{F}\cdot\vec{d}$.

Three special cases make this concrete:

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?

Force and displacement diagram for suitcase problem A suitcase being pulled by a 40 N force at 30 degrees to the horizontal across a 50 m displacement. The horizontal component 40 cos 30 is shown as a dashed line. F = 40 N 40 cos 30° 30° d = 50 m
The passenger applies 40 N at 30° above horizontal. Over a 50 m displacement, only the horizontal component does work.

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.

W = Fd\cos\theta = 40 \times 50 \times \cos 30°
W = 2000 \times \frac{\sqrt{3}}{2} = 2000 \times 0.866
W = 1732 \text{ J}

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.

Vector diagram for A = 3i + 4j and B = -2i + 5j A coordinate plane with vector A pointing to (3,4) in the first quadrant and vector B pointing to (-2,5) in the second quadrant. Both start from the origin. The angle theta between them is marked. x y 1 2 3 −1 −2 1 2 3 4 O A (3, 4) B (−2, 5) θ
$\vec{A}$ points into the first quadrant, $\vec{B}$ points into the second quadrant. The angle $\theta$ between them is what you need to find.

Step 1. Compute the dot product using components.

\vec{A}\cdot\vec{B} = (3)(-2) + (4)(5) = -6 + 20 = 14

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.

|\vec{A}| = \sqrt{3^2 + 4^2} = \sqrt{9 + 16} = \sqrt{25} = 5
|\vec{B}| = \sqrt{(-2)^2 + 5^2} = \sqrt{4 + 25} = \sqrt{29} \approx 5.385

Step 3. Find \cos\theta.

\cos\theta = \frac{\vec{A}\cdot\vec{B}}{|\vec{A}||\vec{B}|} = \frac{14}{5\sqrt{29}} = \frac{14}{26.93} \approx 0.5197

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.

\theta = \cos^{-1}(0.5197) \approx 58.7°

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

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,

\vec{A}\cdot\vec{B} = \sum_{k=1}^{n} A_k B_k = A_1 B_1 + A_2 B_2 + \cdots + A_n B_n

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:

\cos\theta = \frac{\sum_{k=1}^n A_k B_k}{\sqrt{\sum_{k=1}^n A_k^2}\;\sqrt{\sum_{k=1}^n B_k^2}}

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:

\vec{A}\cdot\vec{B} = |\vec{A}||\vec{B}|\cos\theta = 0

Since |\vec{A}| > 0 and |\vec{B}| > 0 (neither is the zero vector), you can divide both sides by |\vec{A}||\vec{B}|:

\cos\theta = 0

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:

\theta = 90°

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:

A_n = \vec{A}\cdot\hat{n} = |\vec{A}|\cos\theta

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:

\vec{A}_{\parallel} = (\vec{A}\cdot\hat{n})\,\hat{n}

And the perpendicular component is:

\vec{A}_{\perp} = \vec{A} - \vec{A}_{\parallel}

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:

|\vec{C}|^2 = \vec{C}\cdot\vec{C} = (\vec{A} - \vec{B})\cdot(\vec{A} - \vec{B})

Expanding using distributivity:

= \vec{A}\cdot\vec{A} - 2\vec{A}\cdot\vec{B} + \vec{B}\cdot\vec{B} = |\vec{A}|^2 - 2|\vec{A}||\vec{B}|\cos\theta + |\vec{B}|^2

Write a = |\vec{A}|, b = |\vec{B}|, c = |\vec{C}|:

c^2 = a^2 + b^2 - 2ab\cos\theta

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