# 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,

- ,

where is the angle between the two vectors. Following a common convention, the magnitudes have been written as the variable without the vector symbol: , and .

A few properties are immediately apparent.

- It is symmetric: .
- It is linear in each argument: .
- 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.

- (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:

- .

or, depending on what notation you prefer:

- .

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:

- .

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

- .
- .

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.

is the projection of onto the x axis, which is also the length of times the cosine of .

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 is

Whatever coordinate system we are in, the vector runs from one corner to the opposite corner of a rectangular box with sides , , and .

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 and , and use plane geometry. Let . That is, runs from the tip of to the tip of . Form the triangle with those vectors as sides.

By the law of cosines for a triangle:

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

Since :

so

so