The scalar product

Geometry
Vectors
Linear mathematics
Author

Isabella Lewis

Summary
The scalar product is an important concept in the theory of vectors, with many geometric and algebraic applications.

Before reading this guide, you must have a good initial knowledge of vectors. Therefore, it is highly recommended that you read Guide: Introduction to vectors. You should be able to understand the components of a vector and be able to work out the magnitude of a vector before continuing.

What is the scalar product?

When working with vectors, you want to be able to combine them in order to solve problems involving vectors in three dimensional space. This may extend to finding the angle between two vectors or testing to see if two vectors are perpendicular or not. The tool you need for these endeavours is the scalar product.

The scalar product also known as the dot product (due to the symbol for the operation) or inner product (as one of the many inner products that exist in linear mathematics), essentially measures how much two vectors are pointing in the same direction. This measure can then be used to find the angle between two vectors.

As you might imagine, this is an important tool if you are working with vectors in three dimensional space. The scalar product has many applications in geometry, multivariable calculus, physics, and chemistry.

This guide will give both the algebraic and geometric definition of the scalar product, explain certain properties of the operation, show you how to find the angle between two vectors using the scalar product, and bring awareness to special cases that arise, such as being able to determine whether or not two vectors are perpendicular.

As with all other introductory guides to vectors (including Guide: Introduction to vectors and Guide: Vector addition and scalar multiplication), the vectors in this guide are exclusively three dimensional.

Algebraic definition

Working out the scalar product of two vectors algebraically is based on their components.

Algebraic definition of the scalar product

Let \(\mathbf{a} = a_1 \mathbf{i} + a_2 \mathbf{j} + a_3 \mathbf{k}\) and \(\mathbf{b} = b_1 \mathbf{i} + b_2 \mathbf{j} + b_3 \mathbf{k}\) be two vectors. The scalar product of \(\mathbf{a}\) and \(\mathbf{b}\), written as \(\mathbf{a}\cdot\mathbf{b}\), is given by \[\mathbf{a}\cdot\mathbf{b} = a_1b_1 + a_2b_2 + a_3b_3.\]

Similarly, in column notation \(\mathbf{a}= \begin{pmatrix}a_1\\ a_2 \\a_3\end{pmatrix}\) and \(\mathbf{b} =\begin{pmatrix}b_1\\ b_2 \\b_3\end{pmatrix}\), then:

\[\mathbf{a} \cdot \mathbf{b} = \begin{pmatrix}a_1\\ a_2 \\a_3\end{pmatrix}\cdot\begin{pmatrix}b_1\\ b_2 \\b_3\end{pmatrix} = a_1b_1 + a_2b_2 + a_3b_3\]

The most important thing to take away from this definition is the following:

Warning

The output of the scalar product of two vectors is a scalar. So if you are working out the scalar product of two vectors and your answer is either a column vector or contains \(\mathbf{i},\mathbf{j},\mathbf{k}\), then your answer is incorrect and should be recalculated.

Example 1

Take \(\mathbf{a}=\begin{pmatrix}3\\5\\1\end{pmatrix}\) and \(\mathbf{b} =\begin{pmatrix}2\\7\\2\end{pmatrix}\), then the scalar product is \[\begin{pmatrix}3\\ 5 \\1\end{pmatrix}\cdot\begin{pmatrix}2\\ 7 \\2\end{pmatrix} = (3)(2) + (5)(7) + (1)(2) = 6+35+2 = 43\]

Example 2

Take \(\mathbf{a}=\begin{pmatrix}-1\\7\\1\end{pmatrix}\) and \(\mathbf{b} =\begin{pmatrix}-1\\-1\\2\end{pmatrix}\), then the scalar product is \[\begin{pmatrix}-1\\ 7 \\1\end{pmatrix}\cdot\begin{pmatrix}-1\\ -1 \\2\end{pmatrix} = (-1)(-1) + (7)(-1) + (1)(2) = 1-7+2 = -4\]

Important

Notice from Example 2 that the scalar product of two vectors can be a negative number.

Example 3

Take \(\mathbf{u}=4\mathbf{i}+2\mathbf{j}+\mathbf{k}\) and \(\mathbf{v}=\mathbf{i}-\mathbf{j}+3\mathbf{k}\), then \[\mathbf{u}\cdot\mathbf{v}=(4\mathbf{i}+2\mathbf{j}+\mathbf{k})\cdot(\mathbf{i}-\mathbf{j}+3\mathbf{k})=(4)(1)+(2)(-1)+(1)(3)=5\]

Geometric definition

It was mentioned in the introduction that the scalar product can be used to measure how much of a vector points in the direction of another. However, there is nothing in the algebraic definition to suggest why this is the case. The second definition of the scalar product relies on the magnitude of the two vectors and the smallest angle between them.

Geometric defintion of the scalar product

For two vectors \(\mathbf{a}\) and \(\mathbf{b}\), their scalar product \(\mathbf{a}\cdot\mathbf{b}\) can also be defined as follows: \[\mathbf{a}\cdot\mathbf{b}=|\mathbf{a}||\mathbf{b}|\cos(\theta)\] where \(|\mathbf{a}|,|\mathbf{b}|\) are the magnitudes of \(\mathbf{a}\) and \(\mathbf{b}\) respectively and \(\theta\) (pronounced ‘theta’) is the smallest angle between \(\mathbf{a}\) and \(\mathbf{b}\).

You can use this definition to find the angle between two (non-zero) vectors \(\mathbf{a}\) and \(\mathbf{b}\). Since these vectors are non-zero, both \(|\mathbf{a}|\) and \(|\mathbf{b}|\) are non-zero. You can then divide both sides of the geometric definition of the scalar product to get \[\cos(\theta) = \frac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{a}||\mathbf{b}|}.\]

Since \(\theta\) is the smallest angle between \(\mathbf{a}\) and \(\mathbf{b}\) by definition, it follows that \(0^\circ\leq \theta \leq 180^\circ\) in degrees, or \(0\leq \theta \leq \pi\) in radians. This means that you can safely use the inverse trigonometric function \(\cos^{-1}\) in this case. (See [Guide: Inverse trigonometric functions] for more.)

Let’s now put this definition to use!

Example 4

Take \(\mathbf{a}=\begin{pmatrix}3\\5\\1\end{pmatrix}\) and \(\mathbf{b} =\begin{pmatrix}2\\7\\2\end{pmatrix}\), as in Example 1. In that example, it was calculated that \(\mathbf{a}\cdot\mathbf{b} = 43\). So you can use the above definition to calculate the smallest angle \(\theta\) between the two vectors.

\[\cos(\theta)=\frac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{a}||\mathbf{b}|}=\frac{43}{\left(\sqrt{3^2+5^2+1^2}\right)\left(\sqrt{2^2+7^2+2^2}\right)}=\frac{43}{\sqrt{35}\sqrt{57}}\] You will need a calculator or computer to work out the value of \(\theta\) via \(\cos^{-1}\). To avoid rounding errors, you should find the inverse cosine of this exact value in your calculator or computer. Doing this gives \[\begin{align*} \theta=\cos^{-1}\left(\frac{43}{\sqrt{35}\sqrt{57}}\right) = {15.695^\circ} = 0.274\textsf{ rad}\tag{\textsf{to 3dp}} \end{align*}\]

Example 5

Take \(\mathbf{a}=\begin{pmatrix}-1\\7\\1\end{pmatrix}\) and \(\mathbf{b} =\begin{pmatrix}-1\\-1\\2\end{pmatrix}\), then the scalar product is \[\begin{pmatrix}-1\\ 7 \\1\end{pmatrix}\cdot\begin{pmatrix}-1\\ -1 \\2\end{pmatrix} = (-1)(-1) + (7)(-1) + (1)(2) = 1-7+2 = -4\]

Take \(\mathbf{a}=\begin{pmatrix}-1\\7\\1\end{pmatrix}\) and \(\mathbf{b} =\begin{pmatrix}-1\\-1\\2\end{pmatrix}\), as in Example 2. It was calculated then that the scalar product between them is \(-4\). So, the angle between them can be calculated as follows: \[\cos(\theta)=\frac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{a}||\mathbf{b}|}=\frac{-4}{\left(\sqrt{(-1)^2+7^2+1^2}\right)\left(\sqrt{(-1)^2+(-1)^2+2^2}\right)}=\frac{-4}{\sqrt{51}\sqrt{6}}\] and so, following the advice from Example 4 above, you can work out the angle to be \[\begin{align*} \theta=\cos^{-1}\left(\frac{-4}{\sqrt{51}\sqrt{6}}\right) = {103.218^\circ} = 1.802\textsf{ rad}\tag{\textsf{to 3dp}} \end{align*}\]

Tip

If the scalar product of two vectors is positive, then the smallest angle \(\theta\) between the two vectors is acute (that is, \(0^\circ\leq\theta < 90^\circ\) or \(0 \leq \theta < \pi/2\)). If the scalar product of two vectors is negative, then the smallest angle \(\theta\) between the two vectors is obtuse (that is, \(90^\circ < \theta \leq 180^\circ\) or \(\pi/2 < \theta \leq \pi\)).

If the scalar product of two vectors is \(0\), then the two vectors are perpendicular; see below for more on this.

Properties of the scalar product

Much like in Guide: Vector addition and scalar multiplication, the scalar product has many useful properties, both from its algebraic and its geometric definitions.

Tip

For more information as to why the following properties are true, please see Proof sheet: The scalar product for more details.

  1. The scalar product is commutative, so for all vectors \(\mathbf{a}\) and \(\mathbf{b}\): \[\mathbf{a}\cdot\mathbf{b}=\mathbf{b}\cdot\mathbf{a}.\]

  2. The scalar product of any vector \(\mathbf{a}\) with the zero vector \(\mathbf{0}\) is 0, so: \[\mathbf{a}\cdot\mathbf{0}=0\]

  3. The scalar product is distributive, so for all vectors \(\mathbf{a},\mathbf{b},\mathbf{c}\), it follows that: \[\mathbf{a}\cdot (\mathbf{b}+\mathbf{c}) = \mathbf{a}\cdot\mathbf{b}+\mathbf{a}\cdot\mathbf{c}\]

  4. Scalar multiplication is preserved in the scalar product. So if \(\mathbf{a},\mathbf{b}\) are vectors and \(\lambda\) (pronounced ‘lambda’) is a scalar, then \[(\lambda\mathbf{a})\cdot\mathbf{b}=\lambda(\mathbf{a}\cdot\mathbf{b})\]

Example 6

Take \(\mathbf{a}=\begin{pmatrix}3\\5\\1\end{pmatrix}\) and \(\mathbf{b} =\begin{pmatrix}2\\7\\2\end{pmatrix}\), as in Example 1. Then you know \(\mathbf{a}\cdot\mathbf{b}= 43\). You can check \(\mathbf{b}\cdot\mathbf{a}\) to verify the commutative property (1) of the scalar product: \[\mathbf{b}\cdot\mathbf{a}=\begin{pmatrix}2\\7\\2\end{pmatrix}\cdot\begin{pmatrix}3\\5\\1\end{pmatrix}=(2)(3)+(7)(5)+(2)(1)=6+35+2=43\] So \(\mathbf{a}\cdot\mathbf{b}=\mathbf{b}\cdot\mathbf{a}\) as expected.

In addition, you can work out \((3\mathbf{a})\cdot\mathbf{b}\) by using property (4) without much further calculation. Using the property and the fact that \(\mathbf{a}\cdot\mathbf{b}= 43\) gives: \[(3\mathbf{a})\cdot\mathbf{b} = 3(\mathbf{a}\cdot\mathbf{b}) = 3(43) = 129.\]

The following further properties are consequences of the geometric definition of the scalar product.

  1. The scalar product of a vector \(\mathbf{a}\) with itself is the square of its magnitude: \[\mathbf{a}\cdot\mathbf{a}=|\mathbf{a}|^2\]

  2. If two vectors \(\mathbf{a}\) and \(\mathbf{b}\) are parallel (so \(\mathbf{a}\) is a scalar multiple of \(\mathbf{b}\) by a positive scalar; see Guide: Vector addition and scalar multiplication), then \[\mathbf{a}\cdot\mathbf{b}=|\mathbf{a}||\mathbf{b}|.\] Similarly, if \(\mathbf{a}\) and \(\mathbf{b}\) are anti-parallel (so \(\mathbf{a}\) is a scalar multiple of \(\mathbf{b}\) by a negative scalar; see Guide: Vector addition and scalar multiplication), then \[\mathbf{a}\cdot\mathbf{b}=-|\mathbf{a}||\mathbf{b}|.\]

  3. If two non-zero vectors \(\mathbf{a}\) and \(\mathbf{b}\) are perpendicular, then their scalar product \(\mathbf{a}\cdot\mathbf{b}\) is equal to \(0\). On the other hand, if the scalar product of two non-zero vectors \(\mathbf{a}\) and \(\mathbf{b}\) is equal to \(0\), then \(\mathbf{a}\) and \(\mathbf{b}\) are perpendicular.

Of these, property (7) is incredibly interesting. You can even use this property to solve some vector equations involving the scalar product.

Example 7

Take \(\mathbf{a}=\begin{pmatrix}14\\2\\100\end{pmatrix}\), then \[\mathbf{a}\cdot\mathbf{a}=14^2+2^2+100^2=10200.\] The magnitude of \(\mathbf{a}\) is \[|\mathbf{a}|=\sqrt{14^2+2^2+100^2}=\sqrt{10200}\] and so, \[|\mathbf{a}|^2=\mathbf{a}\cdot\mathbf{a}\] as you would expect!

Example 8

Take \(\mathbf{a}=3\mathbf{i} + 3\mathbf{j} + 4\mathbf{k}\) and \(\mathbf{b}=\mathbf{i} + 3\mathbf{j} -3\mathbf{k}\). Then, \[\mathbf{a}\cdot\mathbf{b}=(3)(1)+(3)(3)-(4)(3)=0\] So \(\mathbf{a}\) and \(\mathbf{b}\) are indeed perpendicular.

Example 9

Let \(\mathbf{a}=\begin{pmatrix}2\\1\\z\end{pmatrix}\) and \(\mathbf{b}=\begin{pmatrix}5\\6\\1\end{pmatrix}\). By working out the scalar product of \(\mathbf{a}\) and \(\mathbf{b}\) and setting \(\mathbf{a}\cdot\mathbf{b} = 0\), you can find the value of \(z\) for which \(\mathbf{a}\) and \(\mathbf{b}\) are perpendicular. Doing this gives \[\mathbf{a}\cdot\mathbf{b}=\begin{pmatrix}2\\1\\z\end{pmatrix}\cdot\begin{pmatrix}5\\6\\1\end{pmatrix}=(2)(5)+(1)(6)+(z)(1)=10+6+z=16+z\] Setting this scalar product to be zero allows you to find the value of \(z\) such that \(\mathbf{a}\) and \(\mathbf{b}\) are perpendicular. So setting \(16 + z = 0\) gives \(z=-16\).

Quick check problems

  1. Using the algebraic definition, what is the scalar product of the vectors \(\mathbf{a}=\begin{pmatrix}1\\2\\-1\end{pmatrix}\) and \(\mathbf{b}=\begin{pmatrix}2\\10\\15\end{pmatrix}\)?

Answer: The scalar product \(\mathbf{a}\cdot\mathbf{b}\) is equal to .

  1. What is the scalar product of \(\mathbf{a}=3\mathbf{i}+\mathbf{j}-\mathbf{k}\) and \(\mathbf{b}=4\mathbf{i}+5\mathbf{j}+\mathbf{k}\)?

Answer: The scalar product is equal to .

  1. Working in degrees, find the angle between the vectors \(\mathbf{a}=\begin{pmatrix}7\\-4\\11\end{pmatrix}\) and \(\mathbf{b} =\begin{pmatrix}5\\2\\2\end{pmatrix}\).

Answer: The angle is degrees accurate to the nearest whole number.

Further reading

For more questions on this topic, please go to Questions: The scalar product.

If you are unsure about any of the concepts involving vectors in this guide, please see Guide: Introduction to vectors or Guide: Vector addition and scalar multiplication.

If you would like to know more about why the two definitions of the scalar product are equal, or why the seven numbered properties of the scalar product are true, please see Proof sheet: The scalar product.

Version history and licensing

v1.0: initial version created 08/23 by Isabella Lewis as part of a University of St Andrews STEP project.

  • v1.1: edited 05/24 by tdhc.

This work is licensed under CC BY-NC-SA 4.0.

Feedback

Your feedback is appreciated and useful. Feel free to leave a comment here.