Chapter 2: Vectors in Space
2.3 The Dot Product
Study guide for Calculus Volume 3 (Gilbert Strang, 2016 edition)
Independent study guide. Not affiliated with OpenStax or Rice University.
Big idea
So far vectors have only been added and scaled, and neither operation says anything about angle. The dot product fixes that. It takes two vectors and returns a single number, and that number encodes how much the two vectors agree in direction. Positive means they broadly point the same way, negative means they broadly oppose, and zero means they are perpendicular. One multiplication and one addition per component, and you have a test for perpendicularity that no amount of sketching would give you reliably in three dimensions.
The reason the dot product carries geometric information is that it has two formulas. One is pure arithmetic, multiplying matching components and adding. The other is $\|\mathbf{u}\| \, \|\mathbf{v}\| \cos\theta$, which is pure geometry. Setting them equal solves for $\cos\theta$, and suddenly the angle between two vectors in space is something you can compute exactly rather than estimate. The bridge between the two formulas is the law of cosines applied to the triangle with sides $\mathbf{u}$, $\mathbf{v}$ and $\mathbf{u} - \mathbf{v}$.
The second use is decomposition. Given a direction, any vector splits into the part that lies along that direction and the part perpendicular to it, and the dot product computes both parts. That is what a projection is, and it is how a physicist answers questions like how much of a force actually pushes an object forward when the push is at an angle.
Work is the standard application and it is the cleanest one. If a constant force moves an object along a straight displacement, only the component of the force along that displacement does anything, so the work is exactly a dot product. A force perpendicular to the motion does no work at all, which the formula reports as zero without any special reasoning.
Decoder
For nonzero vectors, the dot product equals the product of the two magnitudes times the cosine of the angle between them, so dividing the dot product by both magnitudes gives that cosine directly.
The angle in question is the one between $0$ and $\pi$ formed when the two vectors are placed tail to tail. There is only one such angle, so the formula is unambiguous, and the cosine it produces is always between $-1$ and $1$, which is a useful arithmetic check on your work: if you compute $\cos\theta = 1.4$, a magnitude or a component is wrong.
The sign of the dot product is the fastest piece of information in the whole section. Since the magnitudes are positive, the sign of $\mathbf{u} \cdot \mathbf{v}$ is the sign of $\cos\theta$. Positive means the angle is acute, negative means obtuse, and zero means exactly a right angle. Testing perpendicularity therefore costs three multiplications and no trigonometry.
The classic mistake is expecting a vector out of a vector operation. The dot product of two vectors is a scalar, so writing $(\mathbf{u} \cdot \mathbf{v}) \cdot \mathbf{w}$ is meaningless, and so is dividing by a vector. The related trap is the zero product: for numbers, $ab = 0$ forces one factor to vanish, but $\mathbf{u} \cdot \mathbf{v} = 0$ usually means the vectors are perpendicular, not that either is zero.
Definitions and results
Definition. For $\mathbf{u} = \langle u_1, u_2, u_3 \rangle$ and $\mathbf{v} = \langle v_1, v_2, v_3 \rangle$,
$$ \mathbf{u} \cdot \mathbf{v} = u_1 v_1 + u_2 v_2 + u_3 v_3 $$
The same definition with two terms applies in the plane. The result is a scalar.
Algebraic properties. The dot product is commutative, it distributes over addition, and scalars pull out: $(c\mathbf{u}) \cdot \mathbf{v} = c(\mathbf{u} \cdot \mathbf{v})$. Also $\mathbf{0} \cdot \mathbf{v} = 0$ for every $\mathbf{v}$, and taking the dot product of a vector with itself gives $\mathbf{v} \cdot \mathbf{v} = \|\mathbf{v}\|^2$, so magnitude is a special case rather than a separate idea.
Angle between vectors. For nonzero $\mathbf{u}$ and $\mathbf{v}$ the two formulas agree:
$$ \mathbf{u} \cdot \mathbf{v} = \|\mathbf{u}\| \, \|\mathbf{v}\| \cos\theta, \qquad \cos\theta = \frac{\mathbf{u} \cdot \mathbf{v}}{\|\mathbf{u}\| \, \|\mathbf{v}\|} $$
with $0 \le \theta \le \pi$.
Orthogonality. Two nonzero vectors are orthogonal exactly when $\mathbf{u} \cdot \mathbf{v} = 0$. By convention $\mathbf{0}$ is orthogonal to everything. The standard basis vectors are mutually orthogonal, and each dotted with itself gives $1$.
Direction cosines. The angles $\alpha$, $\beta$, $\gamma$ that a nonzero vector $\mathbf{v}$ makes with the positive $x$-, $y$- and $z$-axes satisfy
$$ \cos\alpha = \frac{v_1}{\|\mathbf{v}\|}, \qquad \cos\beta = \frac{v_2}{\|\mathbf{v}\|}, \qquad \cos\gamma = \frac{v_3}{\|\mathbf{v}\|} $$
These three numbers are the components of the unit vector in the direction of $\mathbf{v}$, so they always satisfy $\cos^2\alpha + \cos^2\beta + \cos^2\gamma = 1$.
Scalar projection. The scalar projection of $\mathbf{v}$ onto a nonzero $\mathbf{u}$, also called the component of $\mathbf{v}$ along $\mathbf{u}$, is
$$ \operatorname{comp}_{\mathbf{u}} \mathbf{v} = \frac{\mathbf{u} \cdot \mathbf{v}}{\|\mathbf{u}\|} = \|\mathbf{v}\| \cos\theta $$
It is a signed length: negative when the angle is obtuse.
Vector projection. Multiplying that signed length by the unit vector along $\mathbf{u}$ gives the vector projection,
$$ \operatorname{proj}_{\mathbf{u}} \mathbf{v} = \frac{\mathbf{u} \cdot \mathbf{v}}{\|\mathbf{u}\|^2} \, \mathbf{u} $$
Note the square in the denominator; it is the single most common slip in this section. The projection is always parallel to $\mathbf{u}$ and does not depend on the length of $\mathbf{u}$.
Orthogonal decomposition. Every vector splits as $\mathbf{v} = \operatorname{proj}_{\mathbf{u}} \mathbf{v} + \left( \mathbf{v} - \operatorname{proj}_{\mathbf{u}} \mathbf{v} \right)$, where the first piece is parallel to $\mathbf{u}$ and the second is orthogonal to it. Because the pieces are perpendicular, their squared magnitudes add up to $\|\mathbf{v}\|^2$.
Work. A constant force $\mathbf{F}$ acting through a displacement $\mathbf{d}$ does work
$$ W = \mathbf{F} \cdot \mathbf{d} = \|\mathbf{F}\| \, \|\mathbf{d}\| \cos\theta $$
Only the component of the force along the displacement contributes, so a perpendicular force does no work.
Worked examples
The angle between two vectors
Find the angle between $\mathbf{u} = \langle 1, 2, 2 \rangle$ and $\mathbf{v} = \langle 0, 3, 4 \rangle$.
The dot product is $1(0) + 2(3) + 2(4) = 14$, and the magnitudes are $\|\mathbf{u}\| = \sqrt{9} = 3$ and $\|\mathbf{v}\| = \sqrt{25} = 5$. So
$$ \cos\theta = \frac{14}{15}, \qquad \theta = \arccos\left(\frac{14}{15}\right) \approx 21.0^\circ $$
The dot product is positive, so the angle had to come out acute, and $14/15$ is close to $1$, so the two vectors had to be nearly aligned. Both predictions match the answer.
Orthogonality and direction cosines
First, choose $k$ so that $\langle 2, -3, 1 \rangle$ and $\langle 4, k, -2 \rangle$ are orthogonal. Set the dot product to zero:
$$ 8 - 3k - 2 = 0 \quad \Longrightarrow \quad 6 = 3k \quad \Longrightarrow \quad k = 2 $$
Substituting back, $\langle 2,-3,1\rangle \cdot \langle 4,2,-2\rangle = 8 - 6 - 2 = 0$, as required.
Now find the direction cosines of $\mathbf{u} = \langle 1, 2, 2 \rangle$. Since $\|\mathbf{u}\| = 3$,
$$ \cos\alpha = \tfrac{1}{3}, \qquad \cos\beta = \tfrac{2}{3}, \qquad \cos\gamma = \tfrac{2}{3} $$
giving $\alpha \approx 70.5^\circ$ and $\beta = \gamma \approx 48.2^\circ$. The three cosines square to $\tfrac{1}{9} + \tfrac{4}{9} + \tfrac{4}{9} = 1$, which is the check that they came from a unit vector.
Splitting a vector into two perpendicular pieces
Decompose $\mathbf{v} = \langle 4, 4, 3 \rangle$ into a part parallel to $\mathbf{u} = \langle 1, 2, 2 \rangle$ and a part orthogonal to it.
Compute $\mathbf{u} \cdot \mathbf{v} = 4 + 8 + 6 = 18$ and $\|\mathbf{u}\|^2 = 9$. The scalar projection is $18/3 = 6$, and the vector projection is
$$ \operatorname{proj}_{\mathbf{u}} \mathbf{v} = \frac{18}{9}\langle 1, 2, 2 \rangle = \langle 2, 4, 4 \rangle $$
The orthogonal piece is what is left over:
$$ \mathbf{v} - \operatorname{proj}_{\mathbf{u}} \mathbf{v} = \langle 2, 0, -1 \rangle $$
Two checks. That leftover really is orthogonal to $\mathbf{u}$, since $2 + 0 - 2 = 0$. And the squared magnitudes add correctly: $\|\langle 2,4,4\rangle\|^2 + \|\langle 2,0,-1\rangle\|^2 = 36 + 5 = 41$, which equals $\|\mathbf{v}\|^2 = 16 + 16 + 9$.
Work done by an angled force
A constant force $\mathbf{F} = \langle 30, 40 \rangle$ newtons moves an object in a straight line from $(1, 2)$ to $(5, 5)$, with distances in meters. The displacement is $\mathbf{d} = \langle 4, 3 \rangle$, so
$$ W = \mathbf{F} \cdot \mathbf{d} = 30(4) + 40(3) = 240 \text{ joules} $$
The magnitudes are $\|\mathbf{F}\| = 50$ and $\|\mathbf{d}\| = 5$, so $\cos\theta = 240/250 = 0.96$ and $\theta \approx 16.3^\circ$. The force is nearly aligned with the motion, so nearly the whole $250$ joules that a perfectly aligned force would deliver is actually delivered. A force of the same size directed along $\langle -4, 3 \rangle$ would instead give $\mathbf{F}\cdot\mathbf{d} = -120 + 120 = 0$: perpendicular to the motion, and no work at all.
Practice
Begin with the product itself: evaluating it, using it to find angles, and using a zero value to test for or force orthogonality.
Practice
Generated problems for this section, graded instantly.
Then the decomposition. These ask for scalar and vector projections, the orthogonal remainder, and work done by a constant force.
Practice
Generated problems for this section, graded instantly.
Quiz
Five items on computing dot products, angles and orthogonality, direction cosines, and scalar and vector projections.
Quiz
5 problems with a score at the end.