Dot product
Overview

In mathematics
Mathematics
Mathematics is the study of quantity, space, structure, and change. Mathematicians seek out patterns and formulate new conjectures. Mathematicians resolve the truth or falsity of conjectures by mathematical proofs, which are arguments sufficient to convince other mathematicians of their validity...

, the dot product or scalar product is an algebraic operation that takes two equal-length sequences of numbers (usually coordinate vector
Coordinate vector
In linear algebra, a coordinate vector is an explicit representation of a vector in an abstract vector space as an ordered list of numbers or, equivalently, as an element of the coordinate space Fn....

s) and returns a single number obtained by multiplying corresponding entries and then summing those products. The name "dot product" is derived from the centered dot
Interpunct
An interpunct —also called an interpoint—is a small dot used for interword separation in ancient Latin script, which also appears in some modern languages as a stand-alone sign inside a word. It is present in Unicode as code point ....

"  " that is often used to designate this operation; the alternative name "scalar product" emphasizes the scalar
Scalar (mathematics)
In linear algebra, real numbers are called scalars and relate to vectors in a vector space through the operation of scalar multiplication, in which a vector can be multiplied by a number to produce another vector....

(rather than vector) nature of the result.
Encyclopedia
In mathematics
Mathematics
Mathematics is the study of quantity, space, structure, and change. Mathematicians seek out patterns and formulate new conjectures. Mathematicians resolve the truth or falsity of conjectures by mathematical proofs, which are arguments sufficient to convince other mathematicians of their validity...

, the dot product or scalar product is an algebraic operation that takes two equal-length sequences of numbers (usually coordinate vector
Coordinate vector
In linear algebra, a coordinate vector is an explicit representation of a vector in an abstract vector space as an ordered list of numbers or, equivalently, as an element of the coordinate space Fn....

s) and returns a single number obtained by multiplying corresponding entries and then summing those products. The name "dot product" is derived from the centered dot
Interpunct
An interpunct —also called an interpoint—is a small dot used for interword separation in ancient Latin script, which also appears in some modern languages as a stand-alone sign inside a word. It is present in Unicode as code point ....

"  " that is often used to designate this operation; the alternative name "scalar product" emphasizes the scalar
Scalar (mathematics)
In linear algebra, real numbers are called scalars and relate to vectors in a vector space through the operation of scalar multiplication, in which a vector can be multiplied by a number to produce another vector....

(rather than vector) nature of the result. At a basic level, the dot product is used to obtain the cosine of the angle between two vectors.

In a Euclidean vector space, the inner product is equivalent to a dot product: when two Euclidean vectors are expressed on an orthonormal basis
Orthonormal basis
In mathematics, particularly linear algebra, an orthonormal basis for inner product space V with finite dimension is a basis for V whose vectors are orthonormal. For example, the standard basis for a Euclidean space Rn is an orthonormal basis, where the relevant inner product is the dot product of...

, their inner product is equal to their dot product. This is true only for Euclidean space, in which scalars are real number
Real number
In mathematics, a real number is a value that represents a quantity along a continuum, such as -5 , 4/3 , 8.6 , √2 and π...

s; while both the inner and the dot product can be defined in different contexts (for instance with complex number
Complex number
A complex number is a number consisting of a real part and an imaginary part. Complex numbers extend the idea of the one-dimensional number line to the two-dimensional complex plane by using the number line for the real part and adding a vertical axis to plot the imaginary part...

s as scalars) their definitions in these contexts would not coincide. In three dimensional space, the dot product contrasts with the cross product
Cross product
In mathematics, the cross product, vector product, or Gibbs vector product is a binary operation on two vectors in three-dimensional space. It results in a vector which is perpendicular to both of the vectors being multiplied and normal to the plane containing them...

, which produces a vector as result.

## Definition

The dot product of two vectors a = [a1, a2, ... , an] and b = [b1, b2, ... , bn] is defined as:
where Σ denotes summation notation
Summation
Summation is the operation of adding a sequence of numbers; the result is their sum or total. If numbers are added sequentially from left to right, any intermediate result is a partial sum, prefix sum, or running total of the summation. The numbers to be summed may be integers, rational numbers,...

and n is the dimension of the vector space.

In dimension 2, the dot product of vectors [a,b] and [c,d] is ac + bd.
Similarly, in a dimension 3, the dot product of vectors [a,b,c] and [d,e,f] is ad + be + cf.
For example, the dot product of two three-dimensional vectors [1, 3, −5] and [4, −2, −1] is

Given two column vectors, their dot product can also be obtained by multiplying the transpose of one vector with the other vector and extracting the unique coefficient of the resulting matrix. The operation of extracting the coefficient of such a matrix can be written as taking its determinant or its trace (which is the same thing for matrices); since in general whenever or equivalently is a square matrix, one may write
More generally the coefficient (i,j) of a product of matrices is the dot product of the transpose of row i of the first matrix and column j of the second matrix.

## Geometric interpretation

In Euclidean geometry
Euclidean geometry
Euclidean geometry is a mathematical system attributed to the Alexandrian Greek mathematician Euclid, which he described in his textbook on geometry: the Elements. Euclid's method consists in assuming a small set of intuitively appealing axioms, and deducing many other propositions from these...

, the dot product of vectors expressed in an orthonormal basis
Orthonormal basis
In mathematics, particularly linear algebra, an orthonormal basis for inner product space V with finite dimension is a basis for V whose vectors are orthonormal. For example, the standard basis for a Euclidean space Rn is an orthonormal basis, where the relevant inner product is the dot product of...

is related to their length and angle
Angle
In geometry, an angle is the figure formed by two rays sharing a common endpoint, called the vertex of the angle.Angles are usually presumed to be in a Euclidean plane with the circle taken for standard with regard to direction. In fact, an angle is frequently viewed as a measure of an circular arc...

. For such a vector , the dot product is the square of the length of , or

where denotes the length (magnitude) of . If is another such vector,

where is the angle
Angle
In geometry, an angle is the figure formed by two rays sharing a common endpoint, called the vertex of the angle.Angles are usually presumed to be in a Euclidean plane with the circle taken for standard with regard to direction. In fact, an angle is frequently viewed as a measure of an circular arc...

between them.

This formula can be rearranged to determine the size of the angle between two nonzero vectors:

The Cauchy–Schwarz inequality
Cauchy–Schwarz inequality
In mathematics, the Cauchy–Schwarz inequality , is a useful inequality encountered in many different settings, such as linear algebra, analysis, probability theory, and other areas...

guarantees that the argument of is valid.

One can also first convert the vectors to unit vectors by dividing by their magnitude:
then the angle is given by

The terminal points of both unit vectors lie on the unit circle. The unit circle is where the trigonometric values for the six trig functions are found. After substitution, the first vector component is cosine and the second vector component is sine, i.e. for some angle . The dot product of the two unit vectors then takes and for angles and and returns where .

As the cosine of 90° is zero, the dot product of two orthogonal vectors is always zero. Moreover, two vectors can be considered orthogonal if and only if their dot product is zero, and they have non-null length. This property provides a simple method to test the condition of orthogonality.

Sometimes these properties are also used for "defining" the dot product, especially in 2 and 3 dimensions; this definition is equivalent to the above one. For higher dimensions the formula can be used to define the concept of angle.

The geometric properties rely on the basis
Basis (linear algebra)
In linear algebra, a basis is a set of linearly independent vectors that, in a linear combination, can represent every vector in a given vector space or free module, or, more simply put, which define a "coordinate system"...

being orthonormal, i.e. composed of pairwise perpendicular vectors with unit length.

### Scalar projection

If both and have length one (i.e., they are unit vectors), their dot product simply gives the cosine of the angle between them.

If only is a unit vector, then the dot product gives , i.e., the magnitude of the projection of in the direction of , with a minus sign if the direction is opposite. This is called the scalar projection of onto , or scalar component of in the direction of (see figure). This property of the dot product has several useful applications (for instance, see next section).

If neither nor is a unit vector, then the magnitude of the projection of in the direction of is , as the unit vector in the direction of is .

### Rotation

When an orthonormal basis that the vector is represented in terms of is rotated
Rotation (mathematics)
In geometry and linear algebra, a rotation is a transformation in a plane or in space that describes the motion of a rigid body around a fixed point. A rotation is different from a translation, which has no fixed points, and from a reflection, which "flips" the bodies it is transforming...

, 's matrix in the new basis is obtained through multiplying by a rotation matrix . This matrix multiplication
Matrix multiplication
In mathematics, matrix multiplication is a binary operation that takes a pair of matrices, and produces another matrix. If A is an n-by-m matrix and B is an m-by-p matrix, the result AB of their multiplication is an n-by-p matrix defined only if the number of columns m of the left matrix A is the...

is just a compact representation of a sequence of dot products.

For instance, let
• and be two different orthonormal bases
Orthonormal basis
In mathematics, particularly linear algebra, an orthonormal basis for inner product space V with finite dimension is a basis for V whose vectors are orthonormal. For example, the standard basis for a Euclidean space Rn is an orthonormal basis, where the relevant inner product is the dot product of...

of the same space , with obtained by just rotating ,
• represent vector in terms of ,
• represent the same vector in terms of the rotated basis ,
• , , , be the rotated basis vectors , , represented in terms of .

Then the rotation from to is performed as follows:

Notice that the rotation matrix is assembled by using the rotated basis vectors , , as its rows, and these vectors are unit vectors. By definition, consists of a sequence of dot products between each of the three rows of and vector . Each of these dot products determines a scalar component of in the direction of a rotated basis vector (see previous section).

If is a row vector, rather than a column vector, then must contain the rotated basis vectors in its columns, and must post-multiply :

## Physics

In physics
Physics
Physics is a natural science that involves the study of matter and its motion through spacetime, along with related concepts such as energy and force. More broadly, it is the general analysis of nature, conducted in order to understand how the universe behaves.Physics is one of the oldest academic...

, vector magnitude is a scalar
Scalar (physics)
In physics, a scalar is a simple physical quantity that is not changed by coordinate system rotations or translations , or by Lorentz transformations or space-time translations . This is in contrast to a vector...

in the physical sense, i.e. a physical quantity
Physical quantity
A physical quantity is a physical property of a phenomenon, body, or substance, that can be quantified by measurement.-Definition of a physical quantity:Formally, the International Vocabulary of Metrology, 3rd edition defines quantity as:...

independent of the coordinate system, expressed as the product
Product (mathematics)
In mathematics, a product is the result of multiplying, or an expression that identifies factors to be multiplied. The order in which real or complex numbers are multiplied has no bearing on the product; this is known as the commutative law of multiplication...

of a numerical value
Number
A number is a mathematical object used to count and measure. In mathematics, the definition of number has been extended over the years to include such numbers as zero, negative numbers, rational numbers, irrational numbers, and complex numbers....

and a physical unit, not just a number. The dot product is also a scalar in this sense, given by the formula, independent of the coordinate system.
Example:
• Mechanical work
Mechanical work
In physics, work is a scalar quantity that can be described as the product of a force times the distance through which it acts, and it is called the work of the force. Only the component of a force in the direction of the movement of its point of application does work...

is the dot product of force
Force
In physics, a force is any influence that causes an object to undergo a change in speed, a change in direction, or a change in shape. In other words, a force is that which can cause an object with mass to change its velocity , i.e., to accelerate, or which can cause a flexible object to deform...

and displacement
Displacement (vector)
A displacement is the shortest distance from the initial to the final position of a point P. Thus, it is the length of an imaginary straight path, typically distinct from the path actually travelled by P...

vectors.
• Magnetic flux
Magnetic flux
Magnetic flux , is a measure of the amount of magnetic B field passing through a given surface . The SI unit of magnetic flux is the weber...

is the dot product of the magnetic field
Magnetic field
A magnetic field is a mathematical description of the magnetic influence of electric currents and magnetic materials. The magnetic field at any given point is specified by both a direction and a magnitude ; as such it is a vector field.Technically, a magnetic field is a pseudo vector;...

and the area vectors.

## Properties

The following properties hold if a, b, and c are real vectors and r is a scalar
Scalar (mathematics)
In linear algebra, real numbers are called scalars and relate to vectors in a vector space through the operation of scalar multiplication, in which a vector can be multiplied by a number to produce another vector....

.

The dot product is commutative:

The dot product is distributive over vector addition:

The dot product is bilinear:

When multiplied by a scalar value, dot product satisfies:
(these last two properties follow from the first two).

Two non-zero vectors a and b are orthogonal if and only if
If and only if
In logic and related fields such as mathematics and philosophy, if and only if is a biconditional logical connective between statements....

ab = 0.

Unlike multiplication of ordinary numbers, where if ab = ac, then b always equals c unless a is zero, the dot product does not obey the cancellation law:
If ab = ac and a0, then we can write: a • (bc) = 0 by the distributive law; the result above says this just means that a is perpendicular to (bc), which still allows (bc) ≠ 0, and therefore bc.

Provided that the basis is orthonormal, the dot product is invariant under isometric changes of the basis: rotations, reflections, and combinations, keeping the origin fixed. The above mentioned geometric interpretation relies on this property. In other words, for an orthonormal space with any number of dimensions, the dot product is invariant under a coordinate transformation based on an orthogonal matrix
Orthogonal matrix
In linear algebra, an orthogonal matrix , is a square matrix with real entries whose columns and rows are orthogonal unit vectors ....

. This corresponds to the following two conditions:
• The new basis is again orthonormal (i.e., it is orthonormal expressed in the old one).
• The new base vectors have the same length as the old ones (i.e., unit length in terms of the old basis).

If a and b are functions, then the derivative of ab is a' • b + ab'

## Triple product expansion

This is a very useful identity (also known as Lagrange's formula) involving the dot- and cross-products
Cross product
In mathematics, the cross product, vector product, or Gibbs vector product is a binary operation on two vectors in three-dimensional space. It results in a vector which is perpendicular to both of the vectors being multiplied and normal to the plane containing them...

. It is written as

which is easier to remember
Mnemonic
A mnemonic , or mnemonic device, is any learning technique that aids memory. To improve long term memory, mnemonic systems are used to make memorization easier. Commonly encountered mnemonics are often verbal, such as a very short poem or a special word used to help a person remember something,...

as "BAC minus CAB", keeping in mind which vectors are dotted together. This formula is commonly used to simplify vector calculations in physics
Physics
Physics is a natural science that involves the study of matter and its motion through spacetime, along with related concepts such as energy and force. More broadly, it is the general analysis of nature, conducted in order to understand how the universe behaves.Physics is one of the oldest academic...

.

## Proof of the geometric interpretation

Consider the element of Rn
Repeated application of the Pythagorean theorem
Pythagorean theorem
In mathematics, the Pythagorean theorem or Pythagoras' theorem is a relation in Euclidean geometry among the three sides of a right triangle...

yields for its length |v|
But this is the same as
so we conclude that taking the dot product of a vector v with itself yields the squared length of the vector.
Lemma
Lemma (mathematics)
In mathematics, a lemma is a proven proposition which is used as a stepping stone to a larger result rather than as a statement in-and-of itself...

1
:

Now consider two vectors a and b extending from the origin, separated by an angle θ. A third vector c may be defined as
creating a triangle with sides a, b, and c. According to the law of cosines
Law of cosines
In trigonometry, the law of cosines relates the lengths of the sides of a plane triangle to the cosine of one of its angles. Using notation as in Fig...

, we have
Substituting dot products for the squared lengths according to Lemma 1, we get                   (1)
But as cab, we also have,
which, according to the distributive law, expands to                     (2)
Merging the two cc equations, (1) and (2), we obtain
Subtracting aa + bb from both sides and dividing by −2 leaves
Q.E.D.
Q.E.D.
Q.E.D. is an initialism of the Latin phrase , which translates as "which was to be demonstrated". The phrase is traditionally placed in its abbreviated form at the end of a mathematical proof or philosophical argument when what was specified in the enunciation — and in the setting-out —...

## Generalization

The inner product
Inner product space
In mathematics, an inner product space is a vector space with an additional structure called an inner product. This additional structure associates each pair of vectors in the space with a scalar quantity known as the inner product of the vectors...

generalizes the dot product to abstract vector spaces
Vector space
A vector space is a mathematical structure formed by a collection of vectors: objects that may be added together and multiplied by numbers, called scalars in this context. Scalars are often taken to be real numbers, but one may also consider vector spaces with scalar multiplication by complex...

and is usually denoted by . Due to the geometric interpretation of the dot product the norm
Norm (mathematics)
In linear algebra, functional analysis and related areas of mathematics, a norm is a function that assigns a strictly positive length or size to all vectors in a vector space, other than the zero vector...

||a|| of a vector a in such an inner product space
Inner product space
In mathematics, an inner product space is a vector space with an additional structure called an inner product. This additional structure associates each pair of vectors in the space with a scalar quantity known as the inner product of the vectors...

is defined as

such that it generalizes length, and the angle θ between two vectors a and b by

In particular, two vectors are considered orthogonal if their inner product is zero

For vectors with complex entries, using the given definition of the dot product would lead to quite different geometric properties. For instance the dot product of a vector with itself can be an arbitrary complex number, and can be zero without the vector being the zero vector; this in turn would have severe consequences for notions like length and angle. Many geometric properties can be salvaged, at the cost of giving up the symmetric and bilinear properties of the scalar product, by alternatively defining
where bi is the complex conjugate
Complex conjugate
In mathematics, complex conjugates are a pair of complex numbers, both having the same real part, but with imaginary parts of equal magnitude and opposite signs...

of bi. Then the scalar product of any vector with itself is a non-negative real number, and it is nonzero except for the zero vector. However this scalar product is not linear in b (but rather conjugate linear), and the scalar product is not symmetric either, since
This type of scalar product is nevertheless quite useful, and leads to the notions of Hermitian form and of general inner product space
Inner product space
In mathematics, an inner product space is a vector space with an additional structure called an inner product. This additional structure associates each pair of vectors in the space with a scalar quantity known as the inner product of the vectors...

s.

The Frobenius inner product generalizes the dot product to matrices. It is defined as the sum of the products of the corresponding components of two matrices having the same size.

### Generalization to tensors

The dot product between a tensor
Tensor
Tensors are geometric objects that describe linear relations between vectors, scalars, and other tensors. Elementary examples include the dot product, the cross product, and linear maps. Vectors and scalars themselves are also tensors. A tensor can be represented as a multi-dimensional array of...

of order n and a tensor of order m is a tensor of order n+m-2. The dot product is calculated by multiplying and summing across a single index in both tensors. If and are two tensors with element representation and the elements of the dot product are given by

This definition naturally reduces to the standard vector dot product when applied to vectors, and matrix multiplication when applied to matrices.

Occasionally, a double dot product is used to represent multiplying and summing across two indices. The double dot product between two 2nd order tensors is a scalar quantity.
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}