In

^{''n''}. In such a presentation, the notions of length and angles are defined by means of the dot product. The length of a vector is defined as the

_{1}, ..., e_{''n''} are the standard basis vectors in R^{''n''}, then we may write
:$\backslash begin\; \backslash mathbf\; a\; \&=;\; href="/html/ALL/s/\_1\_,\_\backslash dots\_,\_a\_n.html"\; ;"title="\_1\; ,\; \backslash dots\; ,\; a\_n">\_1\; ,\; \backslash dots\; ,\; a\_n$
The vectors e_{''i''} are an _{ ij } is the _{''i''} and a vector a, we note
:$\backslash mathbf\; a\; \backslash cdot\; \backslash mathbf\; e\_i\; =\; \backslash left\backslash ,\; \backslash mathbf\; a\; \backslash right\backslash ,\; \backslash ,\; \backslash left\backslash ,\; \backslash mathbf\; e\_i\; \backslash right\backslash ,\; \backslash cos\; \backslash theta\_i\; =\; \backslash left\backslash ,\; \backslash mathbf\; a\; \backslash right\backslash ,\; \backslash cos\; \backslash theta\_i\; =\; a\_i\; ,$
where ''a''_{''i''} is the component of vector a in the direction of e_{''i''}. 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
:$\backslash mathbf\; a\; \backslash cdot\; \backslash mathbf\; b\; =\; \backslash mathbf\; a\; \backslash cdot\; \backslash sum\_i\; b\_i\; \backslash mathbf\; e\_i\; =\; \backslash sum\_i\; b\_i\; (\; \backslash mathbf\; a\; \backslash cdot\; \backslash mathbf\; e\_i\; )\; =\; \backslash sum\_i\; b\_i\; a\_i=\; \backslash sum\_i\; a\_i\; b\_i\; ,$
which is precisely the algebraic definition of the dot product. So the geometric dot product equals the algebraic dot product.

Explanation of dot product including with complex vectors

"Dot Product"

by Bruce Torrence,

mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and their changes (cal ...

, the dot product or scalar productThe term ''scalar product'' is often also used more generally to mean a symmetric bilinear formA symmetric bilinear form on a vector space is a bilinear map from two copies of the vector space to the field of scalars such that the order of the two vectors does not affect the value of the map. In other words, it is a bilinear function B tha ...

, for example for a pseudo-Euclidean spaceIn mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ha ...

. is an algebraic operation
In mathematics, a basic algebraic operation is any one of the common Operation (mathematics), operations of arithmetic, which include addition, subtraction, multiplication, Division (mathematics), division, raising to an integer exponentiation, powe ...

that takes two equal-length sequences of numbers (usually coordinate vector
In linear algebra, a coordinate vector is a representation of a vector as an ordered list of numbers that describes the vector in terms of a particular ordered basis. Coordinates are always specified relative to an ordered basis. Bases and their a ...

s), and returns a single number. In Euclidean geometry
Euclidean geometry is a mathematical system attributed to Alexandria
Alexandria ( or ; ar, الإسكندرية ; arz, اسكندرية ; Coptic
Coptic may refer to:
Afro-Asia
* Copts, an ethnoreligious group mainly in the area of modern ...

, the dot product of the Cartesian coordinates
A Cartesian coordinate system (, ) in a plane
Plane or planes may refer to:
* Airplane
An airplane or aeroplane (informally plane) is a fixed-wing aircraft
A fixed-wing aircraft is a heavier-than-air flying machine
Early fly ...

of two vectors
Vector may refer to:
Biology
*Vector (epidemiology), an agent that carries and transmits an infectious pathogen into another living organism; a disease vector
*Vector (molecular biology), a DNA molecule used as a vehicle to artificially carr ...

is widely used. It is often called "the" inner product (or rarely projection product) of Euclidean space, even though it is not the only inner product that can be defined on Euclidean space (see Inner product space
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). I ...

for more).
Algebraically, the dot product is the sum of the products
Product may refer to:
Business
* Product (business), an item that serves as a solution to a specific consumer problem.
* Product (project management), a deliverable or set of deliverables that contribute to a business solution
Mathematics
* Produc ...

of the corresponding entries of the two sequences of numbers. Geometrically, it is the product of the s of the two vectors and the cosine
In mathematics, the trigonometric functions (also called circular functions, angle functions or goniometric functions) are real functions which relate an angle of a right-angled triangle to ratios of two side lengths. They are widely used in al ...

of the angle between them. These definitions are equivalent when using Cartesian coordinates. In modern geometry
Geometry (from the grc, γεωμετρία; ' "earth", ' "measurement") is, with , one of the oldest branches of . It is concerned with properties of space that are related with distance, shape, size, and relative position of figures. A mat ...

, Euclidean space
Euclidean space is the fundamental space of classical geometry. Originally, it was the three-dimensional space of Euclidean geometry, but in modern mathematics there are Euclidean spaces of any nonnegative integer dimension (mathematics), dimens ...

s are often defined by using vector space
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities a ...

s. In this case, the dot product is used for defining lengths (the length of a vector is the square root
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities ...

of the dot product of the vector by itself) and angles (the cosine of the angle of two vectors is the quotient
In arithmetic
Arithmetic (from the Ancient Greek, Greek wikt:en:ἀριθμός#Ancient Greek, ἀριθμός ''arithmos'', 'number' and wikt:en:τική#Ancient Greek, τική wikt:en:τέχνη#Ancient Greek, έχνη ''tiké échne' ...

of their dot product by the product of their lengths).
The name "dot product" is derived from the centered dot
An interpunct, , also known as an interpoint, middle dot, middot and centered dot or centred dot, is a punctuation mark consisting of a vertically centered dot used for interword separation in ancient Latin alphabet, Latin script. (Word-separatin ...

" · ", that is often used to designate this operation; the alternative name "scalar product" emphasizes that the result is a scalar
Scalar may refer to:
*Scalar (mathematics), an element of a field, which is used to define a vector space, usually the field of real numbers
*Scalar (physics), a physical quantity that can be described by a single element of a number field such as ...

, rather than a vector
Vector may refer to:
Biology
*Vector (epidemiology)
In epidemiology
Epidemiology is the study and analysis of the distribution (who, when, and where), patterns and risk factor, determinants of health and disease conditions in defined pop ...

, as is the case for the vector product
In mathematics, the cross product or vector product (occasionally directed area product, to emphasize its geometric significance) is a binary operation on two Euclidean vector, vectors in three-dimensional space \mathbb^3, and is denoted by the sym ...

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 aCartesian coordinate system
A Cartesian coordinate system (, ) in a plane
Plane or planes may refer to:
* Airplane
An airplane or aeroplane (informally plane) is a fixed-wing aircraft
A fixed-wing aircraft is a heavier-than-air flying machine
Early fly ...

for Euclidean space.
In modern presentations of Euclidean geometry
Euclidean geometry is a mathematical system attributed to Alexandria
Alexandria ( or ; ar, الإسكندرية ; arz, اسكندرية ; Coptic
Coptic may refer to:
Afro-Asia
* Copts, an ethnoreligious group mainly in the area of modern ...

, the points of space are defined in terms of their Cartesian coordinates
A Cartesian coordinate system (, ) in a plane
Plane or planes may refer to:
* Airplane
An airplane or aeroplane (informally plane) is a fixed-wing aircraft
A fixed-wing aircraft is a heavier-than-air flying machine
Early fly ...

, and Euclidean space
Euclidean space is the fundamental space of classical geometry. Originally, it was the three-dimensional space of Euclidean geometry, but in modern mathematics there are Euclidean spaces of any nonnegative integer dimension (mathematics), dimens ...

itself is commonly identified with the real coordinate space
of ordered pairs . Blue lines denote coordinate axes, horizontal green lines are integer , vertical cyan lines are integer , brown-orange lines show half-integer or , magenta and its tint show multiples of one tenth (best seen under magnification ...

Rsquare root
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities ...

of the dot product of the vector by itself, and the cosine
In mathematics, the trigonometric functions (also called circular functions, angle functions or goniometric functions) are real functions which relate an angle of a right-angled triangle to ratios of two side lengths. They are widely used in al ...

of the (non oriented) angle of 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.
Algebraic definition

The dot product of two vectors and is defined as: :$\backslash mathbf\backslash cdot\backslash mathbf=\backslash sum\_^n\; \_i\_i=\_1\_1+\_2\_2+\backslash cdots+\_n\_n$ where Σ denotessummation
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

and ''n'' is the dimension
In physics
Physics is the that studies , its , its and behavior through , and the related entities of and . "Physical science is that department of knowledge which relates to the order of nature, or, in other words, to the regular s ...

of the vector space
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities a ...

. For instance, in three-dimensional space
Three-dimensional space (also: 3-space or, rarely, tri-dimensional space) is a geometric setting in which three values (called parameters) are required to determine the position of an element (i.e., point). This is the informal meaning of the ...

, the dot product of vectors and is:
:$\backslash begin\; \backslash \; []\; \backslash cdot\; []\; \&=\; (\; \backslash times\; )\; +\; (\backslash times)\; +\; (\backslash times)\; \backslash \backslash \; \&=\; 4\; -\; 6\; +\; 5\; \backslash \backslash \; \&=\; 3\; \backslash end$
If vectors are identified with row matrix, row matrices, the dot product can also be written as a matrix multiplication, matrix product
:$\backslash mathbf\; \backslash cdot\; \backslash mathbf\; =\; \backslash mathbf\backslash mathbf^\backslash mathsf\; T,$
where $\backslash mathbf^\backslash mathsf\; T$ denotes the transpose
In linear algebra
Linear algebra is the branch of mathematics concerning linear equations such as:
:a_1x_1+\cdots +a_nx_n=b,
linear maps such as:
:(x_1, \ldots, x_n) \mapsto a_1x_1+\cdots +a_nx_n,
and their representations in vector spaces a ...

of $\backslash mathbf$.
Expressing the above example in this way, a 1 × 3 matrix (row vector
In linear algebra
Linear algebra is the branch of mathematics concerning linear equations such as:
:a_1x_1+\cdots +a_nx_n=b,
linear maps such as:
:(x_1, \ldots, x_n) \mapsto a_1x_1+\cdots +a_nx_n,
and their representations in vector spaces and th ...

) is multiplied by a 3 × 1 matrix (column vector
In linear algebra
Linear algebra is the branch of mathematics concerning linear equations such as:
:a_1x_1+\cdots +a_nx_n=b,
linear maps such as:
:(x_1, \ldots, x_n) \mapsto a_1x_1+\cdots +a_nx_n,
and their representations in vector spaces and ...

) to get a 1 × 1 matrix that is identified with its unique entry:
:$\backslash begin\; \backslash color1\; \&\; \backslash color3\; \&\; \backslash color-5\; \backslash end\; \backslash begin\; \backslash color4\; \backslash \backslash \; \backslash color-2\; \backslash \backslash \; \backslash color-1\; \backslash end\; =\; \backslash color3$.
Geometric definition

InEuclidean space
Euclidean space is the fundamental space of classical geometry. Originally, it was the three-dimensional space of Euclidean geometry, but in modern mathematics there are Euclidean spaces of any nonnegative integer dimension (mathematics), dimens ...

, a Euclidean vector
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

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 a is denoted by $\backslash left\backslash ,\; \backslash mathbf\; \backslash right\backslash ,$. The dot product of two Euclidean vectors a and b is defined by
:$\backslash mathbf\backslash cdot\backslash mathbf=\backslash ,\; \backslash mathbf\backslash ,\; \backslash \; \backslash ,\; \backslash mathbf\backslash ,\; \backslash cos\backslash theta\; ,$
where is the angle
In Euclidean geometry
Euclidean geometry is a mathematical system attributed to Alexandrian Greek mathematics , Greek mathematician Euclid, which he described in his textbook on geometry: the ''Euclid's Elements, Elements''. Euclid's method ...

between and .
In particular, if the vectors and are orthogonal
In mathematics, orthogonality is the generalization of the notion of perpendicularity to the linear algebra of bilinear forms. Two elements ''u'' and ''v'' of a vector space with bilinear form ''B'' are orthogonal when . Depending on the bili ...

(i.e., their angle is or 90°), then $\backslash cos\; \backslash frac\; \backslash pi\; 2\; =\; 0$, which implies that
:$\backslash mathbf\; a\; \backslash cdot\; \backslash mathbf\; b\; =\; 0\; .$
At the other extreme, if they are codirectional, then the angle between them is zero with $\backslash cos\; 0\; =\; 1$ and
:$\backslash mathbf\; a\; \backslash cdot\; \backslash mathbf\; b\; =\; \backslash left\backslash ,\; \backslash mathbf\; a\; \backslash right\backslash ,\; \backslash ,\; \backslash left\backslash ,\; \backslash mathbf\; b\; \backslash right\backslash ,$
This implies that the dot product of a vector a with itself is
:$\backslash mathbf\; a\; \backslash cdot\; \backslash mathbf\; a\; =\; \backslash left\backslash ,\; \backslash mathbf\; a\; \backslash right\backslash ,\; ^2\; ,$
which gives
: $\backslash left\backslash ,\; \backslash mathbf\; a\; \backslash right\backslash ,\; =\; \backslash sqrt\; ,$
the formula for the Euclidean length
In mathematics, the Euclidean distance between two points in Euclidean space is the length of a line segment between the two points.
It can be calculated from the Cartesian coordinates of the points using the Pythagorean theorem, therefore occa ...

of the vector.
Scalar projection and first properties

The scalar projection (or scalar component) of a Euclidean vector a in the direction of a Euclidean vector b is given by :$a\_b\; =\; \backslash left\backslash ,\; \backslash mathbf\; a\; \backslash right\backslash ,\; \backslash cos\; \backslash theta\; ,$ where is the angle between a and b. In terms of the geometric definition of the dot product, this can be rewritten :$a\_b\; =\; \backslash mathbf\; a\; \backslash cdot\; \backslash widehat\; ,$ where $\backslash widehat\; =\; \backslash mathbf\; b\; /\; \backslash left\backslash ,\; \backslash mathbf\; b\; \backslash right\backslash ,$ is theunit vector
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and t ...

in the direction of b.
The dot product is thus characterized geometrically by
:$\backslash mathbf\; a\; \backslash cdot\; \backslash mathbf\; b\; =\; a\_b\; \backslash left\backslash ,\; \backslash mathbf\; \backslash right\backslash ,\; =\; b\_a\; \backslash left\backslash ,\; \backslash mathbf\; \backslash right\backslash ,\; .$
The dot product, defined in this manner, is homogeneous under scaling in each variable, meaning that for any scalar ''α'',
:$(\; \backslash alpha\; \backslash mathbf\; )\; \backslash cdot\; \backslash mathbf\; b\; =\; \backslash alpha\; (\; \backslash mathbf\; a\; \backslash cdot\; \backslash mathbf\; b\; )\; =\; \backslash mathbf\; a\; \backslash cdot\; (\; \backslash alpha\; \backslash mathbf\; b\; )\; .$
It also satisfies a distributive law
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no gen ...

, meaning that
:$\backslash mathbf\; a\; \backslash cdot\; (\; \backslash mathbf\; b\; +\; \backslash mathbf\; c\; )\; =\; \backslash mathbf\; a\; \backslash cdot\; \backslash mathbf\; b\; +\; \backslash mathbf\; a\; \backslash cdot\; \backslash mathbf\; c\; .$
These properties may be summarized by saying that the dot product is a bilinear form
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It h ...

. Moreover, this bilinear form is positive definiteIn mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ha ...

, which means that
$\backslash mathbf\; a\; \backslash cdot\; \backslash mathbf\; a$
is never negative, and is zero if and only if $\backslash mathbf\; a\; =\; \backslash mathbf\; 0$—the zero vector.
The dot product is thus equivalent to multiplying the norm (length) of b by the norm of the projection of a over b.
Equivalence of the definitions

If eorthonormal basis In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and the ...

, which means that they have unit length and are at right angles to each other. Hence since these vectors have unit length
:$\backslash mathbf\; e\_i\; \backslash cdot\; \backslash mathbf\; e\_i\; =\; 1$
and since they form right angles with each other, if ,
:$\backslash mathbf\; e\_i\; \backslash cdot\; \backslash mathbf\; e\_j\; =\; 0\; .$
Thus in general, we can say that:
:$\backslash mathbf\; e\_i\; \backslash cdot\; \backslash mathbf\; e\_j\; =\; \backslash delta\_\; .$
Where δ Kronecker delta
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

.
Also, by the geometric definition, for any vector eProperties

The dot product fulfills the following properties if a, b, and c are realvectors
Vector may refer to:
Biology
*Vector (epidemiology), an agent that carries and transmits an infectious pathogen into another living organism; a disease vector
*Vector (molecular biology), a DNA molecule used as a vehicle to artificially carr ...

and ''r'' is a scalar
Scalar may refer to:
*Scalar (mathematics), an element of a field, which is used to define a vector space, usually the field of real numbers
*Scalar (physics), a physical quantity that can be described by a single element of a number field such as ...

.
# Commutative
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

:
#: $\backslash mathbf\; \backslash cdot\; \backslash mathbf\; =\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; ,$
#: which follows from the definition (''θ'' is the angle between a and b):
#: $\backslash mathbf\; \backslash cdot\; \backslash mathbf\; =\; \backslash left\backslash ,\; \backslash mathbf\; \backslash right\backslash ,\; \backslash left\backslash ,\; \backslash mathbf\; \backslash right\backslash ,\; \backslash cos\; \backslash theta\; =\; \backslash left\backslash ,\; \backslash mathbf\; \backslash right\backslash ,\; \backslash left\backslash ,\; \backslash mathbf\; \backslash right\backslash ,\; \backslash cos\; \backslash theta\; =\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; .$
# Distributive over vector addition:
#: $\backslash mathbf\; \backslash cdot\; (\backslash mathbf\; +\; \backslash mathbf)\; =\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; +\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; .$
# Bilinear:
#: $\backslash mathbf\; \backslash cdot\; (\; r\; \backslash mathbf\; +\; \backslash mathbf\; )\; =\; r\; (\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; )\; +\; (\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; )\; .$
# Scalar multiplication
In mathematics, scalar multiplication is one of the basic operations defining a vector space in linear algebra (or more generally, a module (mathematics), module in abstract algebra). In common geometrical contexts, scalar multiplication of a re ...

:
#: $(\; c\_1\; \backslash mathbf\; )\; \backslash cdot\; (\; c\_2\; \backslash mathbf\; )\; =\; c\_1\; c\_2\; (\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; )\; .$
# Not associative
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ...

because the dot product between a scalar (a ⋅ b) and a vector (c) is not defined, which means that the expressions involved in the associative property, (a ⋅ b) ⋅ c or a ⋅ (b ⋅ c) are both ill-defined. Note however that the previously mentioned scalar multiplication property is sometimes called the "associative law for scalar and dot product" or one can say that "the dot product is associative with respect to scalar multiplication" because ''c'' (a ⋅ b) = (''c'' a) ⋅ b = a ⋅ (''c'' b).
# Orthogonal
In mathematics, orthogonality is the generalization of the notion of perpendicularity to the linear algebra of bilinear forms. Two elements ''u'' and ''v'' of a vector space with bilinear form ''B'' are orthogonal when . Depending on the bili ...

:
#: Two non-zero vectors a and b are ''orthogonal'' if and only if
In logic
Logic is an interdisciplinary field which studies truth and reasoning. Informal logic seeks to characterize Validity (logic), valid arguments informally, for instance by listing varieties of fallacies. Formal logic represents st ...

.
# No cancellation:
#: Unlike multiplication of ordinary numbers, where if , then ''b'' always equals ''c'' unless ''a'' is zero, the dot product does not obey the cancellation law
In mathematics, the notion of cancellative is a generalization of the notion of invertible.
An element ''a'' in a magma (algebra), magma has the left cancellation property (or is left-cancellative) if for all ''b'' and ''c'' in ''M'', always imp ...

:
#: If and , then we can write: by the distributive law
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no gen ...

; the result above says this just means that a is perpendicular to , which still allows , and therefore allows .
# Product Rule
In calculus, the product rule (or Leibniz rule or Leibniz product rule) is a formula used to find the derivatives of products of two or more Functions (mathematics), functions. For two functions, it may be stated in Notation for differentiatio ...

:
#: If a and b are (vector-valued) differentiable function
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and t ...

s, then the derivative ( denoted by a prime ) of is given by the rule .
Application to the law of cosines

Given two vectors a and b separated by angle ''θ'' (see image right), they form a triangle with a third side . The dot product of this with itself is: :$\backslash begin\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; \&\; =\; (\; \backslash mathbf\; -\; \backslash mathbf)\; \backslash cdot\; (\; \backslash mathbf\; -\; \backslash mathbf\; )\; \backslash \backslash \; \&\; =\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; -\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; -\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; +\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; \backslash \backslash \; \&\; =\; \backslash mathbf^2\; -\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; -\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; +\; \backslash mathbf^2\; \backslash \backslash \; \&\; =\; \backslash mathbf^2\; -\; 2\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; +\; \backslash mathbf^2\; \backslash \backslash \; \backslash mathbf^2\; \&\; =\; \backslash mathbf^2\; +\; \backslash mathbf^2\; -\; 2\; \backslash mathbf\; \backslash mathbf\; \backslash cos\; \backslash mathbf\; \backslash \backslash \; \backslash end$ which is thelaw of cosines
In trigonometry
Trigonometry (from ', "triangle" and ', "measure") is a branch of that studies relationships between side lengths and s of s. The field emerged in the during the 3rd century BC from applications of to . The Greeks focu ...

.
Triple product

There are twoternary operationIn mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ha ...

s involving dot product and cross product
In , the cross product or vector product (occasionally directed area product, to emphasize its geometric significance) is a on two s in a three-dimensional (named here E), and is denoted by the symbol \times. Given two and , the cross produc ...

.
The scalar triple product of three vectors is defined as
:$\backslash mathbf\; \backslash cdot\; (\; \backslash mathbf\; \backslash times\; \backslash mathbf\; )\; =\; \backslash mathbf\; \backslash cdot\; (\; \backslash mathbf\; \backslash times\; \backslash mathbf\; )=\backslash mathbf\; \backslash cdot\; (\; \backslash mathbf\; \backslash times\; \backslash mathbf\; ).$
Its value is the determinant
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and t ...

of the matrix whose columns are the Cartesian coordinates
A Cartesian coordinate system (, ) in a plane
Plane or planes may refer to:
* Airplane
An airplane or aeroplane (informally plane) is a fixed-wing aircraft
A fixed-wing aircraft is a heavier-than-air flying machine
Early fly ...

of the three vectors. It is the signed volume
Volume is a scalar quantity expressing the amount
Quantity or amount is a property that can exist as a multitude
Multitude is a term for a group of people who cannot be classed under any other distinct category, except for their shared fact ...

of the parallelepiped
In geometry
Geometry (from the grc, γεωμετρία; ' "earth", ' "measurement") is, with , one of the oldest branches of . It is concerned with properties of space that are related with distance, shape, size, and relative position of f ...

defined by the three vectors, and is isomorphic to the three-dimensional special case of the exterior product
In topology
s, which have only one surface and one edge, are a kind of object studied in topology.
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical struc ...

of three vectors.
The vector triple product is defined by
:$\backslash mathbf\; \backslash times\; (\; \backslash mathbf\; \backslash times\; \backslash mathbf\; )\; =\; (\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; )\backslash ,\; \backslash mathbf\; -\; (\; \backslash mathbf\; \backslash cdot\; \backslash mathbf\; )\backslash ,\; \backslash mathbf\; .$
This identity, also known as ''Lagrange's formula'', as "ACB minus ABC", keeping in mind which vectors are dotted together. This formula has applications in simplifying vector calculations in physics
Physics is the natural science that studies matter, its Elementary particle, fundamental constituents, its Motion (physics), motion and behavior through Spacetime, space and time, and the related entities of energy and force. "Physical scie ...

.
Physics

Inphysics
Physics is the natural science that studies matter, its Elementary particle, fundamental constituents, its Motion (physics), motion and behavior through Spacetime, space and time, and the related entities of energy and force. "Physical scie ...

, vector magnitude is a scalar
Scalar may refer to:
*Scalar (mathematics), an element of a field, which is used to define a vector space, usually the field of real numbers
*Scalar (physics), a physical quantity that can be described by a single element of a number field such as ...

in the physical sense (i.e., a physical quantity
A physical quantity is a physical property of a material or system that can be Quantification (science), quantified by measurement. A physical quantity can be expressed as a ''value'', which is the algebraic multiplication of a ''numerical value'' ...

independent of the coordinate system), expressed as the product of a numerical value
A number is a mathematical object used to count, measure, and label. The original examples are the natural numbers 1, 2, 3, 4, and so forth. Numbers can be represented in language with number words. More universally, individual numbers can b ...

and a physical unit
A unit of measurement is a definite magnitude
Magnitude may refer to:
Mathematics
*Euclidean vector, a quantity defined by both its magnitude and its direction
*Magnitude (mathematics), the relative size of an object
*Norm (mathematic ...

, not just a number. The dot product is also a scalar in this sense, given by the formula, independent of the coordinate system. For example:
* Mechanical work
In physics
Physics is the that studies , its , its and behavior through , and the related entities of and . "Physical science is that department of knowledge which relates to the order of nature, or, in other words, to the regular ...

is the dot product of force
In physics, a force is an influence that can change the motion (physics), motion of an Physical object, object. A force can cause an object with mass to change its velocity (e.g. moving from a Newton's first law, state of rest), i.e., to acce ...

and displacement
Displacement may refer to:
Physical sciences
Mathematics and Physics
*Displacement (geometry), is the difference between the final and initial position of a point trajectory (for instance, the center of mass of a moving object). The actual path c ...

vectors,
* Power
Power most often refers to:
* Power (physics)
In physics, power is the amount of energy
In , energy is the that must be to a or to perform on the body, or to it. Energy is a ; the law of states that energy can be in form, bu ...

is the dot product of force
In physics, a force is an influence that can change the motion (physics), motion of an Physical object, object. A force can cause an object with mass to change its velocity (e.g. moving from a Newton's first law, state of rest), i.e., to acce ...

and velocity
The velocity of an object is the rate of change of its position with respect to a frame of reference
In physics
Physics is the that studies , its , its and behavior through , and the related entities of and . "Physical scie ...

.
Generalizations

Complex vectors

For vectors withcomplex
The UCL Faculty of Mathematical and Physical Sciences is one of the 11 constituent faculties of University College London
, mottoeng = Let all come who by merit deserve the most reward
, established =
, type = Public university, Public rese ...

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 would be an arbitrary complex number, and could be zero without the vector being the zero vector (such vectors are called isotropic
Isotropy is uniformity in all orientations; it is derived from the Greek ''isos'' (ἴσος, "equal") and ''tropos'' (τρόπος, "way"). Precise definitions depend on the subject area. Exceptions, or inequalities, are frequently indicated by ...

); 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 scalar product, through the alternative definition
:$\backslash mathbf\; \backslash cdot\; \backslash mathbf\; =\; \backslash sum\_i\; ,$
where $\backslash overline$ is the complex conjugate
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no gen ...

of $b\_i$. When vectors are represented by row vector
In linear algebra
Linear algebra is the branch of mathematics concerning linear equations such as:
:a_1x_1+\cdots +a_nx_n=b,
linear maps such as:
:(x_1, \ldots, x_n) \mapsto a_1x_1+\cdots +a_nx_n,
and their representations in vector spaces and th ...

s, the dot product can be expressed as a matrix product involving a conjugate transpose
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

, denoted with the superscript H:
:$\backslash mathbf\; \backslash cdot\; \backslash mathbf\; =\; \backslash mathbf^\backslash mathsf\; \backslash mathbf\; .$
In the case of vectors with real components, this definition is the same as in the real case. The scalar product of any vector with itself is a non-negative real number, and it is nonzero except for the zero vector. However, the complex scalar product is sesquilinear
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It h ...

rather than bilinear, as it is conjugate linear and not linear in a. The scalar product is not symmetric, since
:$\backslash mathbf\; \backslash cdot\; \backslash mathbf\; =\; \backslash overline\; .$
The angle between two complex vectors is then given by
:$\backslash cos\; \backslash theta\; =\; \backslash frac\; .$
The complex scalar product leads to the notions of Hermitian form
In mathematics, a sesquilinear form is a generalization of a bilinear form that, in turn, is a generalization of the concept of the dot product of Euclidean space. A bilinear form is linear map, linear in each of its arguments, but a sesquilinear fo ...

s and general inner product space
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). I ...

s, which are widely used in mathematics and physics
Physics is the natural science that studies matter, its Elementary particle, fundamental constituents, its Motion (physics), motion and behavior through Spacetime, space and time, and the related entities of energy and force. "Physical scie ...

.
The self dot product of a complex vector $\backslash mathbf\; \backslash cdot\; \backslash mathbf\; =\; \backslash mathbf^\backslash mathsf\; \backslash mathbf$, involving the conjugate transpose of a row vector, is a generalization of the scalar ''absolute square
. Each block represents one unit, , and the entire square represents , or the area of the square.
In mathematics, a square is the result of multiplication, multiplying a number by itself. The verb "to square" is used to denote this operation. Squa ...

'' of a complex number.
Inner product

The inner product generalizes the dot product to abstract vector spaces over afield
Field may refer to:
Expanses of open ground
* Field (agriculture), an area of land used for agricultural purposes
* Airfield, an aerodrome that lacks the infrastructure of an airport
* Battlefield
* Lawn, an area of mowed grass
* Meadow, a grassl ...

of scalars, being either the field of real number
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no g ...

s $\backslash R$ or the field of complex number
In mathematics, a complex number is an element of a number system that contains the real numbers and a specific element denoted , called the imaginary unit, and satisfying the equation . Moreover, every complex number can be expressed in the for ...

s $\backslash Complex$. It is usually denoted using angular brackets
A bracket is either of two tall fore- or back-facing punctuation marks commonly used to isolate a segment of text or data from its surroundings. Typically deployed in symmetric pairs, an individual bracket may be identified as a ''left'' or ...

by $\backslash left\backslash langle\; \backslash mathbf\; \backslash ,\; ,\; \backslash mathbf\; \backslash right\backslash rangle$.
The inner product of two vectors over the field of complex numbers is, in general, a complex number, and is sesquilinear
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It h ...

instead of bilinear. An inner product space is a normed vector space
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no g ...

, and the inner product of a vector with itself is real and positive-definite.
Functions

The dot product is defined for vectors that have a finite number of entries. Thus these vectors can be regarded asdiscrete function
In mathematics, a sequence is an enumerated collection of objects in which repetitions are allowed and order theory, order matters. Like a Set (mathematics), set, it contains Element (mathematics), members (also called ''elements'', or ''terms''). ...

s: a length- vector is, then, a function with domain
Domain may refer to:
Mathematics
*Domain of a function
In mathematics, the domain of a Function (mathematics), function is the Set (mathematics), set of inputs accepted by the function. It is sometimes denoted by \operatorname(f), where is th ...

, and is a notation for the image of by the function/vector .
This notion can be generalized to continuous function
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

s: 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 interval (also denoted ):
:$\backslash left\backslash langle\; u\; ,\; v\; \backslash right\backslash rangle\; =\; \backslash int\_a^b\; u(x)\; v(x)\; d\; x$
Generalized further to complex function
of the function
.
Hue represents the Argument (complex analysis), argument, brightness the Absolute_value#Complex_numbers, magnitude.
Complex analysis, traditionally known as the theory of functions of a complex variable, is the branch of m ...

s and , by analogy with the complex inner product above, gives
:$\backslash left\backslash langle\; \backslash psi\; ,\; \backslash chi\; \backslash right\backslash rangle\; =\; \backslash int\_a^b\; \backslash psi(x)\; \backslash overline\; d\; x\; .$
Weight function

Inner products can have aweight function
A weight function is a mathematical device used when performing a sum, integral, or average to give some elements more "weight" or influence on the result than other elements in the same set. The result of this application of a weight function is ...

(i.e., a function which weights each term of the inner product with a value). Explicitly, the inner product of functions $u(x)$ and $v(x)$ with respect to the weight function $r(x)>0$ is
:$\backslash left\backslash langle\; u\; ,\; v\; \backslash right\backslash rangle\; =\; \backslash int\_a^b\; r(x)\; u(x)\; v(x)\; d\; x.$
Dyadics and matrices

A double-dot product formatrices
Matrix or MATRIX may refer to:
Science and mathematics
* Matrix (mathematics)
In mathematics, a matrix (plural matrices) is a rectangle, rectangular ''wikt:array, array'' or ''table'' of numbers, symbol (formal), symbols, or expression (mathema ...

is the Frobenius inner product, which is analogous to the dot product on vectors. It is defined as the sum of the products of the corresponding components of two matrices A and B of the same size:
:$\backslash mathbf\; :\; \backslash mathbf\; =\; \backslash sum\_i\; \backslash sum\_j\; A\_\; \backslash overline\; =\; \backslash operatorname\; (\; \backslash mathbf^\backslash mathsf\; \backslash mathbf\; )\; =\; \backslash operatorname\; (\; \backslash mathbf\; \backslash mathbf^\backslash mathsf\; )\; .$
:$\backslash mathbf\; :\; \backslash mathbf\; =\; \backslash sum\_i\; \backslash sum\_j\; A\_\; B\_\; =\; \backslash operatorname\; (\; \backslash mathbf^\backslash mathsf\; \backslash mathbf\; )\; =\; \backslash operatorname\; (\; \backslash mathbf\; \backslash mathbf^\backslash mathsf\; )\; =\; \backslash operatorname\; (\; \backslash mathbf^\backslash mathsf\; \backslash mathbf\; )\; =\; \backslash operatorname\; (\; \backslash mathbf\; \backslash mathbf^\backslash mathsf\; )\; .$ (For real matrices)
Writing a matrix as a dyadic, we can define a different double-dot product (see ,) however it is not an inner product.
Tensors

The inner product between atensor
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities a ...

of order ''n'' and a tensor of order ''m'' is a tensor of order , see Tensor contraction
In multilinear algebra, a tensor contraction is an operation on a tensor that arises from the natural pairing of a finite-dimensional vector space and its dual vector space, dual. In components, it is expressed as a sum of products of scalar compo ...

for details.
Computation

Algorithms

The straightforward algorithm for calculating a floating-point dot product of vectors can suffer fromcatastrophic cancellation
Catastrophe or catastrophic comes from the Greek κατά (''kata'') = down; στροφή (''strophē'') = turning ( el, καταστροφή). It may refer to:
A general or specific event
* Disaster, a devastating event
* The Asia Minor
A ...

. To avoid this, approaches such as the Kahan summation algorithmIn numerical analysis, the Kahan summation algorithm, also known as compensated summation, significantly reduces the numerical error in the total obtained by adding a sequence of finite-decimal precision, precision floating-point numbers, compared to ...

are used.
Libraries

A dot product function is included in: *BLASBlas is mainly a Spanish given name and surname, related to Blaise. It may refer to
Places
* Piz Blas, mountain in Switzerland
* San Blas (disambiguation), many places - see separate article, also
**Cape San Blas Light, lighthouse
** Church San Bl ...

level 1 real SDOT, DDOT; complex CDOTU, ZDOTU = X^T * Y, CDOTC ZDOTC = X^H * Y
* Matlab
MATLAB (an abbreviation of "MATrix LABoratory") is a and environment developed by . MATLAB allows manipulations, plotting of and data, implementation of s, creation of s, and interfacing with programs written in other languages.
Althoug ...

as A' * B or conj(transpose(A)) * B or sum( conj(A) .* B)
* GNU Octave as sum (conj (X) .* Y, dim)
* Intel oneAPI Math Kernel Library real p?dot dot = sub(x)'*sub(y); complex p?dotc dotc = conjg(sub(x)')*sub(y)
See also

*Cauchy–Schwarz inequality
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It h ...

* Cross product
In , the cross product or vector product (occasionally directed area product, to emphasize its geometric significance) is a on two s in a three-dimensional (named here E), and is denoted by the symbol \times. Given two and , the cross produc ...

* Dot product representation of a graph
* Euclidean norm
Euclidean space is the fundamental space of classical geometry. Originally it was the three-dimensional space
Three-dimensional space (also: 3-space or, rarely, tri-dimensional space) is a geometric setting in which three values (called pa ...

, the square-root of the self dot product
* Matrix multiplication
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and t ...

* Metric tensor
In the mathematical
Mathematics (from Greek
Greek may refer to:
Greece
Anything of, from, or related to Greece
Greece ( el, Ελλάδα, , ), officially the Hellenic Republic, is a country located in Southeast Europe. Its population ...

* Multiplication of vectorsIn mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ha ...

* Outer product
In linear algebra
Linear algebra is the branch of mathematics concerning linear equations such as:
:a_1x_1+\cdots +a_nx_n=b,
linear maps such as:
:(x_1, \ldots, x_n) \mapsto a_1x_1+\cdots +a_nx_n,
and their representations in vector spaces and t ...

Notes

References

External links

*Explanation of dot product including with complex vectors

"Dot Product"

by Bruce Torrence,

Wolfram Demonstrations Project
The Wolfram Demonstrations Project is an organized, open-source collection of small (or medium-size) interactive programs called Demonstrations, which are meant to visually and interactively represent ideas from a range of fields. It is hoste ...

, 2007.
{{tensors
Articles containing proofs
Bilinear forms
Operations on vectors
Analytic geometry
Tensors
Scalars