Math Core

Lesson 1.3 · Vectors and 3D Space

The dot product

You can add vectors and scale them, but so far there is no way to multiply two vectors together. The dot product is the first such product. It takes two vectors and returns a single number, and that number measures how much the vectors point in the same direction. With it you can compute angles, test for perpendicularity, split a vector into pieces, and calculate work.

Definition and algebraic properties

Definition

Dot product

The dot product of a=⟨a1,a2,a3⟩\mathbf{a} = \langle a_1, a_2, a_3 \rangle and b=⟨b1,b2,b3⟩\mathbf{b} = \langle b_1, b_2, b_3 \rangle is the scalar

a⋅b=a1b1+a2b2+a3b3.\mathbf{a} \cdot \mathbf{b} = a_1 b_1 + a_2 b_2 + a_3 b_3.

Multiply matching components and add. For example, ⟨2,−1,3⟩⋅⟨4,0,−5⟩=8+0−15=−7\langle 2, -1, 3 \rangle \cdot \langle 4, 0, -5 \rangle = 8 + 0 - 15 = -7. The result is a number, not a vector, which is why the dot product is also called the scalar product.

Directly from the definition, for all vectors a,b,c\mathbf{a}, \mathbf{b}, \mathbf{c} and scalars cc:

  1. a⋅a=∣a∣2\mathbf{a} \cdot \mathbf{a} = |\mathbf{a}|^2
  2. a⋅b=b⋅a\mathbf{a} \cdot \mathbf{b} = \mathbf{b} \cdot \mathbf{a}
  3. a⋅(b+c)=a⋅b+a⋅c\mathbf{a} \cdot (\mathbf{b} + \mathbf{c}) = \mathbf{a} \cdot \mathbf{b} + \mathbf{a} \cdot \mathbf{c}
  4. (ca)⋅b=c(a⋅b)=a⋅(cb)(c\mathbf{a}) \cdot \mathbf{b} = c(\mathbf{a} \cdot \mathbf{b}) = \mathbf{a} \cdot (c\mathbf{b})
  5. 0⋅a=0\mathbf{0} \cdot \mathbf{a} = 0

Property 1 is especially useful: it turns lengths into dot products, which you can then expand with properties 2 and 3 just like multiplying out binomials.

The geometric meaning

The angle θ\theta between two nonzero vectors is the angle between them when they are placed tail to tail, chosen so that 0≤θ≤π0 \le \theta \le \pi.

Dot product and angle

If θ\theta is the angle between nonzero vectors a\mathbf{a} and b\mathbf{b}, then

a⋅b=∣a∣ ∣b∣cos⁡θ,socos⁡θ=a⋅b∣a∣ ∣b∣.\mathbf{a} \cdot \mathbf{b} = |\mathbf{a}|\,|\mathbf{b}| \cos\theta, \qquad\text{so}\qquad \cos\theta = \frac{\mathbf{a} \cdot \mathbf{b}}{|\mathbf{a}|\,|\mathbf{b}|}.

Why it's true. Put a\mathbf{a} and b\mathbf{b} tail to tail. The third side of the triangle they form is a−b\mathbf{a} - \mathbf{b}. The law of cosines says

∣a−b∣2=∣a∣2+∣b∣2−2∣a∣ ∣b∣cos⁡θ.|\mathbf{a} - \mathbf{b}|^2 = |\mathbf{a}|^2 + |\mathbf{b}|^2 - 2|\mathbf{a}|\,|\mathbf{b}|\cos\theta.

On the other hand, using the algebraic properties,

∣a−b∣2=(a−b)⋅(a−b)=∣a∣2−2 a⋅b+∣b∣2.|\mathbf{a} - \mathbf{b}|^2 = (\mathbf{a} - \mathbf{b}) \cdot (\mathbf{a} - \mathbf{b}) = |\mathbf{a}|^2 - 2\,\mathbf{a} \cdot \mathbf{b} + |\mathbf{b}|^2.

Comparing the two expressions gives a⋅b=∣a∣ ∣b∣cos⁡θ\mathbf{a} \cdot \mathbf{b} = |\mathbf{a}|\,|\mathbf{b}|\cos\theta.

Because lengths are positive, the sign of a⋅b\mathbf{a} \cdot \mathbf{b} is the sign of cos⁡θ\cos\theta:

  • a⋅b>0\mathbf{a} \cdot \mathbf{b} > 0: the angle is acute (the vectors point roughly the same way).
  • a⋅b=0\mathbf{a} \cdot \mathbf{b} = 0: the angle is π2\dfrac{\pi}{2}. The vectors are orthogonal (perpendicular).
  • a⋅b<0\mathbf{a} \cdot \mathbf{b} < 0: the angle is obtuse.

By convention the zero vector is orthogonal to every vector, so the clean statement is: a\mathbf{a} and b\mathbf{b} are orthogonal if and only if a⋅b=0\mathbf{a} \cdot \mathbf{b} = 0.

Worked example: Orthogonality and angles

(a) Show that ⟨2,−1,3⟩\langle 2, -1, 3 \rangle and ⟨4,5,−1⟩\langle 4, 5, -1 \rangle are orthogonal. (b) Find the angle between a=⟨1,2,2⟩\mathbf{a} = \langle 1, 2, 2 \rangle and b=⟨3,0,4⟩\mathbf{b} = \langle 3, 0, 4 \rangle.

Solution. (a) 8−5−3=08 - 5 - 3 = 0, so the vectors are orthogonal.

(b) a⋅b=3+0+8=11\mathbf{a} \cdot \mathbf{b} = 3 + 0 + 8 = 11, ∣a∣=3|\mathbf{a}| = 3 and ∣b∣=5|\mathbf{b}| = 5. So

cos⁡θ=1115,θ=cos⁡−1 ⁣(1115)≈42.8∘.\cos\theta = \frac{11}{15}, \qquad \theta = \cos^{-1}\!\left(\frac{11}{15}\right) \approx 42.8^\circ.

The angles a vector a\mathbf{a} makes with the positive xx-, yy- and zz-axes are its direction angles α,β,γ\alpha, \beta, \gamma. Dotting with i\mathbf{i}, j\mathbf{j}, k\mathbf{k} gives the direction cosines

cos⁡α=a1∣a∣,cos⁡β=a2∣a∣,cos⁡γ=a3∣a∣.\cos\alpha = \frac{a_1}{|\mathbf{a}|}, \qquad \cos\beta = \frac{a_2}{|\mathbf{a}|}, \qquad \cos\gamma = \frac{a_3}{|\mathbf{a}|}.

They are exactly the components of the unit vector a/∣a∣\mathbf{a}/|\mathbf{a}|, so cos⁡2α+cos⁡2β+cos⁡2γ=1\cos^2\alpha + \cos^2\beta + \cos^2\gamma = 1.

Projections

Often you want to know how much of a vector b\mathbf{b} lies along the direction of another vector a\mathbf{a}. Drop a perpendicular from the head of b\mathbf{b} to the line through a\mathbf{a}. The signed length of the shadow is ∣b∣cos⁡θ|\mathbf{b}|\cos\theta, which equals a⋅b∣a∣\dfrac{\mathbf{a} \cdot \mathbf{b}}{|\mathbf{a}|}.

Scalar and vector projections of b onto a

comp⁡ab=a⋅b∣a∣,proj⁡ab=(a⋅b∣a∣2)a.\operatorname{comp}_{\mathbf{a}}\mathbf{b} = \frac{\mathbf{a} \cdot \mathbf{b}}{|\mathbf{a}|}, \qquad \operatorname{proj}_{\mathbf{a}}\mathbf{b} = \left(\frac{\mathbf{a} \cdot \mathbf{b}}{|\mathbf{a}|^2}\right)\mathbf{a}.

The scalar projection (component) is a number, negative when the angle is obtuse. The vector projection is that number times the unit vector a/∣a∣\mathbf{a}/|\mathbf{a}|.

The leftover piece b−proj⁡ab\mathbf{b} - \operatorname{proj}_{\mathbf{a}}\mathbf{b} is orthogonal to a\mathbf{a}. So every vector splits uniquely into a part parallel to a\mathbf{a} plus a part perpendicular to a\mathbf{a}, a decomposition you'll use for forces on ramps, velocity components and, later, the distance from a point to a plane.

Worked example: Projection and decomposition

Let a=⟨2,−2,1⟩\mathbf{a} = \langle 2, -2, 1 \rangle and b=⟨4,1,−3⟩\mathbf{b} = \langle 4, 1, -3 \rangle. Find comp⁡ab\operatorname{comp}_{\mathbf{a}}\mathbf{b} and proj⁡ab\operatorname{proj}_{\mathbf{a}}\mathbf{b}, and write b\mathbf{b} as a vector parallel to a\mathbf{a} plus one orthogonal to a\mathbf{a}.

Solution. a⋅b=8−2−3=3\mathbf{a} \cdot \mathbf{b} = 8 - 2 - 3 = 3 and ∣a∣=3|\mathbf{a}| = 3. So

comp⁡ab=33=1,proj⁡ab=39⟨2,−2,1⟩=⟨23,−23,13⟩.\operatorname{comp}_{\mathbf{a}}\mathbf{b} = \frac{3}{3} = 1, \qquad \operatorname{proj}_{\mathbf{a}}\mathbf{b} = \frac{3}{9}\langle 2, -2, 1 \rangle = \left\langle \frac23, -\frac23, \frac13 \right\rangle.

The orthogonal part is b−proj⁡ab=⟨103,53,−103⟩\mathbf{b} - \operatorname{proj}_{\mathbf{a}}\mathbf{b} = \left\langle \dfrac{10}{3}, \dfrac53, -\dfrac{10}{3} \right\rangle. Check: its dot product with a\mathbf{a} is 203−103−103=0\dfrac{20}{3} - \dfrac{10}{3} - \dfrac{10}{3} = 0.

Common mistake

Watch the order and the power. proj⁡ab\operatorname{proj}_{\mathbf{a}}\mathbf{b} projects b\mathbf{b} onto a\mathbf{a}, so you divide by the length of a\mathbf{a}, the vector you project onto. And the vector projection divides by ∣a∣2|\mathbf{a}|^2, not ∣a∣|\mathbf{a}|: one factor of ∣a∣|\mathbf{a}| comes from the scalar projection and the other from making a\mathbf{a} a unit vector.

Work

If a constant force F\mathbf{F} moves an object along a displacement D\mathbf{D}, only the component of the force along the motion does work. That component is ∣F∣cos⁡θ|\mathbf{F}|\cos\theta, so the work is W=(∣F∣cos⁡θ) ∣D∣=F⋅DW = (|\mathbf{F}|\cos\theta)\,|\mathbf{D}| = \mathbf{F} \cdot \mathbf{D}.

Worked example: Work done by a constant force

A constant force F=⟨10,4,−2⟩\mathbf{F} = \langle 10, 4, -2 \rangle newtons moves an object in a straight line from (1,0,2)(1, 0, 2) to (5,3,2)(5, 3, 2), with distances in meters. Find the work done.

Solution. The displacement is D=⟨4,3,0⟩\mathbf{D} = \langle 4, 3, 0 \rangle, so W=F⋅D=40+12+0=52W = \mathbf{F} \cdot \mathbf{D} = 40 + 12 + 0 = 52 joules. The zz-component of the force does no work because the motion is horizontal.

Practice

Practice 1

Compute ⟨3,−2,5⟩⋅⟨1,4,2⟩\langle 3, -2, 5 \rangle \cdot \langle 1, 4, 2 \rangle.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 2

Find the value of cc that makes ⟨c,3,−2⟩\langle c, 3, -2 \rangle orthogonal to ⟨4,−2,c⟩\langle 4, -2, c \rangle.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 3

Find the angle, in degrees, between i+j\mathbf{i} + \mathbf{j} and i+k\mathbf{i} + \mathbf{k}.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 4

Find the angle between ⟨2,−1,2⟩\langle 2, -1, 2 \rangle and ⟨−3,6,2⟩\langle -3, 6, 2 \rangle, in degrees, rounded to the nearest tenth.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 5

Find the scalar projection of b=⟨5,−1,4⟩\mathbf{b} = \langle 5, -1, 4 \rangle onto a=⟨1,2,−2⟩\mathbf{a} = \langle 1, 2, -2 \rangle.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 6

Find the vector projection of ⟨3,4,5⟩\langle 3, 4, 5 \rangle onto ⟨1,1,1⟩\langle 1, 1, 1 \rangle.

Enter a point like (2, -3)

Practice 7

A force F=⟨3,−2,6⟩\mathbf{F} = \langle 3, -2, 6 \rangle newtons moves an object in a straight line from (0,1,−1)(0, 1, -1) to (4,3,2)(4, 3, 2), with distances in meters. Find the work done, in joules.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 8

Vectors a\mathbf{a} and b\mathbf{b} satisfy ∣a∣=4|\mathbf{a}| = 4, ∣b∣=5|\mathbf{b}| = 5 and a⋅b=10\mathbf{a} \cdot \mathbf{b} = 10. Find ∣a−b∣|\mathbf{a} - \mathbf{b}|.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.