Dot product

Mathematics Dot product

| Subject classification: this is a mathematics resource.

|

| Educational level: this is a secondary education resource.

|

| Educational level: this is a tertiary (university) resource.

|

The dot product, also commonly known as the "inner product", or, less commonly, the "scalar product", is a number associated with a pair of vectors. It figures prominently in many problems in physics, and variants of it appear in an enormous number of mathematical areas.

## Geometric Definition

[edit | edit source]

It is defined geometrically as the product of the lengths of the two vectors times the cosine of the angle between them. This definition is used in 2 dimensions (plane geometry) or 3 dimensions (solid geometry and physics.) The dot product is written with a raised dot between the vectors,

A -> ⋅ B -> = A B cos ⁡ θ {\displaystyle {\vec {A}}\cdot {\vec {B}}=AB\cos \theta } ,

where  θ {\displaystyle \theta } is the angle between the two vectors. Following a common convention, the magnitudes have been written as the variable without the vector symbol:  A ≡ | | A -> | | {\displaystyle A\equiv ||{\vec {A}}||} , and  B ≡ | | B -> | | {\displaystyle B\equiv ||{\vec {B}}||} .

A few properties are immediately apparent.

* It is symmetric:  A -> ⋅ B -> = B -> ⋅ A -> {\displaystyle {\vec {A}}\cdot {\vec {B}}={\vec {B}}\cdot {\vec {A}}\,} .
* It is linear in each argument:  ( λ A -> ) ⋅ B -> = A -> ⋅ ( λ B -> ) = λ ( A -> ⋅ B -> ) {\displaystyle (\lambda {\vec {A}})\cdot {\vec {B}}={\vec {A}}\cdot (\lambda {\vec {B}})=\lambda ({\vec {A}}\cdot {\vec {B}})\,} .
* If the two vectors are orthogonal (perpendicular) to each other, their dot product is zero. This is because the cosine of 90° is zero.
* The length of a vector is the square root of the dot product of the vector with itself. This is because the angle is 0, so the cosine is 1.

‖ A -> ‖ = A -> ⋅ A -> {\displaystyle \|{\vec {A}}\|={\sqrt {{\vec {A}}\cdot {\vec {A}}}}\,}
(The double absolute value sign, shown above, is known as the norm. It can be thought of as a generalization of the absolute value of a number. It is used in many places in mathematics. For vectors, it is the length.)

## Algebraic definition

[edit | edit source]

It turns out that, given the components of vectors in a Cartesian (Euclidean) vector space, there is an extremely simple way to calculate the dot product. It is the sum of the pairwise products of the components of the vectors:

A -> ⋅ B -> = A x B x + A y B y + A z B z {\displaystyle {\vec {A}}\cdot {\vec {B}}=A_{x}B_{x}+A_{y}B_{y}+A_{z}B_{z}\,} .

or, depending on what notation you prefer:

A -> ⋅ B -> = A 1 B 1 + A 2 B 2 + A 3 B 3 = ∑ i = 1 3 A i B i {\displaystyle {\vec {A}}\cdot {\vec {B}}=A_{1}B_{1}+A_{2}B_{2}+A_{3}B_{3}=\sum _{i=1}^{3}A_{i}B_{i}\,} .

This definition is also used in 2 dimensions, with only two terms in the addition.

It needs to be emphasized that this formula only works if the components of the vectors are described in Cartesian space. In other coordinate systems, it may be necessary to use other, somewhat more complicated formulas.

The equivalence of this algebraic definition and the earlier geometric one is extremely important. Among many other things, it lets us calculate the angle between two vectors, given their components. Calculate the lengths of the vectors as the square root of the dot product of each vector with itself, calculate the dot product of the two vectors, divide by the lengths, and take the inverse cosine:

θ = cos − 1 ⁡ ( A x B x + A y B y + A z B z ‖ A ‖ ‖ B ‖ ) {\displaystyle \theta =\cos ^{-1}\left({\frac {A_{x}B_{x}+A_{y}B_{y}+A_{z}B_{z}}{\|A\|\|B\|}}\right)\,} .

Using the algebraic definition, one can see that the dot product is additive in each argument:

A -> ⋅ ( B -> + C -> ) = A -> ⋅ B -> + A -> ⋅ C -> {\displaystyle {\vec {A}}\cdot ({\vec {B}}+{\vec {C}})={\vec {A}}\cdot {\vec {B}}+{\vec {A}}\cdot {\vec {C}}\,} .
( A -> + B -> ) ⋅ C -> = A -> ⋅ C -> + B -> ⋅ C -> {\displaystyle ({\vec {A}}+{\vec {B}})\cdot {\vec {C}}={\vec {A}}\cdot {\vec {C}}+{\vec {B}}\cdot {\vec {C}}\,} .

something which is not so easy to see from the geometric definition.

## Proof of Equivalence of the Two Definitions

[edit | edit source]

If one is good at geometric visualization in 3 dimensions, and has a good understanding of the Euclidean rotation group, one can rotate the Cartesian coordinate system around until the two vectors lie in the x-y plane, and the first vector lies along the x axis.

This requires knowing that any rotation around a coordinate axis is a transformation by an orthogonal matrix, that the sum of the pairwise products of components is unchanged by an orthogonal transformation, and that the two vectors can be rotated into the required position by a combination of rotations around coordinate axes.
Once this is done, it becomes a problem in 2 dimensions.

The dot product of  A -> {\displaystyle {\vec {A}}\,} and  B -> {\displaystyle {\vec {B}}\,} .

B x {\displaystyle B_{x}\,} is the projection of  B -> {\displaystyle {\vec {B}}\,} onto the x axis, which is also the length of  B -> {\displaystyle {\vec {B}}\,} times the cosine of  θ {\displaystyle \theta \,} .

B x = ‖ B ‖ cos ⁡ θ {\displaystyle B_{x}=\|B\|\cos \theta \,}
A x = ‖ A ‖ {\displaystyle A_{x}=\|A\|\,}
A y = 0 {\displaystyle A_{y}=0\,}
A x B x + A y B y = A x B x = ‖ A ‖ ‖ B ‖ cos ⁡ θ {\displaystyle A_{x}B_{x}+A_{y}B_{y}=A_{x}B_{x}=\|A\|\|B\|\cos \theta \,}

Another way to prove this is to prove it first for the norm of a vector, and then use the law of cosines.

We first need to show that the geometric length of  A -> {\displaystyle {\vec {A}}\,} is  A x 2 + A y 2 + A z 2 {\displaystyle {\sqrt {A_{x}^{2}+A_{y}^{2}+A_{z}^{2}}}\,}

Whatever coordinate system we are in, the vector  A -> {\displaystyle {\vec {A}}\,} runs from one corner to the opposite corner of a rectangular box with sides  A x {\displaystyle A_{x}\,} ,  A y {\displaystyle A_{y}\,} , and  A z {\displaystyle A_{z}\,} .

Two applications of Pythagoras' theorem suffice to prove the required result. The length of a vector is the square root of the sum of the squares of its components.

Next, whatever coordinate system we are in, form the plane containing  A -> {\displaystyle {\vec {A}}\,} and  B -> {\displaystyle {\vec {B}}\,} , and use plane geometry. Let  C -> = A -> − B -> {\displaystyle {\vec {C}}={\vec {A}}-{\vec {B}}\,} . That is,  C -> {\displaystyle {\vec {C}}\,} runs from the tip of  B -> {\displaystyle {\vec {B}}\,} to the tip of  A -> {\displaystyle {\vec {A}}\,} . Form the triangle with those vectors as sides.

The two vectors as sides of a triangle.

By the law of cosines for a triangle:

‖ C ‖ 2 = ‖ A ‖ 2 + ‖ B ‖ 2 − 2 ‖ A ‖ ‖ B ‖ cos ⁡ θ {\displaystyle \|C\|^{2}=\|A\|^{2}+\|B\|^{2}-2\|A\|\ \|B\|\cos \theta \,}

Since we have established that the algebraic definition works for calculating norms:

C x 2 + C y 2 + C z 2 = A x 2 + A y 2 + A z 2 + B x 2 + B y 2 + B z 2 − 2 ‖ A ‖ ‖ B ‖ cos ⁡ θ {\displaystyle C_{x}^{2}+C_{y}^{2}+C_{z}^{2}=A_{x}^{2}+A_{y}^{2}+A_{z}^{2}+B_{x}^{2}+B_{y}^{2}+B_{z}^{2}-2\|A\|\|B\|\cos \theta \,}

Since  C -> = A -> − B -> {\displaystyle {\vec {C}}={\vec {A}}-{\vec {B}}\,} :

A x 2 + B x 2 − 2 A x B x + A y 2 + B y 2 − 2 A y B y + A z 2 + B z 2 − 2 A z B z = A x 2 + A y 2 + A z 2 + B x 2 + B y 2 + B z 2 − 2 ‖ A ‖ ‖ B ‖ cos ⁡ θ {\displaystyle A_{x}^{2}+B_{x}^{2}-2A_{x}B_{x}+A_{y}^{2}+B_{y}^{2}-2A_{y}B_{y}+A_{z}^{2}+B_{z}^{2}-2A_{z}B_{z}=A_{x}^{2}+A_{y}^{2}+A_{z}^{2}+B_{x}^{2}+B_{y}^{2}+B_{z}^{2}-2\|A\|\|B\|\cos \theta \,}

− 2 A x B x − 2 A y B y − 2 A z B z = − 2 ‖ A ‖ ‖ B ‖ cos ⁡ θ {\displaystyle -2A_{x}B_{x}-2A_{y}B_{y}-2A_{z}B_{z}=-2\|A\|\|B\|\cos \theta \,}

A x B x + A y B y + A z B z = ‖ A ‖ ‖ B ‖ cos ⁡ θ {\displaystyle A_{x}B_{x}+A_{y}B_{y}+A_{z}B_{z}=\|A\|\|B\|\cos \theta \,}