# Dot Product

(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
This is a Helper Page for:
Divergence Theorem
Change of Coordinate Systems
Vector

The dot product expresses the angular relationship between two vectors. The dot product is a way of multiplying two vectors to get a quantity with only magnitude. We use the dot product to compute lengths of vectors and angles between vectors. It is also called the scalar product.

In fact, a dot product is a specific inner product. An inner product is a class of operations which satisfy certain properties. The inner product is a way to multiply vectors together and get a numerical value. The inner product works for real vector spaces as well as abstract vector spaces. The dot product only works in an Euclidean space (this is your common x-y-z space).

In the general case, the dot product is the summation of the products of the vectors' components. $\vec A$ is the actual notation for a vector. We have two vectors: A and B. Both vectors have n components. The definition of the dot product states:

Let $\vec A = \left ( a_1, a_2, \cdots, a_n \right )$.
Let $\vec B = \left ( b_1, b_2, \cdots, b_n \right )$.

Then,

$\vec A \cdot \vec B = a_1 b_1 + a_2 b_2 + \cdots + a_n b_n$

For example, if $\vec A = \left ( 3, 3, -6 \right )$ and $\vec B = \left ( 4, 2, 1 \right )$ then, A dot B is

$\vec A \cdot \vec B = 3 * 4 + 3 * 2 + -6 * 1 = 12$

## Real World Example

The dot product is pretty simple, and you use it without even noticing it. It's like school shopping math. When the school year approaches, you go shopping to get school supplies. You buy pencils, folders, notebooks etc all at specific prices. To compute the total cost, you multiply the price of an item by the number of that type of item you are going to buy. Then you add it all up. You are in fact using the dot product. The prices of items are components of one vector, and the quantities you are buying of those items make up another vector. To calculate the total cost of your school supplies, you just take the dot product of these vectors.

For example, suppose you need to buy 3 pencils, 4 folders, and 5 notebooks. Pencils cost $2, folders cost$0.50, and notebooks cost \$1.

The quantity vector of the items is $\vec A = \left ( 3, 4, 5 \right )$, and the price vector of the items is $\vec B = \left ( 2, .5, 1 \right )$.

Taking the dot product of these vectors gives us

$\left ( 3, 4, 5 \right ) \cdot \left ( 2, .5, 1 \right )$

Using the formula for dot product, we have

$3 \times 2 + 4 \times .5 + 5 \times 1$

Simplifying, we have

$6 + 2 + 5 = 13$

## Properties of Dot Products

The dot product obeys the properties listed below. This holds true for all nonzero vectors. We use another notation commonly found in textbooks. The variable is now bold instead of having a hat hover over the variable. All properties work in any dimensional space.

1. $\mathbf{a} \cdot \mathbf{a} = \left | \mathbf{a} \right|^2$
2. $\mathbf{a} \cdot \left ( \mathbf{b} + \mathbf{c} \right) = \mathbf{a} \cdot \mathbf{b} + \mathbf{a} \cdot \mathbf{c}$
3. $\mathbf{0} \cdot \mathbf{a} = \mathbf{0}$
4. $\mathbf{a} \cdot \mathbf{b} = \mathbf{b} \cdot \mathbf{a}$
5. $\left ( \mathrm{s} \mathbf{a} \right ) \cdot \mathbf{b} = s \left ( \mathbf{a} \cdot \mathbf{b} \right )$ (holds only for scalars such as "s")

Below are the proof of the Dot Product's properties that hold in any dimensional space. We prove the properties to be true using the three-dimensional space.

Property 1: Squared Length

Taking the dot product of a vector a with itself will give the squared length of the vector.

$a \cdot a = a^2$

Write out the vector in terms of its components. So,

$a = a_1, a_2, a_3$

Multiply the products in the order given. For example, multiply the first components with each other and so on. Add the products.

$a \cdot a = a_1 a_1 + a_2 a_2 + a_3 a_3$

Rewrite the expression above using exponents.

$a \cdot a = a_1^2 + a_2^2 + a_3^2$

We know that the vector a in terms of its components. In the expression above the components are being squared. We can conclude it is the same as if the vector was squared initially.

$a \cdot a = a^2$

Note that, the dot product of a vector with itself is greater than zero if and only if the vector is not the zero vector. Also, the dot product of a vector with itself can only be zero if the vector is zero.

Property 2: Distributive Property

The dot product of a vector and sum is equal to the sum of the individual products of addends and the vector.

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

Add the components of b and c inside the parentheses.

$a \cdot \left ( b + c \right )=a \cdot \left ( b_1 + c_1 + b_2 + c_2 + b_3 + c_3 \right )$

Multiply the sum of the component of b and c with the given component of a.

$=a_1 \left ( b_1 + c_1\right ) + a_2 \left ( b_2 + c_2 \right ) + a_3 \left ( b_3 + c_3 \right )$

Distribute a across the set of parentheses.

$=a_1 b_1 + a_1 c_1 + a_2 b_2 + a_2 c_2 + a_3 b_3 + a_3 c_3$

Rewrite the expression without the components of the vectors by using the dot product.

$=a \cdot b + a \cdot c$

So, we proved that:

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

Property 3: Zero Property

The dot product of a vector a and the zero vector will equal zero.

$a \cdot 0 = 0$

Multiply the components in given order of a with the zero vector. Every component of the zero vector is 0.

$a_1 0 + a_2 0 + a_3 0$

The product of any number and 0 is 0.

$0 + 0 + 0$

Thus,

$a \cdot 0 = 0$

Property 4: Commutative Property

The dot product of a vector a and a vector b is the same no matter if you change the order of the vectors. That is, A dot B is the same as B dot A. We conclude this by knowing the commutative property works on all real numbers.

$a \cdot b = b \cdot a$

Multiply the components in given order of a and b.

$a\cdot b = a_1 b_1 + a_2 b_2 + a_3 b_3$

We basically want to know if we must write the dot product in a specific order. So, let's do the same process if we are given $b \cdot a$

Multiply the components in given order of b and a.

$b \cdot a = b_1 a_1 + b_2 a_2 + b_3 a_3$

The first term in $a\cdot b$ is and $a_1 b_1$.

The first term in $b \cdot a$ is $b_1 a_1$.

By the commutative property based on real numbers the terms are the same.

$a_1 b_1 = b_1 a_1$

So the large scale picture states:

$a \cdot b = b \cdot a$

Property 5: Associate Property

The dot product of two vectors and a scalar is the same no matter what the grouping of the two vectors and scalar is.

$\left ( s a \right ) \cdot b = s \left ( a \cdot b \right )$

We will focus on the left side of the equation first. Then we will look at the right side. After, we'll show that the two expressions on the left and right side of the equal side is the same.

The left side of the equation states:

$\left ( s a \right ) \cdot b$

Write out vector a in terms of its components.

$a = a_1, a_2, a_3$

Distribute s across the components of a.

$\left ( s a \right ) = s a_1, s a_2, s a_3$

Multiply the terms of the expression above with the corresponding components of vector b.

$\left ( s a_1 \right ) b_1 + \left ( s a_2 \right ) b_2 + \left ( s a_3 \right ) b_3$

Let's now focus on the right side which states: .

$s \left ( a \cdot b \right )$

Take the dot product of a and b.

$a \cdot b = a_1 b_1 + a_2 b_2 + a_3 b_3$

Multiply $\left ( a \cdot b \right )$ with scalar s.

$s \left ( a \cdot b \right ) = s \left ( a_1 b_1 + a_2 b_2 + a_3 b_3 \right )$

Distribute the scalar to get:

$s \left (a_1 b_1 \right ) + s \left ( a_2 b_2 \right ) + s \left (a_3 b_3 \right )$

Let's now relate the left side of the equation to the right side.

Remember we showed that the left side was:

$\left ( s a_1 \right ) b_1 + \left ( s a_2 \right ) b_2 + \left ( s a_3 \right ) b_3$

And, the right side was:

$s \left (a_1 b_1 \right ) + s \left ( a_2 b_2 \right ) + s \left (a_3 b_3 \right )$

By the commutative property based on real numbers, the corresponding terms of the left and right side of the equation are the same. For example, the first term on both sides of the equation contains the product of $s, a_1, b_1$.

$\left ( s a_1 \right ) b_1 + \left ( s a_2 \right ) b_2 + \left ( s a_3 \right ) b_3 = s \left (a_1 b_1 \right ) + s \left ( a_2 b_2 \right ) + s \left (a_3 b_3 \right )$

Rewrite the expression above using vector notation and the dot product and get:

$\left ( s a \right ) \cdot b = s \left ( a \cdot b \right )$

So, we have shown that the grouping of the two vectors and scalar does not matter.

You can go through the same process and show:

$s \left ( a \cdot b \right ) = a \cdot \left ( s b \right)$

## Alternative Definition

The definition of the dot product given above was:

$\vec A \cdot \vec B = a_1 b_1 + a_2 b_2 + \cdots + a_n b_n$.

Although, the dot product produces a numerical value it also has a geometric interpertation. Think of multiplication, it is a process like the dot product. When you multiply two numbers you get a numerical value yet in geometry multiplication means you create a rectangle with a certain height and base. The dot product relates the length of vectors and the angle between the vectors. If we know the angle between two vectors then we can write the dot product as such:

$\vec A \cdot \vec B = \left | \vec A \right | \left | \vec B \right | \cos \theta$

The equation above is in fact an alternative definition of the dot product. You may wonder what exactly is $\left | \vec A \right |$ and how is it different from $\vec A$.

If $\vec A = \left ( a_1, a_2, a_3 \right )$, then the length of $\vec A$ (which is also called the norm or magnitude) denoted as $\left | \vec A \right |$ is $\sqrt{a_1^2 + a_2^2 + a_3^2}$.

The alternative definition of the dot product is the following:

$\vec A \cdot \vec B = \left | \vec A \right | \left | \vec B \right | \cos \theta$

This new definition demonstrates the dot product's geometric meaning. The dot product finds the angle between vectors in an arbitrary space. However, this alternative definition is only defined in the 3 dimensional space. To understand this second definition we will first look at a vector being multiplied by itself, the basic case.

$\vec A \cdot \vec A = \left | \vec A \right | ^2 \cos \theta$

In this basic case there is no angle measured between a vector and itself. The angle is zero, and the cosine of zero is one. The dot product of a vector with itself is the length of the vector squared.

$\vec A \cdot \vec A = \left | \vec A \right | ^2 \cos 0 = {a_1}^2 + {a_2}^2 + \cdots + {a_n}^2$.

Notice that the alternate definition gives us the same answer that we saw in the first definition of the dot product.

If we now use two different vectors,$\left | \vec A \right |$ and $\left | \vec B \right |$, we will be able to get the second definition of the dot product by relying on the Law of Cosines. The Law of Cosine gives information about the third side of a triangle created from $\left | \vec A \right |$ and $\left | \vec B \right |$. The length of the third side is equal to the length of $\left | \vec A \right |^ 2$ plus $\left | \vec B \right | ^ 2$. If the triangle was a right angle then this would simply be the Pythagorean Theorem. But because the triangle is not a right angle, we include another term which is twice the length of A multiplied by length B and the cosine of the angle between vectors A and B. The Law of Cosine in mathematical terms is

Eq. 1         $\left | \vec C \right |^2 = \left | \vec A \right | ^2 + \left | \vec B \right | ^2 - 2 \left | \vec A \right| \left | \vec B \right | \cos \theta$.

Now that we know the basics of the Law of Cosine we will prove that the alternative definition of the dot product is correct.

We call the third side of the triangle C, which is vector A minus vector B.

The squared length of vector C is in fact the dot product of itself.

$\left | \vec C \right | ^2 = \left | \vec C \right | \cdot \left | \vec C \right |$

However, it was mentioned that C is equal to vector A minus vector B. So, we use this information to define the third side of the triangle.

$\left | \vec C \right | = \left | \vec A \right | - \left | \vec B \right |$

Rewrite it as such:

$\left | \vec C \right | ^2 = \left ( \left | \vec A \right | - \left | \vec B \right | \right ) \cdot \left ( \left | \vec A \right | - \left | \vec B \right | \right )$

We use the distributive property of the dot product.

$\left | \vec C \right |^2 = \left | \vec A \right | \cdot \left | \vec A \right | - \left | \vec A \right | \cdot \left | \vec B \right | - \left | \vec B \right | \cdot \left | \vec A \right | + \left | \vec B \right | \cdot \left | \vec B \right |$

Simplify to get the following equation.

Eq. 2         $\left | \vec C \right |^2 =\left | \vec A \right | ^2 + \left | \vec B \right | ^2 - 2 \left | \left | \vec A \right | \cdot \left | \vec B \right | \right|$

Combine Equation 1 and 2 to get:

$\left | \vec A \right | ^2 + \left | \vec B \right | ^2 - 2 \left | \vec A \right| \left | \vec B \right | \cos \theta = \left | \vec A \right | ^2 + \left | \vec B \right | ^2 - 2 \left | \left | \vec A \right | \cdot \left | \vec B \right | \right|$

Cross out like terms on both sides

$\left | \vec A \right | ^2 + \left | \vec B \right | ^2 -2 \left | \vec A \right| \left | \vec B \right | \cos \theta = \left | \vec A \right | ^2 + \left | \vec B \right | ^2 -2 \left | \vec A \cdot \vec B \right|$

We get:

$\left | \vec A \right| \left | \vec B \right | \cos \theta = \vec A \cdot \vec B$

Relying on the Law of Cosines we see that the alternative definition of the dot product is true. To use it effectively we will need to know the length of two vectors and the angle between them. If $\vec A$ and $\vec B$ are vectors and $\theta$ is the angle between $\vec A$ and $\vec B$, then the dot product $\vec A \cdot \vec B$ is defined by

$\vec A \cdot \vec B = \left | \vec A \right | \left | \vec B \right | \cos \theta$

This formula can be arranged to determine the angle between two non-zero vectors.

$\vec A \cdot \vec B = \left | \vec A \right | \left | \vec B \right | \cos \theta$
$\frac { \vec A \cdot \vec B} {\left | \vec A \right | \left | \vec B \right |} = \cos \theta$
$\arccos \left ( \frac {\vec A \cdot \vec B} {\left | \vec A \right | \left | \vec B \right |} \right ) = \theta$

## Geometric Properties of the Dot Product

Here are the geometric properties of the dot product.

We first put restriction on $\theta$. We take $0 \le \theta \le \pi$

• If $\mathbf{a}$ and $\mathbf{b}$ are nonzero vectors then $\mathbf{a} \cdot \mathbf{b} = 0$ if and only if $\cos \theta = 0$.
$\cos \theta = 0$ when $\theta = \frac{\pi} {2}$.

It makes sense for to call $\mathbf{a}$ and $\mathbf{b}$ perpendicular (or orthogonal). This applies to two-dimensional and three-dimensional anything higher is not a property but a definition of perpendicularity. Notice that if $\mathbf{a}$ or $\mathbf{b}$ is the zero vector then we can say the zero vector is perpendicular to every vector.

• The dot product can tell us other things based the measurement of the angle. If the angle is less than 90 degrees, the sign of the dot product is going to be positive. So, that means geometrically, our two vectors $\mathbf{a}$ and $\mathbf{b}$ are going more or less in the same direction. We can make $\mathbf{a}$ and $\mathbf{b}$ maximally positive by making them point in the same direction. Rotating $\mathbf{a}$ and $\mathbf{b}$ apart causes the dot product to decrease. The dot product reaches zero when $\mathbf{a}$ and $\mathbf{b}$ are perpendicular. If the angle is greater than 90 degrees the dot product will be negative and our vectors would point in opposite directions. The dot product simply measures how much the vectors are going along each other.
• $\mathbf{a}$ and $\mathbf{b}$ are two nonzero vectors. Imagine a perpendicular line drawn from the head of $\mathbf{b}$ to the line through $\mathbf{a}$. Then this is a length called the projection of b onto a. This is written as $\mathrm{p} \mathrm{r} \mathrm{o} \mathrm{j}_a \mathbf{b}$.
Projection of a unto b

$\mathrm{p} \mathrm{r} \mathrm{o} \mathrm{j}_a \mathbf{b} = \left ( \frac{\mathbf{a} \cdot \mathbf{b}} {\mathbf{a} \cdot \mathbf{a}} \right ) \mathbf{a}$

Find the dot product of vector A with 4 unit and vector B with 6 unit acting at 40 degrees with each other.
$\vec A \cdot \vec B = \left | \vec A \right| \left | \vec B \right | \cos \theta$
$= \left | \mathrm{4} \right | \left | \mathrm{6} \right | \cos \mathrm{4} \mathrm{0}$
$= \mathrm{1} \mathrm{8} . \mathrm{3} \mathrm{8}$

Now what if the angle was 90 degrees. We follow the same procedure and plug into the formula.

$\vec A \cdot \vec B = \left | \vec A \right| \left | \vec B \right | \cos \theta$
$= \left | \mathrm{4} \right | \left | \mathrm{6} \right | \cos \mathrm{9} \mathrm{0}$
$= \mathrm{0}$
Notice that if two vectors are perpendicular, then their dot product is zero. The cosine of 90 degrees is 0 which makes the entire expression go to zero. From the dot product we can figure out when two vectors are perpendicular.