Mathematics · Article
Vectors, dot products and geometry
Distinguish points from displacements, calculate Euclidean lengths and alignment, and prove the geometry of signed projections and nearest points. Connect exact components to honest equal-scale diagrams, with optional Cauchy–Schwarz and oriented cross-product area.
Back to MathematicsAfter reading, you can
- Represent the same displacement at different points and use component operations.
- Calculate Euclidean norms, dot products and angles with their unit and zero-vector conditions.
- Distinguish a signed scalar component from a projected vector and its nonnegative length.
- Find and justify the nearest point on a line using an orthogonal residual.
- Explain Cauchy–Schwarz, the triangle inequality and their equality conditions.
- Use a three-dimensional cross product for orthogonality and oriented area without a determinant prerequisite.
A location tells you where; a vector tells you a change
A move from P=(1,−2) to Q=(4,2) changes the horizontal coordinate by 3 and the vertical coordinate by 4. Its displacement is the vector v=(3,4). The same displacement takes A=(−3,1) to B=(0,5). The two arrows have different starting points but the same components, length and direction.
A point identifies a location relative to a chosen origin. A displacement compares two locations: the vector from P to Q is Q−P. Adding a displacement to a point gives another point. A free vector can be represented by any translated arrow with the same length and direction; its tail need not be the origin.
Preparation: coordinate arithmetic, equations and the Pythagorean theorem. Use trigonometry for the angle interpretation. Calculus and the preceding Taylor article are not prerequisites. First read through the line-projection example; the inequality proofs and three-dimensional cross product are optional deeper sections.
| Quantity | Exact value |
|---|---|
| Tail P | (1, -2) |
| Head Q | (4, 2) |
| Displacement | (3, 4) |
| Squared Euclidean length | 25 |
Add changes component by component
A real vector in Rⁿ is an ordered list (v₁,…,vₙ) of n real components. The order and number of components matter. Two vectors are equal when corresponding components agree. In Cartesian coordinates, the plane uses two components and ordinary three-dimensional space uses three.
Define u+v=(u₁+v₁,…,uₙ+vₙ) and λu=(λu₁,…,λuₙ), where λ is a real scalar. Geometrically, place the tail of v at the head of u; the resulting displacement is u+v. For u=(4,1) and v=(2,−1), the sum is (6,0), the difference u−v is (2,2), and 2u−v=(6,3).
A positive scalar preserves a nonzero vector’s direction, a negative scalar reverses it, and the length is multiplied by |λ|. Multiplication by zero gives the zero vector (0,…,0), which has no direction. The zero vector is the additive identity, and −u is the additive inverse of u.
The familiar rules follow from real-number arithmetic: addition is associative and commutative, and scaling distributes over vector addition and scalar addition. A combination αu+βv means scaling two vectors and then adding. These operations require matching dimensions; adding a two-component vector to a three-component vector is undefined here.
| Quantity | Exact value |
|---|---|
| Vector u | (4, 1) |
| Direction v | (2, -1) |
| Coefficient α | 1 |
| Coefficient β | 1 |
| First scaled vector | (4, 1) |
| Second scaled vector | (2, -1) |
| Resulting vector | (6, 0) |
| Squared Euclidean length | 36 |
A sum of squares measures Euclidean length
For a Cartesian vector v=(v₁,…,vₙ), its Euclidean norm is ‖v‖=√(v₁²+⋯+vₙ²). In the plane this is the Pythagorean theorem. In three dimensions apply that theorem first to two components, then to the third. The distance between points P and Q is ‖Q−P‖.
The norm is nonnegative and equals zero exactly when every component is zero. Also ‖λv‖=|λ|‖v‖. A nonzero vector has a unit vector in its direction, v/‖v‖; division by the norm makes its length one. For v=(3,4), the norm is 5 and the corresponding unit vector is (3/5,4/5).
The geometric formulas assume perpendicular Cartesian axes with compatible units and the same unit scale. If coordinates are metres, vector lengths are in metres and squared lengths are in square metres. Mixing a temperature with a distance in an unweighted sum of squares does not create a physical length. A data vector can use a chosen scaling or metric, but that choice supplies additional modelling information.
Multiply corresponding components, then add
The Euclidean dot product is u·v=u₁v₁+⋯+uₙvₙ. Its result is a scalar. It differs from both vector addition and a list of componentwise products. With u=(4,1) and v=(2,−1), u·v=4×2+1×(−1)=7.
The dot product is symmetric, u·v=v·u, and linear in each argument: (αu+βv)·w=α(u·w)+β(v·w). In particular u·u=‖u‖². For real vectors, u·u=0 forces u=0. These facts follow by expanding the component sums.
Expanding the squared length of a difference gives ‖u−v‖²=‖u‖²+‖v‖²−2u·v. The corresponding sum identity has +2u·v. The cross term records how the vectors align; lengths alone do not determine the length of their sum.
Two vectors are called orthogonal when u·v=0. For nonzero geometric vectors, this means perpendicular directions. Algebraically the zero vector is orthogonal to every vector, although it does not define an angle or a perpendicular direction. Dot products are not associative chains: u·v is a scalar, so (u·v)·w is not another vector dot product.
Optional: a nonnegative square proves Cauchy–Schwarz
For v≠0 and any real t, the squared norm ‖u−tv‖²=‖u‖²−2t(u·v)+t²‖v‖² is nonnegative. Substitute t=(u·v)/‖v‖². This gives 0≤‖u‖²−(u·v)²/‖v‖². Multiplying by the positive denominator and taking square roots proves |u·v|≤‖u‖‖v‖, the Cauchy–Schwarz inequality.
If v=0, both sides of the inequality are zero directly. With v≠0, equality holds exactly when u−tv=0 at the stated t, so u is a scalar multiple of v. Thus equality occurs precisely when the two vectors are linearly dependent, including a zero-vector case.
Now ‖u+v‖²=‖u‖²+2u·v+‖v‖²≤(‖u‖+‖v‖)². Taking nonnegative square roots gives the triangle inequality ‖u+v‖≤‖u‖+‖v‖. Geometrically, the direct displacement is no longer than following the two changes in sequence. Cancellation explains why the inequality can be strict.
Equality in the triangle inequality requires u·v=‖u‖‖v‖. If both vectors are nonzero, Cauchy–Schwarz equality and the positive sign say that they are positive scalar multiples, pointing in the same direction. If either is zero, equality holds directly. Oppositely directed nonzero vectors give Cauchy–Schwarz equality but do not give triangle-inequality equality.
The dot product measures alignment
Let u and v be nonzero geometric vectors with their tails together and angle θ between 0 and π radians. The cosine rule for the triangle with sides u, v and u−v gives ‖u−v‖²=‖u‖²+‖v‖²−2‖u‖‖v‖cosθ. Comparing with the expanded difference identity yields u·v=‖u‖‖v‖cosθ. For parallel vectors the formula holds directly: positive scalar multiples have angle 0 and negative scalar multiples have angle π.
Consequently cosθ=(u·v)/(‖u‖‖v‖). Cauchy–Schwarz guarantees that this ratio lies in [−1,1]; the same formula defines an angle between nonzero Euclidean vectors in higher dimensions. A positive dot product gives an angle smaller than π/2, including 0 for the same direction. Zero gives a right angle. A negative dot product gives an angle larger than π/2, including π for opposite directions.
For u=(4,1) and v=(2,−1), cosθ=7/√85. Reversing u changes the cosine to −7/√85. For w=(1,2), w·v=0, so their angle is π/2. If either vector is zero, the dot product is still defined but the angle formula divides by zero and must not be used.
Separate the signed component from the projected vector
Choose a nonzero direction v and its unit vector e=v/‖v‖. The scalar component of u along that oriented direction is c=u·e=(u·v)/‖v‖. It is signed: a negative value means the projection points opposite to the chosen direction. The length of the projection is |c|, not c when c is negative.
The vector projection is p=ce=[(u·v)/(v·v)]v. Its coefficient t=(u·v)/(v·v) multiplies the original direction vector. The coefficient t and the scalar component c are different quantities unless v is a unit vector. The projection is onto the entire line through v; it can lie beyond the drawn arrow tip or on the opposite side of the origin.
For u=(4,1) and v=(2,−1), v·v=5, t=7/5 and p=(14/5,−7/5). The signed scalar component is 7/√5 and the projection length is also 7/√5 in this positive case. The residual is r=u−p=(6/5,12/5). Its dot product with v is 12/5−12/5=0.
| Quantity | Exact value |
|---|---|
| Vector u | (4, 1) |
| Direction v | (2, -1) |
| Dot product u·v | 7 |
| Projection coefficient t | 7/5 |
| Signed scalar component | 7/√5 |
| Vector projection p | (14/5, -7/5) |
| Residual r=u−p | (6/5, 12/5) |
| Orthogonality check r·v | 0 |
| Squared projection length | 49/5 |
| Squared residual length | 36/5 |
| Angle cosine | 7/√85 |
The perpendicular foot is the unique closest point on a line
Write u=p+r, where p=tv is the projection and r·v=0. A different point on the line has vector λv. Then u−λv=r+(t−λ)v. Expanding its squared norm removes the cross term and gives ‖u−λv‖²=‖r‖²+(t−λ)²‖v‖².
The second term is nonnegative and, because v≠0, vanishes exactly when λ=t. This proves that p is the unique nearest point on the line and that the distance to the line is ‖r‖. The conclusion follows from the identity, rather than from the apparent right angle in a drawing.
In the running example, ‖u‖²=17, ‖p‖²=49/5 and ‖r‖²=36/5. Thus 17=49/5+36/5, and the distance from u to the line spanned by v is 6/√5. A point λv with λ=1 gives squared distance 8, larger than the minimum 36/5.
For an affine line through a point A, first form u=P−A and project this displacement onto its nonzero direction v. The nearest point is A+p. Projection onto a ray or a finite segment is a different constrained problem: if the unrestricted coefficient lies outside the permitted range, the nearest allowed endpoint must be considered.
| Quantity | Exact value |
|---|---|
| Line coefficient λ | 7/5 |
| Point λv | (14/5, -7/5) |
| Squared distance ‖u−λv‖² | 36/5 |
| Minimum squared distance | 36/5 |
| Coefficient at the minimum | 7/5 |
| Excess 5(λ−7/5)² | 0 |
Reversing the direction leaves the line projection unchanged
Replace v by w=αv with α≠0. The projection coefficient becomes (u·w)/(w·w)=(u·v)/(α‖v‖²). Multiplication by w cancels α, so the projected vector p is unchanged. A line does not depend on which nonzero vector represents its direction.
The signed scalar component depends on orientation: reversing v reverses e and therefore c. Its absolute value and the projected vector stay the same. Replacing v by zero is excluded; the zero vector does not provide a line direction or a unit vector.
If u is already on the line, its residual is zero and its projection is u. If u is orthogonal to a nonzero direction, its projection is zero. If u=0 and v≠0, the projection and residual are both zero even though an angle between u and v is undefined.
Optional: a normal vector and an oriented area in three dimensions
In oriented, orthonormal Cartesian coordinates in R³, define u×v=(u₂v₃−u₃v₂, u₃v₁−u₁v₃, u₁v₂−u₂v₁). This cross product is a vector. Substitution into u·(u×v) and v·(u×v) makes all terms cancel, so it is orthogonal to both inputs. Swapping the inputs negates it. The coordinate convention is the usual right-handed orientation.
Expanding its squared norm gives ‖u×v‖²=Σᵢ₌₁³uᵢ² Σⱼ₌₁³vⱼ²−(Σᵢ₌₁³uᵢvᵢ)². For nonzero inputs this equals ‖u‖²‖v‖²sin²θ. Since 0≤θ≤π, taking nonnegative square roots gives ‖u×v‖=‖u‖‖v‖sinθ. This is the parallelogram’s base times perpendicular height; its triangle has half that area. A zero input or parallel inputs give zero area directly.
For two-dimensional vectors u=(4,1) and v=(2,−1), embed them as (4,1,0) and (2,−1,0). Their cross product is (0,0,−6). The signed planar area is 4×(−1)−1×2=−6, and the parallelogram’s nonnegative area is 6. Reversing their order changes the signed area to 6 while leaving its magnitude unchanged.
A planar drawing can show the signed area and traversal order; it cannot display a three-dimensional normal with an honest two-axis Euclidean scale. The three-dimensional component formula does not require determinants here. Determinants and more general multilinear constructions are developed in later articles; do not extend this particular formula to arbitrary component counts.
| Quantity | Exact value |
|---|---|
| Vector u | (4, 1) |
| Direction v | (2, -1) |
| Resulting vector | (6, 0) |
| Signed planar area | -6 |
| Parallelogram area | 6 |
| Embedded cross product | (0, 0, -6) |
The mathematics needs a model of the quantities
Displacements, velocities and forces can be represented by geometric vectors once coordinates and units are chosen. Addition can combine displacements or compatible quantities of the same kind. For a constant force F and a straight displacement d, the mechanical work is F·d: the component along the displacement multiplied by its length. Force in newtons and displacement in metres give work in joules. A varying force requires accounting for its changes along the path rather than applying one unchanged force vector to the whole displacement.
A feature list used in computing is also a vector mathematically, yet its Euclidean length and angles depend on how features are scaled. Changing metres to centimetres in only one coordinate changes an unadjusted dot product. A meaningful comparison must explain its coordinate choices, units and metric.
These examples connect geometric algebra to physics, computing and engineering. Later articles develop vector spaces, coordinate changes and projections onto larger subspaces. Here the setting is a real Euclidean coordinate space and projection onto one nonzero line direction; those stated conditions make the calculations interpretable.
Predict the geometry, then check exact components
Before adding vectors, predict where the endpoint should move. Before projecting, predict the sign of the scalar component and which side of the origin contains the foot. Compare the result with the exact component table and verify r·v=0 and ‖u‖²=‖p‖²+‖r‖².
Use a zero displacement to separate a well-defined algebraic zero from an undefined direction or angle. Reverse a direction vector to test which quantities depend on orientation. For an area comparison, exchange the two input vectors and predict the sign change before revealing it.
A picture supports the reasoning when its axes use the same scale and its labels identify points, vectors and projected values. Exact arithmetic supplies the checks; the nearest-point identity and component proofs establish the general conclusions beyond the plotted examples.
Predict the change, sign or nearest point
Choose a comparison and a listed case. Predict the endpoint, sign, perpendicular foot or squared-distance minimum before revealing the diagram and exact data.
Make a prediction before revealing the diagram.
These are exact finite component calculations in a real Euclidean coordinate model. The article supplies the general proofs and distinguishes coordinates, units, lines and constrained segments.
Worked examples
The same change at two locations
Find the displacements from (1,−2) to (4,2) and from (−3,1) to (0,5). Compare their lengths.
- Subtract tail coordinates from head coordinates: (4−1,2−(−2))=(3,4).
- The second difference is (0−(−3),5−1)=(3,4).
- Both have length √(3²+4²)=5; their locations differ but their free vectors agree.
Both displacements are (3,4), with length 5.
Combine two displacements
For u=(4,1) and v=(2,−1), calculate 2u−v and its length.
- Scale first: 2u=(8,2).
- Subtract v componentwise: (8−2,2−(−1))=(6,3).
- Its squared length is 6²+3²=45, so its length is 3√5.
2u−v=(6,3), with length 3√5.
An exact perpendicular foot
Project u=(4,1) onto the line in direction v=(2,−1), and find the distance to that line.
- Compute u·v=7 and v·v=5, so the coefficient is t=7/5.
- The projection is p=(7/5)(2,−1)=(14/5,−7/5).
- Subtract: r=(4,1)−p=(6/5,12/5). Check r·v=12/5−12/5=0.
- The squared distance is 36/25+144/25=36/5; its square root is 6/√5.
The nearest point has vector (14/5,−7/5), and the distance is 6/√5.
A line need not pass through the origin
Find the nearest point to P=(5,3) on the line A+λv with A=(1,2) and v=(2,−1).
- Use the displacement u=P−A=(4,1), not the position vector P.
- Its projection onto v is (14/5,−7/5).
- Translate back: A+p=(1+14/5,2−7/5)=(19/5,3/5).
- P−(A+p)=(6/5,12/5), orthogonal to v, so the nearest-point identity applies.
The unique nearest point is (19/5,3/5).
An oriented three-dimensional product
For u=(2,1,0) and v=(1,−1,2), find their cross product and parallelogram area.
- Apply the component formula: u×v=(1×2−0×(−1),0×1−2×2,2×(−1)−1×1)=(2,−4,−3).
- Check orthogonality: u·(u×v)=4−4=0 and v·(u×v)=2+4−6=0.
- The squared norm is 4+16+9=29. Independently ‖u‖²‖v‖²−(u·v)²=5×6−1²=29.
u×v=(2,−4,−3); the parallelogram area is √29 and the triangle area is √29/2.
Try it yourself
What vector takes P=(−2,3) to Q=(1,−1)?
Show the answer and reasoning
(3,−4).
Subtract tail from head: (1−(−2),−1−3). Its length is 5.
With u=(4,1), v=(2,−1), find u−2v.
Show the answer and reasoning
(0,3).
Compute (4−4,1−(−2)). A scalar coefficient acts on every component.
Find a unit vector in the direction (−3,4).
Show the answer and reasoning
(−3/5,4/5).
The norm is 5. Dividing both components by that positive norm preserves direction.
Are (1,2) and (2,−1) perpendicular?
Show the answer and reasoning
Yes: their dot product is zero and both are nonzero.
1×2+2×(−1)=0. The nonzero condition makes the angle interpretation valid.
What is 0·v, and what is the angle between 0 and a nonzero v?
Show the answer and reasoning
The dot product is 0; the angle is undefined.
The zero vector is algebraically orthogonal to v, but has no unit direction; the angle formula divides by its zero norm.
Project u=(−4,−1) onto v=(2,−1). Give the signed scalar component.
Show the answer and reasoning
p=(−14/5,7/5); c=−7/√5.
u·v=−7 and v·v=5. The projection length is 7/√5, whereas the oriented component is negative.
Does replacing a nonzero direction v by −3v change the vector projection onto its line?
Show the answer and reasoning
No.
The coefficient gains a factor −1/3, which cancels the −3 in the direction vector. The signed component reverses sign.
For u=(4,1), v=(2,−1), what is ‖u−λv‖² in a form that identifies the minimum?
Show the answer and reasoning
36/5+5(λ−7/5)².
Use the orthogonal residual and t=7/5. The nonnegative square vanishes only at λ=7/5.
For P=(4,1), what is its nearest point on the segment λ(2,−1), 0≤λ≤1?
Show the answer and reasoning
(2,−1).
The unrestricted coefficient 7/5 lies beyond 1. On [0,1], the square (λ−7/5)² is smallest at the permitted endpoint λ=1.
When does |u·v|=‖u‖‖v‖ hold for real Euclidean vectors?
Show the answer and reasoning
Exactly when the vectors are linearly dependent, including a zero input.
For v≠0, equality forces u−[(u·v)/‖v‖²]v=0. If v=0, both sides are zero.
What are the signed area and parallelogram area for ordered planar vectors (4,1),(2,−1)?
Show the answer and reasoning
Signed area −6; nonnegative area 6.
Compute 4×(−1)−1×2. Swapping their order reverses the sign but preserves the magnitude.
Can the unweighted Euclidean norm of a tuple (distance in metres, temperature in degrees) automatically be interpreted as a physical length?
Show the answer and reasoning
No.
Unlike compatible Cartesian distance components, these quantities have different kinds and units. A chosen scaling or metric would require an explicit model.
What to carry forward
- Points describe locations; displacements compare locations and can be translated as free arrows.
- Vector addition and scalar multiplication operate componentwise in a fixed dimension.
- The Euclidean norm and dot product require a meaningful coordinate scale and metric.
- Zero vectors have defined dot products but no direction, unit vector or angle.
- A scalar projection is signed; its magnitude is a length, and its vector form lies on a whole line.
- An orthogonal residual gives an exact squared-distance identity and the unique nearest line point.
- Reversing a direction changes its oriented scalar component but preserves its line projection.
- In oriented R³, a cross product is orthogonal to both inputs and its norm gives parallelogram area; a nonzero normal direction requires nonparallel inputs.
References
Sources for the concepts and teaching approaches in this article.
- Calculus Volume 3 · Current online editionGilbert Strang and Edwin “Jed” Herman (senior contributing authors)Open calculus textbookVectors in the plane — §2.1Dot product, projections and work — §2.3Cross product and area — §2.4
- Interactive Linear Algebra · Current online editionDan Margalit and Joseph RabinoffOpen linear algebra textbookVectors and component operations — §2.1Dot products and orthogonality — §6.1PDF companion