topic badge
Middle Years

13.05 Dot product and angle between 2 vectors

Lesson

The dot (or scalar) product is a scalar quantity representing the result of scaling one vector by another. Importantly, when the dot product is calculated, it only scales those components of the vectors that are in the same direction. It has many applications in physics and engineering for calculating scalar quantities such as energy that result from vector quantities such as force and displacement.

For example, consider the two vectors $\mathbf{a}=\left(4,0\right)$a=(4,0) and $\mathbf{b}=\left(6,0\right)$b=(6,0):

If we want to find the result of scaling one vector by the other (find the dot or scalar product) we look at the components of the vectors in the same direction, multiply and sum them together. That is:

In the $x$x direction we have $4\times6=24$4×6=24. In the In the $y$y direction we have $0\times0=0$0×0=0. Therefore the dot product written $\mathbf{a}\cdot\mathbf{b}$a·b is:

$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $4\times6+0\times0$4×6+0×0
$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $24$24

 

Note that the scaling is only applied between equivalent direction components of the two vectors.

Consider the two vectors in different directions $\mathbf{u}=\left(2,4\right)$u=(2,4) and $\mathbf{v}=\left(3,0\right)$v=(3,0):

The dot product $\mathbf{u}\cdot\mathbf{v}$u·v is:

$\mathbf{u}\cdot\mathbf{v}$u·v $=$= $2\times3+4\times0$2×3+4×0
$\mathbf{u}\cdot\mathbf{v}$u·v $=$= $6$6

 

Let's now consider two perpendicular vectors $\mathbf{u}=\left(4,0\right)$u=(4,0) and $\mathbf{v}=\left(0,3\right)$v=(0,3). intuitively we may be able to see that these vectors have zero scaling effect on each other as they don't have any common direction non-zero components.

The dot product $\mathbf{c}\cdot\mathbf{d}$c·d is:

$\mathbf{u}\cdot\mathbf{v}$u·v $=$= $4\times0+0\times3$4×0+0×3
$\mathbf{u}\cdot\mathbf{v}$u·v $=$= $0$0

 

The dot product can be defined as follows:

The dot (or scalar) product

The dot (or scalar) product of two vectors $\mathbf{a}=\left(x_1,y_1\right)=x_1\mathbf{i}+y_1\mathbf{j}$a=(x1,y1)=x1i+y1j and $\mathbf{b}=\left(x_2,y_2\right)=x_2\mathbf{i}+y_2\mathbf{j}$b=(x2,y2)=x2i+y2j is:

$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $x_1x_2+y_1y_2$x1x2+y1y2

 

Practice question

Question 1

Find the dot product of $\vec{u}$u$=$=$\left(6,5\right)$(6,5) and $\vec{v}$v$=$=$\left(7,-2\right)$(7,2).

Dot product of a vector with itself

Take the vector $\mathbf{u}=a\mathbf{i}+b\mathbf{j}$u=ai+bj. Taking the dot product of $\mathbf{u}$u with itself gives:

$\mathbf{u}\cdot\mathbf{u}$u·u $=$= $a^2+b^2$a2+b2

 

But $a^2+b^2=\left|\mathbf{u}\right|^2$a2+b2=|u|2, therefore:

$\mathbf{u}\cdot\mathbf{u}$u·u $=$= $\left|\mathbf{u}\right|^2$|u|2

 

The dot product of a vector with itself

For a vector $\mathbf{u}=a\mathbf{i}+b\mathbf{j}$u=ai+bj:

$\mathbf{u}\cdot\mathbf{u}$u·u $=$= $\left|\mathbf{u}\right|^2$|u|2

 

Dot product and the angle between two vectors

Consider two vectors $\mathbf{a}=\left(a_1,a_2\right)$a=(a1,a2) and $\mathbf{b}=\left(b_1,b_2\right)$b=(b1,b2) shown below. We will call the angle between the two vectors $\theta$θ and have marked in the difference in the two vectors $\mathbf{b}-\mathbf{a}$ba.

By the cosine rule, we have:

$\left|\mathbf{b-a}\right|^2$|ba|2 $=$= $\left|\mathbf{a}\right|^2+\left|\mathbf{b}\right|^2-2\left|\mathbf{a}\right|\left|\mathbf{b}\right|\cos\theta$|a|2+|b|22|a||b|cosθ

 

The squared length of vector $|\mathbf{b-a}|$|ba| is $(b_1-a_1)^2+(b_2-a_2)^2$(b1a1)2+(b2a2)2. So, on replacing the magnitudes by their values calculated from the coordinates, we have:

$(b_1-a_1)^2+(b_2-a_2)^2$(b1a1)2+(b2a2)2 $=$= $a_1^2+a_2^2+b_1^2+b_2^2-2\sqrt{a_1^2+a_2^2}\sqrt{b_1^2+b_2^2}\cos\theta$a21+a22+b21+b222a21+a22b21+b22cosθ

 

When we expand the brackets on the left and collect like terms, we find:

$b_1a_1+b_2a_2$b1a1+b2a2 $=$= $\sqrt{a_1^2+a_2^2}\sqrt{b_1^2+b_2^2}\cos\theta$a21+a22b21+b22cosθ

 

Therefore:

 

$\cos\theta$cosθ $=$= $\frac{b_1a_1+b_2a_2}{\sqrt{a_1^2+a_2^2}\sqrt{b_1^2+b_2^2}}$b1a1+b2a2a21+a22b21+b22

 

But $$, $\sqrt{a_1^2+a_2^2}=\left|\mathbf{a}\right|$a21+a22=|a| and $\sqrt{b_1^2+b_2^2}=\left|\mathbf{b}\right|$b21+b22=|b| therefore:

$\cos\theta$cosθ $=$= $\frac{\mathbf{a}\cdot\mathbf{b}}{\left|\mathbf{a}\right|\left|\mathbf{b}\right|}$a·b|a||b|

 

The dot product and the angle between two vectors

For two vectors $\mathbf{a}$a and $\mathbf{b}$b with an angle $\theta$θ between them:

$\cos\theta$cosθ $=$= $\frac{\mathbf{a}\cdot\mathbf{b}}{\left|\mathbf{a}\right|\left|\mathbf{b}\right|}$a·b|a||b|

Or:

$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $\left|\mathbf{a}\right|\left|\mathbf{b}\right|\cos\theta$|a||b|cosθ

Worked example

Example 1

Two vectors in coordinate form are $\mathbf{u}=(3,-1)$u=(3,1) and $\mathbf{v}=(-5,2)$v=(5,2). Find the angle $\theta$θ between them.

Think: We need the magnitudes $|\mathbf{u}|$|u| and $|\mathbf{v}|$|v|. Then, we need the dot product $\mathbf{u}\cdot\mathbf{v}$u·v.

Do: The magnitudes $|\mathbf{u}|$|u| is given by:

$\left|\mathbf{u}\right|$|u| $=$= $\sqrt{9+1}$9+1
$\left|\mathbf{u}\right|$|u| $=$= $\sqrt{10}$10

 

Do: The magnitudes $|\mathbf{v}|$|v| is given by:

$\left|\mathbf{v}\right|$|v| $=$= $\sqrt{25+4}$25+4
$\left|\mathbf{u}\right|$|u| $=$= $\sqrt{29}$29

 

The dot product $\mathbf{u}\cdot\mathbf{v}$u·v is given by:

$\left|\mathbf{v}\right|$|v| $=$= $3\times(-5)+(-1)\times2$3×(5)+(1)×2
$\left|\mathbf{v}\right|$|v| $=$= $-17$17

 

Therefore:

$\cos\theta$cosθ $=$= $\frac{-17}{\sqrt{10}\sqrt{29}}$171029
$\theta$θ $=$= $\cos^{-1}\frac{-17}{\sqrt{10}\sqrt{29}}$cos1171029
$\theta$θ $\approx$ $177^\circ$177°

 

The vectors are pointing in almost opposite directions.

Practice questions

Question 2

Consider the vectors $A=\left(-7,2\right)$A=(7,2) and $B=\left(7,8\right)$B=(7,8).

  1. Find the exact magnitude of vector $A$A:

  2. Find the exact magnitude of vector $B$B:

  3. Find the dot product of $A$A and $B$B:

  4. Use the results of your previous calculations to determine the angle $\theta$θ between vectors $A$A and $B$B. Give $\theta$θ in degrees, correct to one decimal place.

Question 3

Consider the vectors $U=2i+j$U=2i+j and $V=3i-6j$V=3i6j.

  1. Find the exact magnitude of vector $U$U:

  2. Find the exact magnitude of vector $V$V:

  3. Find the dot product of $U$U and $V$V:

  4. Use the results of your previous calculations to determine the angle $\theta$θ between vectors $U$U and $V$V. Give $\theta$θ in degrees, correct to two decimal places.

Perpendicular and parallel vectors

Perpendicular vectors

Given two perpendicular vectors $\mathbf{a}$a and $\mathbf{b}$b we can say that:

$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $\left|\mathbf{a}\right|\left|\mathbf{b}\right|\cos90$|a||b|cos90
$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $\left|\mathbf{a}\right|\left|\mathbf{b}\right|\times0$|a||b|×0
$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $0$0

 

Therefore we can say that: 

Perpendicular vectors

Two vectors $\mathbf{a}$a and $\mathbf{b}$b are perpendicular if $\mathbf{a}\cdot\mathbf{b}=0$a·b=0

Parallel vectors

Given two parallel vectors $\mathbf{a}$a and $\mathbf{b}$b we can say:

If are in the same direction: 

$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $\left|\mathbf{a}\right|\left|\mathbf{b}\right|\cos0$|a||b|cos0
$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $\left|\mathbf{a}\right|\left|\mathbf{b}\right|\times1$|a||b|×1
$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $\left|\mathbf{a}\right|\left|\mathbf{b}\right|$|a||b|

 

If are in the opposite direction: 

$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $\left|\mathbf{a}\right|\left|\mathbf{b}\right|\cos180$|a||b|cos180
$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $\left|\mathbf{a}\right|\left|\mathbf{b}\right|\times-1$|a||b|×1
$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $-\left|\mathbf{a}\right|\left|\mathbf{b}\right|$|a||b|

 

Therefore we can say that: 

Parallel vectors

Two vectors $\mathbf{a}$a and $\mathbf{b}$b are parallel if:

$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $\left|\mathbf{a}\right|\left|\mathbf{b}\right|$|a||b| for vectors in the same direction
$\mathbf{a}\cdot\mathbf{b}$a·b $=$= $-\left|\mathbf{a}\right|\left|\mathbf{b}\right|$|a||b| for vectors in opposite directions

 

Practice questions

Question 4

Are the vectors $a=6i+4j$a=6i+4j and $b=2i-3j$b=2i3j perpendicular, parallel or neither?

  1. Perpendicular

    A

    Parallel

    B

    Neither

    C

Question 5

The vectors $Ai+3j$Ai+3j and $-10i-15j-Bk$10i15jBk are collinear.

  1. Find $A$A.

  2. Find $B$B.

What is Mathspace

About Mathspace