In mathematics, the dot product or scalar product[note 1] is an algebraic operation that takes two equal-length sequences of numbers (usually coordinate vectors), and returns a single number.
In Euclidean geometry, the dot product of the Cartesian coordinates of two vectors is widely used.
Geometrically, it is the product of the Euclidean magnitudes of the two vectors and the cosine of the angle between them.
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 such a presentation, the notions of length and angle are defined by means of the dot product.
For instance, in three-dimensional space, the dot product of vectors
In terms of the geometric definition of the dot product, this can be rewritten as
The dot product, defined in this manner, is homogeneous under scaling in each variable, meaning that for any scalar
These properties may be summarized by saying that the dot product is a bilinear form.
are an orthonormal basis, which means that they have unit length and are at right angles to each other.
Now applying the distributivity of the geometric version of the dot product gives
(see the upper image), they form a triangle with a third side
Its value is the determinant of the matrix whose columns are the Cartesian coordinates of the three vectors.
This identity, also known as Lagrange's formula, may be remembered as "ACB minus ABC", keeping in mind which vectors are dotted together.
This formula has applications in simplifying vector calculations in physics.
In physics, the dot product takes two vectors and returns a scalar quantity.
For example:[10][11] For vectors with complex entries, using the given definition of the dot product would lead to quite different properties.
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[12][2]
When vectors are represented by column vectors, the dot product can be expressed as a matrix product involving a conjugate transpose, denoted with the superscript H:
The complex dot product leads to the notions of Hermitian forms and general inner product spaces, which are widely used in mathematics and physics.
, involving the conjugate transpose of a row vector, is also known as the norm squared,
The inner product generalizes the dot product to abstract vector spaces over a field of scalars, being either the field of real numbers
The dot product is defined for vectors that have a finite number of entries.
Thus these vectors can be regarded as discrete functions: a length-
This notion can be generalized to square-integrable functions: just as the inner product on vectors uses a sum over corresponding components, the inner product on functions is defined as an integral over some measure space
The straightforward algorithm for calculating a floating-point dot product of vectors can suffer from catastrophic cancellation.
To avoid this, approaches such as the Kahan summation algorithm are used.