Dot Product

The dot product of two vectors multiplies the matching components and adds them: \langle a, b \rangle \cdot \langle c, d \rangle = ac + bd. The answer is a number, not a vector. It also equals \|\vec{u}\|\,\|\vec{v}\|\cos\theta, so it gives the angle between two vectors. A dot product of 0 means they are perpendicular.

Before this lesson: Magnitude and Direction of a Vector, Adding and Subtracting Vectors and Inverse Trig Functions

What the dot product measures

Adding vectors gives a new vector. The dot product is a different kind of product: it takes two vectors and returns one number, called a scalar.

That number tells you how much the two vectors point the same way. If they point in nearly the same direction, the dot product is large and positive. If they are perpendicular, it is 0. If they point in roughly opposite directions, it is negative.

Perpendicular vectors are also called orthogonal. The dot product is the fastest test for a right angle between two vectors.

Left: vectors u = ⟨4, 3⟩ and v = ⟨1, 7⟩ start at the origin with a 45° angle between them, since u · v = 25 and cos θ = 25 / (5 · 5√2). Right: three sketches. A positive dot product means an acute angle, a dot product of 0 means a right angle, and a negative dot product means an obtuse angle.
The sign of the dot product tells you the kind of angle before you find it: positive is acute, 0 is right, negative is obtuse.

Dot product formulas

For \vec{u} = \langle a, b \rangle and \vec{v} = \langle c, d \rangle:

\vec{u} \cdot \vec{v} = ac + bd

If \theta is the angle between the vectors, with 0^\circ \le \theta \le 180^\circ:

\vec{u} \cdot \vec{v} = \|\vec{u}\|\,\|\vec{v}\|\cos\theta \qquad \cos\theta = \frac{\vec{u} \cdot \vec{v}}{\|\vec{u}\|\,\|\vec{v}\|}
PropertyRule
Order does not matter\vec{u} \cdot \vec{v} = \vec{v} \cdot \vec{u}
A vector with itself\vec{u} \cdot \vec{u} = \|\vec{u}\|^2
Scalars factor out(k\vec{u}) \cdot \vec{v} = k(\vec{u} \cdot \vec{v})
It distributes\vec{u} \cdot (\vec{v} + \vec{w}) = \vec{u} \cdot \vec{v} + \vec{u} \cdot \vec{w}
Orthogonal test\vec{u} \cdot \vec{v} = 0 exactly when the vectors are perpendicular (for nonzero vectors)

Dot product examples

Example 1: Find a dot product

Find \langle 3, -2 \rangle \cdot \langle 5, 4 \rangle.

\langle 3, -2 \rangle \cdot \langle 5, 4 \rangle = 3(5) + (-2)(4)

Multiply the x-components and multiply the y-components.

\langle 3, -2 \rangle \cdot \langle 5, 4 \rangle = 15 + (-8)

Multiply (see multiplying integers).

\langle 3, -2 \rangle \cdot \langle 5, 4 \rangle = 7

Add.

Answer: 7. The result is positive, so the angle between the vectors is acute.

Example 2: The angle between two vectors

Find the angle between \vec{u} = \langle 4, 3 \rangle and \vec{v} = \langle 1, 7 \rangle.

\vec{u} \cdot \vec{v} = 4(1) + 3(7)

Multiply matching components and add.

\vec{u} \cdot \vec{v} = 25

Simplify: 4 + 21 = 25.

\|\vec{u}\| = \sqrt{4^2 + 3^2}

Find the magnitude of u (see magnitude of a vector).

\|\vec{u}\| = 5

Square, add and take the root: \sqrt{25} = 5.

\|\vec{v}\| = \sqrt{1^2 + 7^2}

Find the magnitude of v.

\|\vec{v}\| = \sqrt{50}

Square and add: 1 + 49 = 50.

\|\vec{v}\| = 5\sqrt{2}

Simplify the root, since 50 = 25 · 2 (see simplifying square roots).

\cos\theta = \frac{25}{5 \cdot 5\sqrt{2}}

Substitute into \cos\theta = \frac{\vec{u} \cdot \vec{v}}{\|\vec{u}\|\,\|\vec{v}\|}.

\cos\theta = \frac{1}{\sqrt{2}}

Simplify: 25 over 25 is 1.

\theta = 45^\circ

\cos 45^\circ = \frac{1}{\sqrt{2}} = \frac{\sqrt{2}}{2} (see trig values of special angles).

Answer: the angle is 45°, as the graph above shows.

Example 3: An obtuse angle

Find the angle between \vec{u} = \langle 2, -1 \rangle and \vec{v} = \langle -3, 4 \rangle to the nearest tenth of a degree.

\vec{u} \cdot \vec{v} = 2(-3) + (-1)(4)

Multiply matching components and add.

\vec{u} \cdot \vec{v} = -6 + (-4)

Multiply.

\vec{u} \cdot \vec{v} = -10

Add. A negative result means the angle is obtuse.

\|\vec{u}\| = \sqrt{2^2 + (-1)^2}

Find the magnitude of u.

\|\vec{u}\| = \sqrt{5}

Square and add: 4 + 1 = 5.

\|\vec{v}\| = \sqrt{(-3)^2 + 4^2}

Find the magnitude of v.

\|\vec{v}\| = 5

Square, add and take the root: \sqrt{25} = 5.

\cos\theta = \frac{-10}{5\sqrt{5}}

Substitute into the angle formula.

\cos\theta = \frac{-2}{\sqrt{5}}

Divide the top and bottom by 5.

\cos\theta \approx -0.8944

Change to a decimal. Keep 4 places so the angle stays accurate.

\theta \approx \cos^{-1}(-0.8944)

Undo the cosine with the inverse cosine.

\theta \approx 153.4^\circ

Use a calculator in degree mode.

Answer: about 153.4°. The inverse cosine always gives an angle from 0° to 180°, which is exactly the range of angles between two vectors, so no quadrant fix is needed.

Example 4: Find a value that makes vectors orthogonal

Find k so that \langle k, 5 \rangle and \langle 3, -6 \rangle are orthogonal.

\langle k, 5 \rangle \cdot \langle 3, -6 \rangle = 0

Orthogonal vectors have a dot product of 0.

3k + 5(-6) = 0

Multiply matching components and add.

3k - 30 = 0

Multiply.

3k = 30

Add 30 to both sides (see two-step equations).

k = 10

Divide both sides by 3.

Answer: k = 10. Check: \langle 10, 5 \rangle \cdot \langle 3, -6 \rangle = 30 - 30 = 0.

Example 5: Word problem with sales totals

A school store sold 120 shirts and 85 hats. Shirts cost $15 and hats cost $12. Write a quantity vector and a price vector, and use the dot product to find the total sales.

\vec{q} = \langle 120, 85 \rangle

The quantity vector lists how many of each item sold.

\vec{p} = \langle 15, 12 \rangle

The price vector lists the matching prices, in the same order.

\vec{q} \cdot \vec{p} = 120(15) + 85(12)

Multiply matching components and add.

\vec{q} \cdot \vec{p} = 1800 + 1020

Multiply.

\vec{q} \cdot \vec{p} = 2820

Add.

Answer: total sales were $2,820. Each product of matching components is the money from one item, and the dot product adds them up.

Common mistakes

MistakeExample of the errorFix
Writing the dot product as a vector\langle 3, -2 \rangle \cdot \langle 5, 4 \rangle = \langle 15, -8 \rangleAdd the products: 15 + (−8) = 7. A dot product is one number.
Losing a sign when multiplying(-4)(-2) = -8Two negatives make a positive: (-4)(-2) = 8.
Leaving out the magnitudes in the angle formula\theta = \cos^{-1}(25)Divide by \|\vec{u}\|\,\|\vec{v}\| first, so the value is between −1 and 1.
Thinking a negative dot product is a mistakeRechecking \vec{u} \cdot \vec{v} = -10 because it “can’t be negative”Negative is allowed. It means the angle is obtuse.
Mixing up orthogonal and parallelCalling vectors parallel because their dot product is 0A dot product of 0 means perpendicular. Parallel vectors are scalar multiples of each other.
Rounding \cos\theta too earlyUsing −0.9 for −0.8944 and getting 154.2°Keep at least 4 decimal places, or enter the exact fraction into the calculator.

Related methods

Why the angle formula works

Draw u and v from the same point, and join their tips to make a triangle. The third side is \vec{u} - \vec{v}. Applying the law of cosines to that triangle and expanding \|\vec{u} - \vec{v}\|^2 gives \vec{u} \cdot \vec{v} = \|\vec{u}\|\,\|\vec{v}\|\cos\theta.

Perpendicular slopes

The direction vectors of two lines with slopes m and n are \langle 1, m \rangle and \langle 1, n \rangle. Their dot product is 1 + mn, which is 0 exactly when mn = −1. That is the slope rule for perpendicular lines.

Rows times columns

Each entry in a matrix product is a dot product: a row of the first matrix dotted with a column of the second.

Practice problems

  1. Find \langle 2, 7 \rangle \cdot \langle -3, 1 \rangle.
  2. Find \langle -4, -5 \rangle \cdot \langle -2, 6 \rangle.
  3. For \vec{u} = \langle 5, -12 \rangle, find \vec{u} \cdot \vec{u}. How does it compare with \|\vec{u}\|?
  4. Find the angle between \langle 1, 0 \rangle and \langle 1, 1 \rangle.
  5. Find the angle between \langle 3, 4 \rangle and \langle -4, 3 \rangle.
  6. Find the angle between \langle 5, 2 \rangle and \langle 1, -3 \rangle to the nearest tenth of a degree.
  7. Find the angle between \langle 6, 1 \rangle and \langle 2, 3 \rangle to the nearest tenth of a degree.
  8. Are \langle 2, -6 \rangle and \langle -1, 3 \rangle orthogonal, parallel or neither?
  9. Find k so that \langle 4, k \rangle and \langle -3, 2 \rangle are orthogonal.
  10. A coffee cart sold 64 lattes at $4.50 and 38 muffins at $3.25. Use a dot product to find the total sales.
Show answers

1.

\langle 2, 7 \rangle \cdot \langle -3, 1 \rangle = 2(-3) + 7(1)

Multiply matching components and add.

\langle 2, 7 \rangle \cdot \langle -3, 1 \rangle = -6 + 7

Multiply.

\langle 2, 7 \rangle \cdot \langle -3, 1 \rangle = 1

Add.

Answer: 1

2.

\langle -4, -5 \rangle \cdot \langle -2, 6 \rangle = (-4)(-2) + (-5)(6)

Multiply matching components and add.

\langle -4, -5 \rangle \cdot \langle -2, 6 \rangle = 8 + (-30)

Multiply.

\langle -4, -5 \rangle \cdot \langle -2, 6 \rangle = -22

Add.

Answer: −22

3.

\vec{u} \cdot \vec{u} = 5(5) + (-12)(-12)

Dot u with itself.

\vec{u} \cdot \vec{u} = 25 + 144

Multiply.

\vec{u} \cdot \vec{u} = 169

Add.

\|\vec{u}\| = \sqrt{169}

The magnitude is the square root of the same sum.

\|\vec{u}\| = 13

Take the square root.

Answer: 169, which is 13^2 = \|\vec{u}\|^2.

4.

\langle 1, 0 \rangle \cdot \langle 1, 1 \rangle = 1(1) + 0(1)

Multiply matching components and add.

\langle 1, 0 \rangle \cdot \langle 1, 1 \rangle = 1

Simplify.

\cos\theta = \frac{1}{1 \cdot \sqrt{2}}

The magnitudes are 1 and \sqrt{1 + 1} = \sqrt{2}.

\theta = 45^\circ

\cos 45^\circ = \frac{1}{\sqrt{2}}.

Answer: 45°

5.

\langle 3, 4 \rangle \cdot \langle -4, 3 \rangle = 3(-4) + 4(3)

Multiply matching components and add.

\langle 3, 4 \rangle \cdot \langle -4, 3 \rangle = -12 + 12

Multiply.

\langle 3, 4 \rangle \cdot \langle -4, 3 \rangle = 0

Add. A dot product of 0 means the vectors are perpendicular.

Answer: 90°

6.

\langle 5, 2 \rangle \cdot \langle 1, -3 \rangle = 5(1) + 2(-3)

Multiply matching components and add.

\langle 5, 2 \rangle \cdot \langle 1, -3 \rangle = -1

Simplify: 5 − 6 = −1.

\cos\theta = \frac{-1}{\sqrt{29}\,\sqrt{10}}

The magnitudes are \sqrt{25 + 4} = \sqrt{29} and \sqrt{1 + 9} = \sqrt{10}.

\cos\theta = \frac{-1}{\sqrt{290}}

Multiply the roots (see multiplying radicals).

\cos\theta \approx -0.0587

Change to a decimal.

\theta \approx 93.4^\circ

Take the inverse cosine in degree mode.

Answer: about 93.4°

7.

\langle 6, 1 \rangle \cdot \langle 2, 3 \rangle = 6(2) + 1(3)

Multiply matching components and add.

\langle 6, 1 \rangle \cdot \langle 2, 3 \rangle = 15

Simplify: 12 + 3 = 15.

\cos\theta = \frac{15}{\sqrt{37}\,\sqrt{13}}

The magnitudes are \sqrt{36 + 1} = \sqrt{37} and \sqrt{4 + 9} = \sqrt{13}.

\cos\theta = \frac{15}{\sqrt{481}}

Multiply the roots.

\cos\theta \approx 0.6839

Change to a decimal.

\theta \approx 46.8^\circ

Take the inverse cosine in degree mode.

Answer: about 46.8°

8.

\langle 2, -6 \rangle = -2\langle -1, 3 \rangle

Check for a scalar multiple: −2 times each component of \langle -1, 3 \rangle gives \langle 2, -6 \rangle.

\langle 2, -6 \rangle \cdot \langle -1, 3 \rangle = -2 + (-18)

Check the dot product: 2(−1) + (−6)(3).

\langle 2, -6 \rangle \cdot \langle -1, 3 \rangle = -20

Add. It is not 0, so they are not orthogonal.

Answer: parallel (they point in opposite directions, at 180°)

9.

\langle 4, k \rangle \cdot \langle -3, 2 \rangle = 0

Orthogonal vectors have a dot product of 0.

4(-3) + 2k = 0

Multiply matching components and add.

-12 + 2k = 0

Multiply.

2k = 12

Add 12 to both sides.

k = 6

Divide both sides by 2.

Answer: k = 6

10.

\vec{q} \cdot \vec{p} = 64(4.50) + 38(3.25)

Dot the quantity vector \langle 64, 38 \rangle with the price vector \langle 4.50, 3.25 \rangle.

\vec{q} \cdot \vec{p} = 288 + 123.50

Multiply.

\vec{q} \cdot \vec{p} = 411.50

Add.

Answer: $411.50

Dot product FAQ

What does the dot product tell you?

It tells you how much two vectors point the same way. Its sign gives the kind of angle between them, and dividing by the magnitudes gives the cosine of that angle.

How do you find the angle between two vectors?

Use \cos\theta = \frac{\vec{u} \cdot \vec{v}}{\|\vec{u}\|\,\|\vec{v}\|}, then take the inverse cosine. The answer is always between 0° and 180°.

How do you know if two vectors are orthogonal?

Find their dot product. If it is 0, the vectors are orthogonal, which means perpendicular.

Can a dot product be negative?

Yes. A negative dot product means the angle between the vectors is more than 90°.

Summary

  • The dot product multiplies matching components and adds: \langle a, b \rangle \cdot \langle c, d \rangle = ac + bd.
  • The result is a scalar (a number), not a vector.
  • \cos\theta = \frac{\vec{u} \cdot \vec{v}}{\|\vec{u}\|\,\|\vec{v}\|} gives the angle between two vectors, from 0° to 180°.
  • Positive means acute, 0 means perpendicular (orthogonal), negative means obtuse.
  • \vec{u} \cdot \vec{u} = \|\vec{u}\|^2.

Previous lesson: Adding and Subtracting Vectors

Next lesson: Vector Word Problems

Back to the Precalculus Index