# Dot Product

## Definition of the Dot Product

The dot product (or scalar product) of two vectors is the number equal to the product of the lengths of these vectors and the cosine of the angle between them.

The dot product of vectors a and b will be denoted by the symbol a·b. If the angle between vectors a and b is equal to φ, then by definition the dot product of these two vectors is expressed by the formula

$\mathbf{a} \cdot \mathbf{b} = \Vert{\mathbf{a}}\Vert \Vert{\mathbf{b}}\Vert \cos\varphi$

The dot product can also be defined in terms of vector projection. Indeed, the projection of vector b on the axis defined by the vector a is equal to

$\text{proj}_\mathbf{a} \mathbf{b} = \Vert{\mathbf{b}}\Vert \cos\varphi.$

Comparing this with the previous expression, we find

$\mathbf{a} \cdot \mathbf{b} = \Vert{\mathbf{a}}\Vert \text{proj}_\mathbf{a} \mathbf{b}$

In our reasoning, we can reverse the roles of the vectors a and b, which leads to the following expression for the dot product

$\mathbf{a} \cdot \mathbf{b} = \Vert{\mathbf{b}}\Vert \text{proj}_\mathbf{b} \mathbf{a}$

## Geometric Properties of the Dot Product

The dot product of vectors a and b is zero if the vectors a and b are perpendicular, or if one of the vectors a and b or both of them are zero:

$\mathbf{a} \cdot \mathbf{b} = 0 \text{ if } \mathbf{a} \,\bot\, \mathbf{b} \left({\varphi = \frac{\pi}{2}}\right) \text{ or } \mathbf{a} = \mathbf{0} \text{ and/or } \mathbf{b} = \mathbf{0}$

The dot product of two vectors a and b is positive if the angle φ between the vectors a and b is acute:

$\mathbf{a} \cdot \mathbf{b} \gt 0 \text{ if } 0 \le \varphi \lt \frac{\pi}{2}$

The dot product of two vectors a and b is negative if the angle φ between the vectors a and b is obtuse:

$\mathbf{a} \cdot \mathbf{b} \lt 0 \text{ if } \frac{\pi}{2} \lt \varphi \le \pi$

The dot product of two vectors a and b is less than or equal to the product of their lengths:

$\mathbf{a} \cdot \mathbf{b} \le \Vert{\mathbf{a}}\Vert \Vert{\mathbf{b}}\Vert$

The dot product of two vectors a and b is equal to the product of their lengths if only the vectors a and b are parallel:

$\mathbf{a} \cdot \mathbf{b} = \Vert{\mathbf{a}}\Vert \Vert{\mathbf{b}}\Vert \text{ if } \mathbf{a} \parallel \mathbf{b} \left({\varphi = 0}\right)$

## Algebraic Properties of the Dot Product

Commutative law for dot product:

$\mathbf{a} \cdot \mathbf{b} = \mathbf{b} \cdot \mathbf{a}$

Associative law for dot product:

$\left({\alpha\mathbf{a}}\right) \cdot \mathbf{b} = \alpha\left({\mathbf{a} \cdot \mathbf{b}}\right) = \mathbf{a} \cdot \left({\alpha\mathbf{b}}\right)$

Distributive law for dot product:

$\mathbf{a} \cdot \left({\mathbf{b} + \mathbf{c}}\right) = \mathbf{a} \cdot \mathbf{b} + \mathbf{a} \cdot \mathbf{c}$

If a is a nonzero vector, then

$\mathbf{a} \cdot \mathbf{a} \gt 0$

If $$\mathbf{a} = \mathbf{0},$$ then

$\mathbf{a} \cdot \mathbf{a} = 0$

## Dot Product in Cartesian Coordinates

If $$\mathbf{a} = \left({X_1, Y_1, Z_1}\right)$$ and $$\mathbf{b} = \left({X_2, Y_2, Z_2}\right),$$ then the dot product of these vectors is given by

$\mathbf{a} \cdot \mathbf{b} = X_1X_2 + Y_1Y_2 + Z_1Z_2$

The angle φ between vectors $$\mathbf{a} = \left({X_1, Y_1, Z_1}\right)$$ and $$\mathbf{b} = \left({X_2, Y_2, Z_2}\right)$$ is determined by the formula

$\cos\varphi = \frac{\mathbf{a} \cdot \mathbf{b}}{\Vert{\mathbf{a}}\Vert \Vert{\mathbf{b}}\Vert} = \frac{X_1X_2 + Y_1Y_2 + Z_1Z_2}{\sqrt{X_1^2 + Y_1^2 + Z_1^2}\sqrt{X_2^2 + Y_2^2 + Z_2^2}}$

It is assumed here that a and b are nonzero vectors.

The vectors $$\mathbf{a} = \left({X_1, Y_1, Z_1}\right)$$ and $$\mathbf{b} = \left({X_2, Y_2, Z_2}\right)$$ are perpendicular if

$X_1X_2 + Y_1Y_2 + Z_1Z_2 = 0$

The scalar square of a vector is equal to the square of its length. If $$\mathbf{a} = \left({X, Y, Z}\right),$$ then

$\mathbf{a} \cdot \mathbf{a} = \mathbf{a}^2 = \Vert{\mathbf{a}}\Vert^2 = X^2 + Y^2 + Z^2$

Scalar squares of the unit vectors:

$\mathbf{i} \cdot \mathbf{i} = \mathbf{j} \cdot \mathbf{j} = \mathbf{k} \cdot \mathbf{k} = 1$

Dot product of distinct unit vectors:

$\mathbf{i} \cdot \mathbf{j} = \mathbf{j} \cdot \mathbf{k} = \mathbf{k} \cdot \mathbf{i} = 0$

## Some Applications of the Dot Product

### Law of Cosines

Consider two vectors a and b. Let the angle between them be φ. Let's draw a vector c which is equal to the difference of a and b. These three vectors form a triangle.

We derive the Law of Cosines using the dot product of vectors. Express $$\Vert{\mathbf{c}}\Vert^2$$ in terms of a, b and φ.

$\mathbf{c} \cdot \mathbf{c} = \Vert{\mathbf{c}}\Vert^2 = \left({\mathbf{a} - \mathbf{b}}\right) \cdot \left({\mathbf{a} - \mathbf{b}}\right).$

Using the properties of the dot product, we get

$\Vert{\mathbf{c}}\Vert^2 = \left({\mathbf{a} - \mathbf{b}}\right) \cdot \left({\mathbf{a} - \mathbf{b}}\right) = \mathbf{a} \cdot \mathbf{a} - \mathbf{b} \cdot \mathbf{a} - \mathbf{a} \cdot \mathbf{b} + \mathbf{b} \cdot \mathbf{b} = \Vert{\mathbf{a}}\Vert^2 - 2\mathbf{a} \cdot \mathbf{b} + \Vert{\mathbf{b}}\Vert^2 = \Vert{\mathbf{a}}\Vert^2 + \Vert{\mathbf{b}}\Vert^2 - 2\Vert{\mathbf{a}}\Vert \Vert{\mathbf{b}}\Vert \cos\varphi.$

Thus, we have proved the Law of Cosines:

$\Vert{\mathbf{c}}\Vert^2 = \Vert{\mathbf{a}}\Vert^2 + \Vert{\mathbf{b}}\Vert^2 - 2\Vert{\mathbf{a}}\Vert \Vert{\mathbf{b}}\Vert \cos\varphi.$

### Work Done by a Force

If the vector F represents the force, the point of application of which moves along the displacement vector d, then the work W done by the specified force is defined to be

$W = \mathbf{F} \cdot \mathbf{d},$

that is, it is equal to the dot product of the force and displacement vectors.

### Power

The rate at which a force F does work W is called power of that force. It is denoted by the symbol P. Divide the previous expression by the time t:

$P = \frac{W}{t} = \frac{\mathbf{F} \cdot \mathbf{d}}{t}.$

The quantity $$\frac{\mathbf{d}}{t}$$ represents the velocity v of the body. Hence, power is the dot product of the force and velocity vectors:

$P = \frac{W}{t} = \mathbf{F} \cdot \mathbf{v}$

## Solved Problems

Click or tap a problem to see the solution.

### Example 1

Find the dot product of vectors $$\mathbf{a}$$ and $$\mathbf{b}$$ if

1. $$\Vert\mathbf{a}\Vert = 5,$$ $$\Vert\mathbf{b}\Vert = 2,$$ $$\varphi = 60^\circ$$
2. $$\Vert\mathbf{a}\Vert = 1,$$ $$\Vert\mathbf{b}\Vert = 4,$$ $$\varphi = 90^\circ,$$ where $$\varphi$$ is the angle between $$\mathbf{a}$$ and $$\mathbf{b}$$
3. $$\Vert\mathbf{a}\Vert = 3,$$ $$\Vert\mathbf{b}\Vert = 6,$$ vectors $$\mathbf{a}$$ and $$\mathbf{b}$$ are in the same direction
4. $$\Vert\mathbf{a}\Vert = 7,$$ $$\Vert\mathbf{b}\Vert = 2,$$ vectors $$\mathbf{a}$$ and $$\mathbf{b}$$ are in the opposite direction

### Example 2

Given vectors $$\mathbf{a}\left({1,2,3}\right)$$ and $$\mathbf{b}\left({6,4,-2}\right).$$ Calculate:

1. $$\mathbf{a} \cdot \mathbf{b}$$
2. $$\left({\mathbf{a} - 3\mathbf{b}}\right)\left({2\mathbf{a} + \mathbf{b}}\right)$$
3. $$\left({\mathbf{a} + \mathbf{b}}\right)^2$$

### Example 3

Prove that vectors $$\mathbf{a}$$ and $$\mathbf{b}\left({\mathbf{a}\cdot\mathbf{c}}\right) - \mathbf{c}\left({\mathbf{a}\cdot\mathbf{b}}\right)$$ are mutually perpendicular.

### Example 4

Lines drawn from the vertex of a square divide the opposite sides in half. Find the angle between these lines.

### Example 5

Find the angle between bisectors in the xy- and yz-plane.

### Example 6

Given two vectors $$\mathbf{a}\left({2,1}\right)$$ and $$\mathbf{b}\left({1,-3}\right).$$ Find a vector $$\mathbf{x}$$ that satisfies the system of equations ${\left\{ \begin{array}{l} \mathbf{x} \cdot \mathbf{a} = 10\\ \mathbf{x} \cdot \mathbf{b} = -2 \end{array} \right..}$

### Example 1.

Find the dot product of vectors $$\mathbf{a}$$ and $$\mathbf{b}$$ if

1. $$\Vert\mathbf{a}\Vert = 5,$$ $$\Vert\mathbf{b}\Vert = 2,$$ $$\varphi = 60^\circ$$
2. $$\Vert\mathbf{a}\Vert = 1,$$ $$\Vert\mathbf{b}\Vert = 4,$$ $$\varphi = 90^\circ,$$ where $$\varphi$$ is the angle between $$\mathbf{a}$$ and $$\mathbf{b}$$
3. $$\Vert\mathbf{a}\Vert = 3,$$ $$\Vert\mathbf{b}\Vert = 6,$$ vectors $$\mathbf{a}$$ and $$\mathbf{b}$$ are in the same direction
4. $$\Vert\mathbf{a}\Vert = 7,$$ $$\Vert\mathbf{b}\Vert = 2,$$ vectors $$\mathbf{a}$$ and $$\mathbf{b}$$ are in the opposite direction

Solution.

1. The dot product of vectors $$\mathbf{a}$$ and $$\mathbf{b}$$ is defined by the formula
$\mathbf{a} \cdot \mathbf{b} = \Vert{\mathbf{a}}\Vert \Vert{\mathbf{b}}\Vert \cos\varphi.$
Substituting the given values we find
$\mathbf{a} \cdot \mathbf{b} = 5 \cdot 2 \cos60^\circ = 10\cdot\frac{1}{2} = 5;$
2. The vectors $$\mathbf{a}$$ and $$\mathbf{b}$$ are perpendicular. Therefore, their dot product is zero:
$\mathbf{a} \cdot \mathbf{b} = \Vert{\mathbf{a}}\Vert \Vert{\mathbf{b}}\Vert \cos\varphi = 1 \cdot 4\cos90^\circ = 4\cdot0 = 0;$
3. The angle between vectors $$\mathbf{a}$$ and $$\mathbf{b}$$ is equal to zero. Hence
$\mathbf{a} \cdot \mathbf{b} = \Vert{\mathbf{a}}\Vert \Vert{\mathbf{b}}\Vert \cos\varphi = 3 \cdot 6\cos0^\circ = 18\cdot1 = 18;$
4. Here the angle between the vectors is $$180^\circ.$$ Then the dot product is
$\mathbf{a} \cdot \mathbf{b} = \Vert{\mathbf{a}}\Vert \Vert{\mathbf{b}}\Vert \cos\varphi = 7 \cdot 2\cos180^\circ = 14\cdot\left({-1}\right) = -14.$

### Example 2.

Given vectors $$\mathbf{a}\left({1,2,3}\right)$$ and $$\mathbf{b}\left({6,4,-2}\right).$$ Calculate:

1. $$\mathbf{a} \cdot \mathbf{b}$$
2. $$\left({\mathbf{a} - 3\mathbf{b}}\right)\left({2\mathbf{a} + \mathbf{b}}\right)$$
3. $$\left({\mathbf{a} + \mathbf{b}}\right)^2$$

Solution.

1. The dot product of two vectors $$\mathbf{a} = \left({X_1, Y_1, Z_1}\right)$$ and $$\mathbf{b} = \left({X_2, Y_2, Z_2}\right)$$ in coordinate form is given by the formula
$\mathbf{a} \cdot \mathbf{b} = X_1X_2 + Y_1Y_2 + Z_1Z_2.$
Hence,
$\mathbf{a} \cdot \mathbf{b} = 1\cdot6 + 2\cdot4 + 3\cdot\left({-2}\right) = 6 + 8 - 6 = 8;$
2. First we compute the vectors $$\left({\mathbf{a} - 3\mathbf{b}}\right)$$ and $$\left({2\mathbf{a} + \mathbf{b}}\right).$$ By writing them as column vectors, we have
$\mathbf{a} - 3\mathbf{b} = \left[\begin{array}{*{20}{c}} 1\\ 2\\ 3 \end{array} \right] - 3\left[\begin{array}{*{20}{c}} 6\\ 4\\ -2 \end{array} \right] = \left[\begin{array}{*{20}{c}} 1\\ 2\\ 3 \end{array} \right] - \left[\begin{array}{*{20}{c}} 18\\ 12\\ -6 \end{array} \right] = \left[\begin{array}{*{20}{c}} -17\\ -10\\ 9 \end{array} \right];$
$2\mathbf{a} + \mathbf{b} = 2\left[\begin{array}{*{20}{c}} 1\\ 2\\ 3 \end{array} \right] + \left[\begin{array}{*{20}{c}} 6\\ 4\\ -2 \end{array} \right] = \left[\begin{array}{*{20}{c}} 2\\ 4\\ 6 \end{array} \right] + \left[\begin{array}{*{20}{c}} 6\\ 4\\ -2 \end{array} \right] = \left[\begin{array}{*{20}{c}} 8\\ 8\\ 4 \end{array} \right].$
Now we calculate the dot product:
$\left({\mathbf{a} - 3\mathbf{b}}\right)\left({2\mathbf{a} + \mathbf{b}}\right) = \left[\begin{array}{*{20}{c}} -17\\ -10\\ 9 \end{array} \right] \cdot \left[\begin{array}{*{20}{c}} 8\\ 8\\ 4 \end{array} \right] = \left({-17}\right)\cdot8 + \left({-10}\right)\cdot8 + 9\cdot4 = -136-80+36=-180;$
3. It's obvious that
$\mathbf{a} + \mathbf{b} = \left[\begin{array}{*{20}{c}} 1\\ 2\\ 3 \end{array} \right] + \left[\begin{array}{*{20}{c}} 6\\ 4\\ -2 \end{array} \right] = \left[\begin{array}{*{20}{c}} 7\\ 8\\ 1 \end{array} \right].$
Using the formula
$\mathbf{a}^2 = \Vert{\mathbf{a}}\Vert^2 = X^2 +Y^2 +Z^2,$
we find:
$\left({\mathbf{a} + \mathbf{b}}\right)^2 = \Vert{\mathbf{a} + \mathbf{b}}\Vert^2 = 7^2 + 8^2 + 1^2 = 49+64+1=114.$

### Example 3.

Prove that vectors $$\mathbf{a}$$ and $$\mathbf{b}\left({\mathbf{a}\cdot\mathbf{c}}\right) - \mathbf{c}\left({\mathbf{a}\cdot\mathbf{b}}\right)$$ are mutually perpendicular.

Solution.

Compute the dot product of the given vectors:

$\mathbf{a} \cdot \left[{\mathbf{b}\left({\mathbf{a}\cdot\mathbf{c}}\right) - \mathbf{c}\left({\mathbf{a}\cdot\mathbf{b}}\right)}\right] = \mathbf{a} \cdot \mathbf{b}\left({\mathbf{a}\cdot\mathbf{c}}\right) - \mathbf{a} \cdot \mathbf{c}\left({\mathbf{a}\cdot\mathbf{b}}\right) = \left({\mathbf{a}\cdot\mathbf{b}}\right)\left({\mathbf{a}\cdot\mathbf{c}}\right) - \left({\mathbf{a}\cdot\mathbf{c}}\right)\left({\mathbf{a}\cdot\mathbf{b}}\right) = \cancel{\left({\mathbf{a}\cdot\mathbf{b}}\right)\left({\mathbf{a}\cdot\mathbf{c}}\right)} - \cancel{\left({\mathbf{a}\cdot\mathbf{b}}\right)\left({\mathbf{a}\cdot\mathbf{c}}\right)} = \mathbf{0}.$

As you can see, the dot product is zero. This means that the vectors are perpendicular.

### Example 4.

Lines drawn from the vertex of a square divide the opposite sides in half. Find the angle between these lines.

Solution.

Let the points M and N be the midpoints of the sides of the square.

We need to calculate the angle $$\varphi$$ between vectors $$\mathbf{OM} = \mathbf{a}$$ and $$\mathbf{ON} = \mathbf{b}.$$ Introduce the coordinate system as shown in the Figure. In this coordinate system, the coordinates of the points M and N are $$M\left(1, \frac{1}{2}\right),$$ $$N\left(\frac{1}{2}, 1\right).$$

Vectors a and b have the same coordinates:

$\mathbf{a} = \left(1, \frac{1}{2}\right),\;\mathbf{b} = \left(\frac{1}{2}, 1\right).$

Calculate the angle between these vectors using the dot product:

$\cos\varphi = \frac{\mathbf{a}\cdot\mathbf{b}}{\Vert{\mathbf{a}}\Vert \Vert{\mathbf{b}}\Vert} = \frac{X_aX_b + Y_aY_b}{\sqrt{X_a^2 + Y_a^2}\sqrt{X_b^2 + Y_b^2}} = \frac{1\cdot\frac{1}{2} + \frac{1}{2}\cdot1}{\sqrt{1^2 + \left({\frac{1}{2}}\right)^2}\sqrt{\left({\frac{1}{2}}\right)^2 + 1^2}} = \frac{1}{\sqrt{\frac{5}{4}}\sqrt{\frac{5}{4}}} = \frac{4}{5}.$

Therefore, the angle φ is

$\varphi = \arccos\frac{4}{5} \approx 36.9^\circ.$

### Example 5.

Find the angle between bisectors in the xy- and yz-plane.

Solution.

Let OM be the bisector in the xy-plane and ON the bisector in the yz-plane.

Vectors $$\mathbf{OM} = \mathbf{a}$$ and $$\mathbf{ON} = \mathbf{b}$$ built on the bisectors have the following coordinates in the given coordinate system:

$\mathbf{a} = \left({1, 1, 0}\right),\;\mathbf{b} = \left({0,1,1}\right).$

Calculate the angle between vectors a and b:

$\cos\varphi = \frac{\mathbf{a}\cdot\mathbf{b}}{\Vert{\mathbf{a}}\Vert \Vert{\mathbf{b}}\Vert} = \frac{X_aX_b + Y_aY_b + Z_aZ_b}{\sqrt{X_a^2 + Y_a^2 + Z_a^2}\sqrt{X_b^2 + Y_b^2 + Z_b^2}} = \frac{1\cdot0 + 1\cdot1 + 0\cdot1}{\sqrt{1^2 + 1^2 + 0^2}\sqrt{0^2 + 1^2 + 1^2}} = \frac{1}{\sqrt{2}\sqrt{2}} = \frac{1}{2}.$

Hence, the angle between the bisectors is

$\varphi = \arccos\frac{1}{2} = 60^\circ.$

### Example 6.

Given two vectors $$\mathbf{a}\left({2,1}\right)$$ and $$\mathbf{b}\left({1,-3}\right).$$ Find a vector $$\mathbf{x}$$ that satisfies the system of equations ${\left\{ \begin{array}{l} \mathbf{x} \cdot \mathbf{a} = 10\\ \mathbf{x} \cdot \mathbf{b} = -2 \end{array} \right..}$

Solution.

Let vector $$\mathbf{x}$$ have coordinates $$\left({x,y}\right).$$ Then the system of equations can be re-written in coordinate form:

$\left\{ \begin{array}{l} \mathbf{x} \cdot \mathbf{a} = 10\\ \mathbf{x} \cdot \mathbf{b} = -2 \end{array} \right., \Rightarrow \left\{ \begin{array}{l} x\cdot2 + y\cdot1 = 10\\ x\cdot1 + y\cdot\left({-3}\right) = -2 \end{array} \right., \Rightarrow \left\{ \begin{array}{l} 2x + y = 10\\ x -3y = -2 \end{array} \right..$

Solving the resulting system, we find x and y:

$\left\{ \begin{array}{l} 2x + y = 10\\ x -3y = -2 \end{array} \right., \Rightarrow \left\{ \begin{array}{l} y = 10 - 2x\\ x -3\left({10 - 2x}\right) = -2 \end{array} \right., \Rightarrow \left\{ \begin{array}{l} y = 10 - 2x\\ x -30 + 6x = -2 \end{array} \right., \Rightarrow \left\{ \begin{array}{l} y = 10 - 2x\\ 7x = 28 \end{array} \right., \Rightarrow \left\{ \begin{array}{l} y = 2\\ x = 4 \end{array} \right..$

So the vector $$\mathbf{x}$$ is equal to $$\left({4,2}\right).$$