Skip to content
Family Table Math
Auto

The Dot Product

The dot product is a way to “multiply” two vectors, and the answer is a plain number (a scalar), not another vector. That number tells you how much two vectors point in the same direction. It’s the quickest way to find the angle between two vectors, to test whether they’re perpendicular, and to work out the work done by a force.

Place a⃗\vec{a} and b⃗\vec{b} tail to tail, and let θ\theta be the angle between them, with 0∘≤θ≤180∘0^\circ \le \theta \le 180^\circ. The dot product is

a⃗⋅b⃗=∣a⃗∣ ∣b⃗∣cos⁡θ\vec{a} \cdot \vec{b} = |\vec{a}|\,|\vec{b}| \cos\theta

Read it as “a dot b”. Since ∣a⃗∣|\vec{a}| and ∣b⃗∣|\vec{b}| are positive (for non-zero vectors), the sign of the dot product comes from cos⁡θ\cos\theta:

Anglecos⁡θ\cos\thetaDot product
acute (or 0∘0^\circ), 0∘≤θ<90∘0^\circ \le \theta \lt 90^\circpositivea⃗⋅b⃗>0\vec{a} \cdot \vec{b} \gt 0
right, θ=90∘\theta = 90^\circ00a⃗⋅b⃗=0\vec{a} \cdot \vec{b} = 0
obtuse, 90∘<θ≤180∘90^\circ \lt \theta \le 180^\circnegativea⃗⋅b⃗<0\vec{a} \cdot \vec{b} \lt 0
Three pairs of vectors a and b drawn tail to tail. With an acute angle the dot product is positive, with a right angle it is zero, and with an obtuse angle it is negative. θ a b acute angle a · b > 0 a b right angle a · b = 0 θ a b obtuse angle a · b < 0
The sign of a⃗⋅b⃗\vec{a} \cdot \vec{b} tells you whether the angle between the vectors is acute, right, or obtuse.

When the vectors are in Cartesian form (written with square brackets, like the rest of this unit; some books use (a1,a2)(a_1, a_2) or ⟨a1,a2⟩\langle a_1, a_2 \rangle), multiply matching components and add:

2-D:[a1,a2]⋅[b1,b2]=a1b1+a2b23-D:[a1,a2,a3]⋅[b1,b2,b3]=a1b1+a2b2+a3b3\begin{aligned} \text{2-D:}\quad [a_1, a_2] \cdot [b_1, b_2] &= a_1 b_1 + a_2 b_2 \\ \text{3-D:}\quad [a_1, a_2, a_3] \cdot [b_1, b_2, b_3] &= a_1 b_1 + a_2 b_2 + a_3 b_3 \end{aligned}

For example, [2,−1,3]⋅[4,0,5]=8+0+15=23[2, -1, 3] \cdot [4, 0, 5] = 8 + 0 + 15 = 23. IB courses write [2,−1,3][2, -1, 3] as a column, (2−13)\begin{pmatrix} 2 \\ -1 \\ 3 \end{pmatrix}; it means exactly the same thing.

Why do the two formulas agree? Draw a⃗\vec{a}, b⃗\vec{b}, and a⃗−b⃗\vec{a} - \vec{b} as a triangle. The cosine law gives ∣a⃗−b⃗∣2=∣a⃗∣2+∣b⃗∣2−2∣a⃗∣∣b⃗∣cos⁡θ|\vec{a} - \vec{b}|^2 = |\vec{a}|^2 + |\vec{b}|^2 - 2|\vec{a}||\vec{b}|\cos\theta. Writing each magnitude with components and expanding, almost everything cancels and you’re left with a1b1+a2b2+a3b3=∣a⃗∣∣b⃗∣cos⁡θa_1 b_1 + a_2 b_2 + a_3 b_3 = |\vec{a}||\vec{b}|\cos\theta.

Put the two formulas together and solve for cos⁡θ\cos\theta:

cos⁡θ=a⃗⋅b⃗∣a⃗∣ ∣b⃗∣\cos\theta = \frac{\vec{a} \cdot \vec{b}}{|\vec{a}|\,|\vec{b}|}

Then use cos⁡−1\cos^{-1} (calculator in degrees). Because cos⁡−1\cos^{-1} always gives an angle from 0∘0^\circ to 180∘180^\circ, you get the right angle every time, acute or obtuse.

Two non-zero vectors are perpendicular, also called orthogonal, exactly when their dot product is zero:

a⃗⊥b⃗⟺a⃗⋅b⃗=0\vec{a} \perp \vec{b} \quad \Longleftrightarrow \quad \vec{a} \cdot \vec{b} = 0

This is the fastest perpendicular test there is. For example, [3,−2,1]⋅[1,2,1]=3−4+1=0[3, -2, 1] \cdot [1, 2, 1] = 3 - 4 + 1 = 0, so these vectors meet at 90∘90^\circ.

Finding a vector perpendicular to a given one.

  • In 2-D, swap the components and change one sign: [a,b][a, b] is perpendicular to [−b,a][-b, a] and to [b,−a][b, -a]. Check: a(−b)+b(a)=0a(-b) + b(a) = 0.
  • In 3-D there are infinitely many perpendicular directions. Choose two components and solve for the third, or set one component to 00 and use the 2-D trick on the other two. For [1,2,3][1, 2, 3], setting the middle component to 00 gives [3,0,−1][3, 0, -1]: check 3+0−3=03 + 0 - 3 = 0.

These all follow from the component formula, so you can check any of them by expanding.

PropertyRule
Commutativea⃗⋅b⃗=b⃗⋅a⃗\vec{a} \cdot \vec{b} = \vec{b} \cdot \vec{a}
Distributivea⃗⋅(b⃗+c⃗)=a⃗⋅b⃗+a⃗⋅c⃗\vec{a} \cdot (\vec{b} + \vec{c}) = \vec{a} \cdot \vec{b} + \vec{a} \cdot \vec{c}
Scalar multiples(ka⃗)⋅b⃗=k(a⃗⋅b⃗)=a⃗⋅(kb⃗)(k\vec{a}) \cdot \vec{b} = k(\vec{a} \cdot \vec{b}) = \vec{a} \cdot (k\vec{b})
Dot with itselfa⃗⋅a⃗=∣a⃗∣2\vec{a} \cdot \vec{a} = \lvert\vec{a}\rvert^2
Zero vectora⃗⋅0⃗=0\vec{a} \cdot \vec{0} = 0

The rule a⃗⋅a⃗=∣a⃗∣2\vec{a} \cdot \vec{a} = |\vec{a}|^2 comes from θ=0∘\theta = 0^\circ: ∣a⃗∣∣a⃗∣cos⁡0∘=∣a⃗∣2|\vec{a}||\vec{a}|\cos 0^\circ = |\vec{a}|^2. It’s very useful for finding magnitudes, as in Practice question 5.

The dot product is not associative, and the question doesn’t even make sense. To be associative you’d need (a⃗⋅b⃗)⋅c⃗=a⃗⋅(b⃗⋅c⃗)(\vec{a} \cdot \vec{b}) \cdot \vec{c} = \vec{a} \cdot (\vec{b} \cdot \vec{c}). But a⃗⋅b⃗\vec{a} \cdot \vec{b} is a number, and you can’t dot a number with a vector. The closest you can write is (a⃗⋅b⃗)c⃗(\vec{a} \cdot \vec{b})\vec{c}, a scalar multiple of c⃗\vec{c}, and that’s usually different from a⃗(b⃗⋅c⃗)\vec{a}(\vec{b} \cdot \vec{c}), a multiple of a⃗\vec{a}. For a⃗=[1,2]\vec{a} = [1, 2], b⃗=[3,−1]\vec{b} = [3, -1], c⃗=[2,2]\vec{c} = [2, 2]: (a⃗⋅b⃗)c⃗=1[2,2]=[2,2](\vec{a} \cdot \vec{b})\vec{c} = 1[2, 2] = [2, 2], but a⃗(b⃗⋅c⃗)=4[1,2]=[4,8]\vec{a}(\vec{b} \cdot \vec{c}) = 4[1, 2] = [4, 8].

When a constant force F⃗\vec{F} moves an object through a displacement d⃗\vec{d}, the work done is

W=F⃗⋅d⃗=∣F⃗∣ ∣d⃗∣cos⁡θW = \vec{F} \cdot \vec{d} = |\vec{F}|\,|\vec{d}| \cos\theta

With force in newtons (N) and distance in metres (m), work is in joules (J). Only the part of the force that points along the motion does work: pull straight ahead and cos⁡0∘=1\cos 0^\circ = 1 (all of the force counts); pull at right angles to the motion and cos⁡90∘=0\cos 90^\circ = 0 (no work at all).

∣a⃗∣=5|\vec{a}| = 5 and ∣b⃗∣=8|\vec{b}| = 8. Find a⃗⋅b⃗\vec{a} \cdot \vec{b} if the angle between them is (a) 60∘60^\circ and (b) 120∘120^\circ.

Solution.

(a) a⃗⋅b⃗=(5)(8)cos⁡60∘=40×12=20\vec{a} \cdot \vec{b} = (5)(8)\cos 60^\circ = 40 \times \dfrac{1}{2} = 20

(b) a⃗⋅b⃗=(5)(8)cos⁡120∘=40×(−12)=−20\vec{a} \cdot \vec{b} = (5)(8)\cos 120^\circ = 40 \times \left(-\dfrac{1}{2}\right) = -20

The obtuse angle gives a negative dot product, just as the table predicts.

Example 2: The angle between two vectors in 3-D

Section titled “Example 2: The angle between two vectors in 3-D”

Find the angle between a⃗=[2,−1,3]\vec{a} = [2, -1, 3] and b⃗=[4,2,−1]\vec{b} = [4, 2, -1], to one decimal place.

Solution. Find the dot product and both magnitudes:

a⃗⋅b⃗=2(4)+(−1)(2)+3(−1)=8−2−3=3∣a⃗∣=4+1+9=14∣b⃗∣=16+4+1=21\begin{aligned} \vec{a} \cdot \vec{b} &= 2(4) + (-1)(2) + 3(-1) = 8 - 2 - 3 = 3 \\ |\vec{a}| &= \sqrt{4 + 1 + 9} = \sqrt{14} \\ |\vec{b}| &= \sqrt{16 + 4 + 1} = \sqrt{21} \end{aligned}

Then

cos⁡θ=314 21=3294≈0.1750⇒θ=cos⁡−1(0.1750)≈79.9∘\cos\theta = \frac{3}{\sqrt{14}\,\sqrt{21}} = \frac{3}{\sqrt{294}} \approx 0.1750 \qquad\Rightarrow\qquad \theta = \cos^{-1}(0.1750) \approx 79.9^\circ

The dot product is small and positive, so the angle is acute but close to 90∘90^\circ. That matches.

(a) Find kk so that u⃗=[2,k,5]\vec{u} = [2, k, 5] and v⃗=[k,3,−4]\vec{v} = [k, 3, -4] are perpendicular.

(b) Find two different vectors perpendicular to [2,−5][2, -5].

Solution.

(a) Perpendicular means the dot product is 00:

2k+3k−20=05k=20k=4\begin{aligned} 2k + 3k - 20 &= 0 \\ 5k &= 20 \\ k &= 4 \end{aligned}

Check: [2,4,5]⋅[4,3,−4]=8+12−20=0[2, 4, 5] \cdot [4, 3, -4] = 8 + 12 - 20 = 0. ✓

(b) Swap the components and change one sign: [5,2][5, 2] works, since 2(5)+(−5)(2)=02(5) + (-5)(2) = 0. Any multiple also works, such as [−5,−2][-5, -2] or [10,4][10, 4].

You pull a sled 5050 m across flat snow with a force of 8080 N along a rope held at 30∘30^\circ above the horizontal.

(a) How much work do you do?

(b) How much more work would the same force do if you lowered the rope to 15∘15^\circ?

Solution. The displacement is horizontal, so the angle between F⃗\vec{F} and d⃗\vec{d} is the rope’s angle.

(a)

W=∣F⃗∣∣d⃗∣cos⁡θ=(80)(50)cos⁡30∘=4000×32=20003≈3464 JW = |\vec{F}||\vec{d}|\cos\theta = (80)(50)\cos 30^\circ = 4000 \times \frac{\sqrt{3}}{2} = 2000\sqrt{3} \approx 3464 \text{ J}

(b) W=(80)(50)cos⁡15∘≈3864W = (80)(50)\cos 15^\circ \approx 3864 J, which is about 400400 J more.

A lower rope sends more of your pull along the direction of motion. (Pulling at 0∘0^\circ would give the full 40004000 J, but then your hand would be on the ground.)

Writing the answer as a vector. The dot product of two vectors is a number. [1,2,3]⋅[4,5,6]=4+10+18=32[1, 2, 3] \cdot [4, 5, 6] = 4 + 10 + 18 = 32, not [4,10,18][4, 10, 18].

Using an angle that isn’t tail to tail. The angle in ∣a⃗∣∣b⃗∣cos⁡θ|\vec{a}||\vec{b}|\cos\theta is between vectors that start at the same point. In triangle ABCABC, the angle at BB is between BA→\overrightarrow{BA} and BC→\overrightarrow{BC}. If you use AB→\overrightarrow{AB} and BC→\overrightarrow{BC} (head to tail), you get 180∘180^\circ minus the angle you want.

Calculator in radians. This course gives angles between vectors in degrees. If cos⁡−1(0.175)\cos^{-1}(0.175) comes out as 1.3951.395, your calculator is in radian mode.

Thinking a zero dot product means a zero vector. a⃗⋅b⃗=0\vec{a} \cdot \vec{b} = 0 usually means the vectors are perpendicular, not that one of them is 0⃗\vec{0}. For example, [3,1]⋅[−1,3]=0[3, 1] \cdot [-1, 3] = 0.

Trying to “associate” dot products. (a⃗⋅b⃗)⋅c⃗(\vec{a} \cdot \vec{b}) \cdot \vec{c} is meaningless, because a⃗⋅b⃗\vec{a} \cdot \vec{b} is a number. And (a⃗⋅b⃗)c⃗(\vec{a} \cdot \vec{b})\vec{c} is generally not equal to a⃗(b⃗⋅c⃗)\vec{a}(\vec{b} \cdot \vec{c}): they’re multiples of different vectors.

Using the whole force for work. Work uses only the component of the force along the motion, ∣F⃗∣cos⁡θ|\vec{F}|\cos\theta. Multiplying ∣F⃗∣|\vec{F}| by the distance overestimates the work whenever the force is at an angle.

1. (Warm-up) ∣u⃗∣=6|\vec{u}| = 6, ∣v⃗∣=4|\vec{v}| = 4, and the angle between them is 45∘45^\circ. Find u⃗⋅v⃗\vec{u} \cdot \vec{v}, exactly and to two decimal places.

Solutionu⃗⋅v⃗=(6)(4)cos⁡45∘=24×22=122≈16.97\vec{u} \cdot \vec{v} = (6)(4)\cos 45^\circ = 24 \times \frac{\sqrt{2}}{2} = 12\sqrt{2} \approx 16.97

2. (Warm-up) Find each dot product.

  • (a) [3,−2]⋅[5,4][3, -2] \cdot [5, 4]
  • (b) [1,0,−4]⋅[2,7,−1][1, 0, -4] \cdot [2, 7, -1]
Solution

(a) 3(5)+(−2)(4)=15−8=73(5) + (-2)(4) = 15 - 8 = 7

(b) 1(2)+0(7)+(−4)(−1)=2+0+4=61(2) + 0(7) + (-4)(-1) = 2 + 0 + 4 = 6

3. (Core) Find the angle between a⃗=[1,2,2]\vec{a} = [1, 2, 2] and b⃗=[3,0,−4]\vec{b} = [3, 0, -4], to one decimal place.

Solution

a⃗⋅b⃗=3+0−8=−5\vec{a} \cdot \vec{b} = 3 + 0 - 8 = -5, ∣a⃗∣=1+4+4=3|\vec{a}| = \sqrt{1 + 4 + 4} = 3, and ∣b⃗∣=9+0+16=5|\vec{b}| = \sqrt{9 + 0 + 16} = 5.

cos⁡θ=−5(3)(5)=−13⇒θ≈109.5∘\cos\theta = \frac{-5}{(3)(5)} = -\frac{1}{3} \qquad\Rightarrow\qquad \theta \approx 109.5^\circ

The negative dot product means the angle is obtuse. ✓

4. (Core) Find all values of kk for which [k,k,3][k, k, 3] and [k,−5,2][k, -5, 2] are perpendicular.

Solution

Set the dot product to zero:

k2−5k+6=0(k−2)(k−3)=0k=2ork=3\begin{aligned} k^2 - 5k + 6 &= 0 \\ (k - 2)(k - 3) &= 0 \\ k = 2 \quad &\text{or} \quad k = 3 \end{aligned}

Check k=2k = 2: [2,2,3]⋅[2,−5,2]=4−10+6=0[2, 2, 3] \cdot [2, -5, 2] = 4 - 10 + 6 = 0. ✓ Check k=3k = 3: [3,3,3]⋅[3,−5,2]=9−15+6=0[3, 3, 3] \cdot [3, -5, 2] = 9 - 15 + 6 = 0. ✓

5. (Core) ∣a⃗∣=3|\vec{a}| = 3, ∣b⃗∣=5|\vec{b}| = 5, and a⃗⋅b⃗=−6\vec{a} \cdot \vec{b} = -6. Use the properties of the dot product to find:

  • (a) (a⃗+2b⃗)⋅(a⃗−b⃗)(\vec{a} + 2\vec{b}) \cdot (\vec{a} - \vec{b})
  • (b) ∣a⃗+b⃗∣|\vec{a} + \vec{b}|
Solution

(a) Expand like a product of binomials (the distributive and commutative properties allow this):

(a⃗+2b⃗)⋅(a⃗−b⃗)=a⃗⋅a⃗−a⃗⋅b⃗+2b⃗⋅a⃗−2b⃗⋅b⃗=∣a⃗∣2+a⃗⋅b⃗−2∣b⃗∣2=9+(−6)−2(25)=−47\begin{aligned} (\vec{a} + 2\vec{b}) \cdot (\vec{a} - \vec{b}) &= \vec{a} \cdot \vec{a} - \vec{a} \cdot \vec{b} + 2\vec{b} \cdot \vec{a} - 2\vec{b} \cdot \vec{b} \\ &= |\vec{a}|^2 + \vec{a} \cdot \vec{b} - 2|\vec{b}|^2 \\ &= 9 + (-6) - 2(25) \\ &= -47 \end{aligned}

(b) Use ∣v⃗∣2=v⃗⋅v⃗|\vec{v}|^2 = \vec{v} \cdot \vec{v}:

∣a⃗+b⃗∣2=∣a⃗∣2+2 a⃗⋅b⃗+∣b⃗∣2=9−12+25=22|\vec{a} + \vec{b}|^2 = |\vec{a}|^2 + 2\,\vec{a} \cdot \vec{b} + |\vec{b}|^2 = 9 - 12 + 25 = 22

So ∣a⃗+b⃗∣=22≈4.69|\vec{a} + \vec{b}| = \sqrt{22} \approx 4.69.

6. (Core) A constant force F⃗=[25,10,−5]\vec{F} = [25, 10, -5] (in newtons) moves an object in a straight line from A(1,2,0)A(1, 2, 0) to B(9,5,4)B(9, 5, 4) (in metres). Find the work done.

Solution

The displacement is d⃗=AB→=[9−1,5−2,4−0]=[8,3,4]\vec{d} = \overrightarrow{AB} = [9 - 1, 5 - 2, 4 - 0] = [8, 3, 4].

W=F⃗⋅d⃗=25(8)+10(3)+(−5)(4)=200+30−20=210 JW = \vec{F} \cdot \vec{d} = 25(8) + 10(3) + (-5)(4) = 200 + 30 - 20 = 210 \text{ J}

7. (Core) A triangle has vertices A(2,1,−1)A(2, 1, -1), B(4,3,0)B(4, 3, 0), and C(1,5,1)C(1, 5, 1). Find the angle at AA, to one decimal place.

Solution

The angle at AA is between AB→\overrightarrow{AB} and AC→\overrightarrow{AC} (both start at AA):

AB→=[2,2,1],AC→=[−1,4,2]\overrightarrow{AB} = [2, 2, 1], \qquad \overrightarrow{AC} = [-1, 4, 2]

AB→⋅AC→=−2+8+2=8\overrightarrow{AB} \cdot \overrightarrow{AC} = -2 + 8 + 2 = 8, ∣AB→∣=4+4+1=3|\overrightarrow{AB}| = \sqrt{4 + 4 + 1} = 3, ∣AC→∣=1+16+4=21|\overrightarrow{AC}| = \sqrt{1 + 16 + 4} = \sqrt{21}.

cos⁡A=8321≈0.5819⇒A≈54.4∘\cos A = \frac{8}{3\sqrt{21}} \approx 0.5819 \qquad\Rightarrow\qquad A \approx 54.4^\circ

8. (Challenge) A rhombus has all four sides equal. Its sides from one corner are a⃗\vec{a} and b⃗\vec{b}, with ∣a⃗∣=∣b⃗∣|\vec{a}| = |\vec{b}|, so its diagonals are a⃗+b⃗\vec{a} + \vec{b} and a⃗−b⃗\vec{a} - \vec{b}. Use the dot product to prove that the diagonals of a rhombus are perpendicular.

Solution(a⃗+b⃗)⋅(a⃗−b⃗)=a⃗⋅a⃗−a⃗⋅b⃗+b⃗⋅a⃗−b⃗⋅b⃗=∣a⃗∣2−∣b⃗∣2a⃗⋅b⃗=b⃗⋅a⃗=0∣a⃗∣=∣b⃗∣\begin{aligned} (\vec{a} + \vec{b}) \cdot (\vec{a} - \vec{b}) &= \vec{a} \cdot \vec{a} - \vec{a} \cdot \vec{b} + \vec{b} \cdot \vec{a} - \vec{b} \cdot \vec{b} \\ &= |\vec{a}|^2 - |\vec{b}|^2 && \vec{a} \cdot \vec{b} = \vec{b} \cdot \vec{a} \\ &= 0 && |\vec{a}| = |\vec{b}| \end{aligned}

The dot product of the diagonals is 00, so they’re perpendicular. (For a rectangle that isn’t a square, ∣a⃗∣≠∣b⃗∣|\vec{a}| \ne |\vec{b}|, so its diagonals are not perpendicular.)

9. (Challenge) Find a vector that is perpendicular to both a⃗=[1,2,0]\vec{a} = [1, 2, 0] and b⃗=[0,1,3]\vec{b} = [0, 1, 3].

Solution

Let the vector be [x,y,z][x, y, z]. It needs a zero dot product with each:

x+2y=0andy+3z=0x + 2y = 0 \qquad\text{and}\qquad y + 3z = 0

That’s two equations in three unknowns, so pick one value. Let z=1z = 1. Then y=−3y = -3, and x=−2y=6x = -2y = 6. One answer is [6,−3,1][6, -3, 1] (any non-zero multiple also works).

Check: [6,−3,1]⋅[1,2,0]=6−6+0=0[6, -3, 1] \cdot [1, 2, 0] = 6 - 6 + 0 = 0 ✓ and [6,−3,1]⋅[0,1,3]=0−3+3=0[6, -3, 1] \cdot [0, 1, 3] = 0 - 3 + 3 = 0 ✓

The cross product gives a vector like this in one step.