The idea
Key formulas
Component definition
Loading lessons…
Just a moment, getting everything ready. The first load can take up to a minute.
Linear algebra
Vectors encode size and direction; the dot product compares how strongly two vectors point together.
A vector is a quantity with both a size and a direction. Draw it as an arrow: its length represents its magnitude, and the way it points represents its direction. Moving an arrow without turning or stretching it does not change the vector. This is why vectors can be added tip-to-tail, even when we draw them at different places. In coordinates, an -dimensional vector is an ordered list such as . Its coordinates are its components along the chosen coordinate directions.
Vector addition combines corresponding components:
Geometrically, put the tail of at the head of ; the arrow from the original tail to the final head is . Reversing the order gives the same diagonal, so . Scaling by a number changes every component: . If is larger than one, the arrow gets longer; if , it gets shorter; and a negative also reverses its direction.
For a concrete addition, . The first vector moves two units right and one up; the second then moves one left and three up, for the same final displacement . Multiplying by gives : both coordinates change sign, so the arrow points the other way and is twice as long. These operations work component by component in any dimension, even though only two or three dimensions are easy to sketch.
The length, or norm, of a vector follows from the Pythagorean theorem:
For example, has length . The zero vector has length zero and no direction. A unit vector has length one.
Length is nonnegative, and changing an arrow's direction without changing its size leaves its norm unchanged. Scaling by multiplies the length by : . These facts make length a useful check on vector calculations. For instance, scaling by gives , whose length is , not .
For vectors with the same number of components, the dot product is the sum of the products of matching components:
The result is a single number, not a vector. This is the algebraic definition, and it is convenient when coordinates are known. The geometric definition describes the same number using the lengths and the angle between the arrows:
The first formula counts component-by-component agreement; the second says that agreement depends on both lengths and relative direction. These definitions are not two unrelated rules. To see why they agree, expand the squared length of the difference using the component formula:
The cosine rule for the triangle formed by , , and gives the same left side as . Equating the two expressions and rearranging gives . Thus the component products encode the same geometry as the angle.
This argument also explains why the angle formula is special to the Euclidean dot product: its component rule is compatible with the usual Pythagorean lengths and cosine rule. The two descriptions are useful in different situations. Compute with components when coordinates are known; reason with lengths and angles when direction is the focus. In both cases the answer is the same scalar.
The dot product can measure how much of one vector lies along another. If is a nonzero direction vector, the signed scalar component of along is
Dividing by removes the scale of the direction vector. Multiplying this scalar component by the unit direction gives the vector projection:
The projection is the shadow of on the line through . The remaining vector, , is perpendicular to . If is negative, the signed component is negative and the projection points opposite to . The zero vector cannot be used as the direction because its length is zero.
The scalar component and vector projection answer subtly different questions. The scalar is a signed distance along the chosen unit direction; the vector is an actual arrow with both direction and magnitude. Replacing by does not change the projection vector, because the direction line is the same and the extra factor cancels between numerator and denominator. The formula depends on the line, not on the arbitrary length chosen for its direction arrow.
For two nonzero vectors, rearrange the geometric formula to find their angle:
The cosine—and therefore the dot product's sign—tells whether the angle is acute, right, or obtuse:
The dot product is zero whenever either vector is zero as well, so zero alone does not prove perpendicularity unless both vectors are nonzero. The angle formula also explains why changes when either vector is rescaled: it includes both lengths, not only direction.
For real vectors of the same dimension, the dot product is symmetric and linear in each argument:
It is positive on a nonzero vector dotted with itself: , with equality only for . It also obeys the Cauchy–Schwarz bound , which is why the value inside the inverse cosine stays between and .
Orthogonal is the vector-language word for perpendicular. For nonzero vectors, is a quick algebraic test for orthogonality; no angle needs to be measured. Orthogonal vectors are useful when separating a quantity into independent directions—for example, a projection onto a line plus a perpendicular residual.
The dot product is also a way to check decompositions. If , with along a direction and perpendicular to it, then the two pieces do not contribute to each other's dot product: . The length-squared identity becomes , a Pythagorean theorem for perpendicular vector components.