You walked two legs of a route. Path length is the sum of their lengths, but the finish may be much closer to the start. What notation keeps both the size and direction of each step?
A vector describes a directed change of position. Add vectors component by component; the magnitude of their sum is start-to-finish distance rather than the length of the broken path. The dot product returns a number relating lengths to an angle. We use coordinates and sine and cosine.
A point, an arrow and a length
Point A(x;y) is a position. Directed segment AB represents the vector from A to B. Call this vector u. Its components are “end minus start”:
u = (x_(B) − x_(A); y_(B) − y_(A)).
We consider free vectors: arrows with the same length and direction are equal even if their starting points differ. Translate them parallel to themselves without rotation. Equal length alone does not make vectors equal. OpenStax, definitions and components.
For u=(uₓ;uᵧ), magnitude |u|=√(uₓ²+uᵧ²) is a nonnegative number rather than a vector. The zero vector 0=(0;0) has magnitude 0 and no defined direction. For example, points (1;2) and (5;3) give vector (4;1); √17 is its length.
Two displacements: why a parallelogram works
Our example, in metres: u=(4;1),v=(−1;3). The first step goes 4 right and 1 up; the second goes 1 left and 3 up. The result is:
u + v = (4 − 1; 1 + 3) = (3;4), ∣u + v∣ = 5.
The triangle rule places the tail of v at the head of u. The sum runs from the first tail to the second head. Place both vectors at a common origin instead: for noncollinear vectors, the diagonal of the resulting parallelogram gives the same sum. Reordering addition preserves the result: u+v=v+u.
Sum: triangle and parallelogram
Difference from v’s head to u’s head
Projection of b onto a
The path length is √17+√10≈7.285 m, while displacement magnitude is 5 m. Different questions produce different numbers without contradiction. The triangle rule also works for collinear steps, although the parallelogram degenerates.
Subtraction and multiplication by a number
Subtracting v means adding its opposite −v: u−v=(4−(−1);1−3)=(5;−2). With a shared origin, the arrow from the head of v to the head of u represents u−v. Reversing it gives v−u.
For a number λ, λu=(λuₓ;λuᵧ) and |λu|=|λ|·|u|. For λ>0 a nonzero vector keeps its direction; for λ<0 it reverses. For λ=0 we obtain the zero vector, so direction disappears. In particular, −2u=(−8;−2), twice as long as u and pointing the opposite way.
Two nonzero vectors are collinear if one is a scalar multiple of the other, such as (4;1) and (−8;−2). A check avoiding division by a possible zero is uₓvᵧ−uᵧvₓ=0. By convention, the zero vector is collinear with every vector; that does not give it a direction.
Dot product: a number instead of an arrow
In orthonormal coordinates, define:
u ⋅ v = u_(x)v_(x) + u_(y)v_(y) = ∣u∣ ∣v∣cosφ.
The final equality connects components with angle φ between nonzero vectors, from 0° to 180°. Our pair gives u·v=4·(−1)+1·3=−1. Thus cosφ=−1/√170,φ≈94.40°: slightly obtuse. A positive product means 0°≤φ<90°; a negative one means 90°<φ≤180°. For nonzero vectors, a zero product means perpendicularity.
The product u·u=|u|² is nonnegative, while u·v can be negative. “Scalar” matters: this is a number, unlike λu or u+v. Paul Dawkins, dot product.
Projection: how much points along a
Take a different pair a=(4;0),b=(2;3). Drop a perpendicular from b’s head to the line along a. The signed scalar projection of b along a is b·a/|a|=8/4=2. The vector projection is (b·a/|a|²)a=(2;0). One is a number and the other a vector.
For a≠0 these formulas also work at an obtuse angle: scalar projection is negative and vector projection points opposite a. At a right angle both projections are zero. Projection onto the zero vector is undefined: the denominator is 0 and there is no direction.
A link to earlier geometryOptional · safe to skip
Why cosine appears in the dot product
Place u,v at a common origin. The cosine law gives |u−v|²=|u|²+|v|²−2|u||v|cosφ. Expanding the same left side in coordinates gives |u|²+|v|²−2(uₓvₓ+uᵧvᵧ). Comparing gives the required equality. For collinear nonzero vectors the same identity follows directly at φ=0° or 180°. For a zero vector, the component product still exists and equals 0, but we do not define an angle.
Before calculating, name the object: point, displacement, length or projection. The type of answer, a component pair or a single number, then becomes part of the check.