In mathematics, the dot product is an algebraic operation that takes two equal-length sequences of numbers (usually coordinate vectors), and returns a single number. In Euclidean geometry, the scalar product of two vectors is the dot product of their Cartesian coordinates, and is independent from the choice of a particular Cartesian coordinate system. The terms "dot product" and "scalar product" are often used interchangeably when a Cartesian coordinate system has been fixed once for all. The scalar product being a particular inner product, the term "inner product" is also often used.
Algebraically, the dot product is the sum of the products of the corresponding entries of the two sequences of numbers. Geometrically, the scalar product of two vectors is the product of their lengths and the cosine of the angle between them. These definitions are equivalent when using Cartesian coordinates. In modern geometry, Euclidean spaces are often defined by using vector spaces. In this case, the scalar product is used for defining lengths (the length of a vector is the square root of the scalar product of the vector by itself) and angles (the cosine of the angle between two vectors is the quotient of their scalar product by the product of their lengths).
The name "dot product" is derived from the dot operator " ⋅ " that is often used to designate this operation; the alternative name "scalar product" emphasizes that the result is a scalar, rather than a vector (as with the vector product in three-dimensional space).
Definition
The dot product may be defined algebraically or geometrically. The geometric definition is based on the notions of angle and distance (magnitude) of vectors. The equivalence of these two definitions relies on having a Cartesian coordinate system for Euclidean space.
In modern presentations of Euclidean geometry, the points of space are defined in terms of their Cartesian coordinates, and Euclidean space itself is commonly identified with the real coordinate space <math>\mathbf{R}^n</math>. In such a presentation, the notions of length and angle are defined by means of the dot product. The length of a vector is defined as the square root of the dot product of the vector by itself, and the cosine of the (non oriented) angle between two vectors of length one is defined as their dot product. So the equivalence of the two definitions of the dot product is a part of the equivalence of the classical and the modern formulations of Euclidean geometry.
Coordinate definition
The dot product of two vectors <math>\mathbf{a} = [a_1, a_2, \cdots, a_n]</math> and specified with respect to an orthonormal basis, is defined as:
<math display="block">\mathbf a \cdot \mathbf b = \sum_{i=1}^n a_i b_i = a_1 b_1 + a_2 b_2 + \cdots + a_n b_n</math>
where <math>\Sigma</math> (sigma) denotes summation and <math>n</math> is the dimension of the vector space. For instance, in three-dimensional space, the dot product of vectors and is:
<math display="block">
\begin{align}
\ [1, 3, -5] \cdot [4, -2, -1] &= (1 \times 4) + (3\times-2) + (-5\times-1) \\
&= 4 - 6 + 5 \\
&= 3
\end{align}
</math>
Likewise, the dot product of the vector with itself is:
<math display="block">
\begin{align}
\ [1, 3, -5] \cdot [1, 3, -5] &= (1 \times 1) + (3\times 3) + (-5\times -5) \\
&= 1 + 9 + 25 \\
&= 35
\end{align}
</math>
If vectors are identified with column vectors, the dot product can also be written as a matrix product
<math display="block">\mathbf a \cdot \mathbf b = \mathbf a^{\mathsf T} \mathbf b,</math>
where <math>\mathbf a{^\mathsf T}</math> denotes the transpose of <math>\mathbf a</math>.
Expressing the above example in this way, a 1 × 3 matrix (row vector) is multiplied by a 3 × 1 matrix (column vector) to get a 1 × 1 matrix that is identified with its unique entry:
<math display="block">
\begin{bmatrix}
1 & 3 & -5
\end{bmatrix}
\begin{bmatrix}
4 \\ -2 \\ -1
\end{bmatrix} = 3 \, .
</math>
Geometric definition
thumb|Illustration showing how to find the angle between vectors using the dot product
thumb|216px|<!-- specify width as minus sign vanishes at most sizes --> Calculating bond angles of a symmetrical [[tetrahedral molecular geometry using a dot product]]
In Euclidean space, a Euclidean vector is a geometric object that possesses both a magnitude and a direction. A vector can be pictured as an arrow. Its magnitude is its length, and its direction is the direction to which the arrow points. The magnitude of a vector <math>\mathbf{a}</math> is denoted by <math> \left\| \mathbf{a} \right\| </math>. The dot product of two Euclidean vectors <math>\mathbf{a}</math> and <math>\mathbf{b}</math> is defined by
<math display="block"> \mathbf a \cdot \mathbf b = a_b \left\| \mathbf{b} \right\| = b_a \left\| \mathbf{a} \right\| .</math>
The dot product, defined in this manner, is homogeneous under scaling in each variable, meaning that for any scalar <math>\alpha</math>,
<math display="block"> ( \alpha \mathbf{a} ) \cdot \mathbf b = \alpha ( \mathbf a \cdot \mathbf b ) = \mathbf a \cdot ( \alpha \mathbf b ) .</math>
It also satisfies the distributive law, meaning that
<math display="block"> \mathbf a \cdot ( \mathbf b + \mathbf c ) = \mathbf a \cdot \mathbf b + \mathbf a \cdot \mathbf c .</math>
These properties may be summarized by saying that the dot product is a bilinear form. Moreover, this bilinear form is positive definite, which means that <math> \mathbf a \cdot \mathbf a </math> is never negative, and is zero if and only if <math> \mathbf a = \mathbf 0 </math>, the zero vector.
Equivalence of the definitions
If <math>\mathbf{e}_1,\cdots,\mathbf{e}_n</math> are the standard basis vectors in <math>\mathbf{R}^n</math>, then we may write
<math display="block">\begin{align}
\mathbf a &= [a_1 , \dots , a_n] = \sum_i a_i \mathbf e_i \\
\mathbf b &= [b_1 , \dots , b_n] = \sum_i b_i \mathbf e_i.
\end{align}
</math>
The vectors <math>\mathbf{e}_i</math> are an orthonormal basis, which means that they have unit length and are at right angles to each other. Since these vectors have unit length,
<math display="block"> \mathbf e_i \cdot \mathbf e_i = 1 </math>
and since they form right angles with each other, if <math>i\neq j</math>,
<math display="block"> \mathbf e_i \cdot \mathbf e_j = 0 .</math>
Thus in general, we can say that:
<math display="block"> \mathbf e_i \cdot \mathbf e_j = \delta_ {ij} ,</math>
where <math>\delta_{ij}</math> is the Kronecker delta.
thumb|upright=1.0|Vector components in an orthonormal basis
Also, by the geometric definition, for any vector <math>\mathbf{e}_i</math> and a vector <math>\mathbf{a}</math>, we note that
<math display="block"> \mathbf a \cdot \mathbf e_i = \left\| \mathbf a \right\| \left\| \mathbf e_i \right\| \cos \theta_i = \left\| \mathbf a \right\| \cos \theta_i = a_i ,</math>
where <math>a_i</math> is the component of vector <math>\mathbf{a}</math> in the direction of <math>\mathbf{e}_i</math>. The last step in the equality can be seen from the figure.
Now applying the distributivity of the geometric version of the dot product gives
<math display="block"> \mathbf a \cdot \mathbf b = \mathbf a \cdot \sum_i b_i \mathbf e_i = \sum_i b_i ( \mathbf a \cdot \mathbf e_i ) = \sum_i b_i a_i= \sum_i a_i b_i ,</math>
which is precisely the algebraic definition of the dot product. So the geometric dot product equals the algebraic dot product.
Properties
The dot product fulfills the following properties if <math>\mathbf{a}</math>, <math>\mathbf{b}</math>, <math>\mathbf{c}</math> and <math>\mathbf{d}</math> are real vectors and <math>\alpha</math>, <math>\beta</math>, <math>\gamma</math> and <math>\delta</math> are scalars. <math display="block"> \mathbf{a} \cdot \mathbf{b} = \left\| \mathbf{a} \right\| \left\| \mathbf{b} \right\| \cos \theta = \left\| \mathbf{b} \right\| \left\| \mathbf{a} \right\| \cos \theta = \mathbf{b} \cdot \mathbf{a} .</math> The commutative property can also be easily proven with the algebraic definition, and in more general spaces (where the notion of angle might not be geometrically intuitive but an analogous product can be defined) the angle between two vectors can be defined as
<math display="block"> \theta = \operatorname{arccos}\left( \frac{\mathbf{a}\cdot\mathbf{b{\left\|\mathbf{a}\right\| \left\|\mathbf{b}\right\|} \right). </math>
; Bilinear (additive, distributive and scalar-multiplicative in both arguments) : <math display="block">
\begin{align}
(\alpha \mathbf{a} + \beta\mathbf{b})&\cdot (\gamma\mathbf{c}+\delta\mathbf{d}) \\
&=\alpha\gamma(\mathbf{a}\cdot\mathbf{c}) + \alpha\delta(\mathbf{a}\cdot\mathbf{d}) +\beta\gamma(\mathbf{b}\cdot\mathbf{c}) +\beta\delta(\mathbf{b}\cdot\mathbf{d}) . \end{align}</math>
; Not associative : Because the dot product is not defined between a scalar <math>\mathbf{a}\cdot\mathbf{b}</math> and a vector <math>\mathbf{c},</math> associativity is meaningless. However, bilinearity implies <math display="block">c (\mathbf{a} \cdot \mathbf{b}) = (c\mathbf{a})\cdot\mathbf{b} = \mathbf{a}\cdot(c\mathbf{b}).</math> This property is sometimes called the "associative law for scalar and dot product", and one may say that "the dot product is associative with respect to scalar multiplication".
; Orthogonal : Two non-zero vectors <math>\mathbf{a}</math> and <math>\mathbf{b}</math> are orthogonal if and only if <math>\mathbf{a} \cdot \mathbf{b} = 0</math>.
; No cancellation
: Unlike multiplication of ordinary numbers, where if <math>ab=ac</math>, then <math>b</math> always equals <math>c</math> unless <math>a</math> is zero, the dot product does not obey the cancellation law: If <math>\mathbf{a}\cdot\mathbf{b}=\mathbf{a}\cdot\mathbf{c}</math> and <math>\mathbf{a}\neq\mathbf{0}</math>, then we can write: <math>\mathbf{a}\cdot(\mathbf{b}-\mathbf{c}) = 0</math> by the distributive law; the result above says this just means that <math>\mathbf{a}</math> is perpendicular to <math>(\mathbf{b}-\mathbf{c})</math>, which still allows <math>(\mathbf{b}-\mathbf{c})\neq\mathbf{0}</math>, and therefore allows <math>\mathbf{b}\neq\mathbf{c}</math>.
; Product rule : If <math>\mathbf{a}</math> and <math>\mathbf{b}</math> are vector-valued differentiable functions, then the derivative (denoted by a prime <math>{}'</math>) of <math>\mathbf{a}\cdot\mathbf{b}</math> is given by the rule <math display="block">(\mathbf{a}\cdot\mathbf{b})' = \mathbf{a}'\cdot\mathbf{b} + \mathbf{a}\cdot\mathbf{b}'.</math>
Application to the law of cosines
100px|thumb|Triangle with vector edges a and b, separated by angle θ
Given two vectors <math>{\color{red}\mathbf{a</math> and <math>{\color{blue}\mathbf{b</math> separated by angle <math>\theta</math> (see the upper image), they form a triangle with a third side <math>{\color{orange}\mathbf{c = {\color{red}\mathbf{a - {\color{blue}\mathbf{b</math>. Let <math>\color{red}a</math>, <math>\color{blue}b</math> and <math>\color{orange}c</math> denote the lengths of <math>{\color{red}\mathbf{a</math>, <math>{\color{blue}\mathbf{b</math>, and <math>{\color{orange}\mathbf{c</math>, respectively. The dot product of <math>{\color{orange}\mathbf{c</math> with itself is:
<math display="block">
\begin{align}
\mathbf{\color{orange}c} \cdot \mathbf{\color{orange}c} & = ( \mathbf{\color{red}a} - \mathbf{\color{blue}b}) \cdot ( \mathbf{\color{red}a} - \mathbf{\color{blue}b} ) \\
& = \mathbf{\color{red}a} \cdot \mathbf{\color{red}a} - \mathbf{\color{red}a} \cdot \mathbf{\color{blue}b} - \mathbf{\color{blue}b} \cdot \mathbf{\color{red}a} + \mathbf{\color{blue}b} \cdot \mathbf{\color{blue}b} \\
& = {\color{red}a}^2 - \mathbf{\color{red}a} \cdot \mathbf{\color{blue}b} - \mathbf{\color{red}a} \cdot \mathbf{\color{blue}b} + {\color{blue}b}^2 \\
& = {\color{red}a}^2 - 2 \mathbf{\color{red}a} \cdot \mathbf{\color{blue}b} + {\color{blue}b}^2 \\
{\color{orange}c}^2 & = {\color{red}a}^2 + {\color{blue}b}^2 - 2 {\color{red}a} {\color{blue}b} \cos \mathbf{\color{purple}\theta} \\
\end{align}
</math>
which is the law of cosines.
Triple product
There are two ternary operations involving dot product and cross product.
The scalar triple product of three vectors is defined as
<math display="block"> \mathbf{a} \cdot ( \mathbf{b} \times \mathbf{c} ) = \mathbf{b} \cdot ( \mathbf{c} \times \mathbf{a} )=\mathbf{c} \cdot ( \mathbf{a} \times \mathbf{b} ).</math>
Its value is the determinant of the matrix whose columns are the Cartesian coordinates of the three vectors. It is the signed volume of the parallelepiped defined by the three vectors, and is isomorphic to the three-dimensional special case of the exterior product of three vectors.
The vector triple product is defined by
- Mechanical work is the dot product of force and displacement vectors,
- Power is the dot product of force and velocity.
Generalizations
Complex vectors
For vectors with complex entries, using the given definition of the dot product would lead to quite different properties. For instance, the dot product of a vector with itself could be zero without the vector being the zero vector (e.g. this would happen with the vector This in turn would have consequences for notions like length and angle. Properties such as the positive-definite norm can be salvaged at the cost of giving up the symmetric and bilinear properties of the dot product, through the alternative definition
