Where does the ferry really go?
A ferry crosses the Jamuna river in Bangladesh. Its engine drives it straight across at km/h relative to the water, but the river flows downstream at km/h. Where does the ferry actually go, and how fast? The two motions combine: each hour the ferry moves km across and km downstream. Its actual velocity is an arrow of length km/h, pointing diagonally. To land at the jetty directly opposite, the pilot must aim upstream.
Quantities like velocity, force and displacement have a size and a direction. We call them vectors. They can be added (the ferry's velocity plus the river's) and scaled (twice as fast, or backwards). Once vectors are written in coordinates, a single operation — the dot product — gives lengths, angles, right angles and projections, and lets us prove geometric theorems with a few lines of algebra. The same ideas then work, unchanged, in three dimensions and in a thousand.
Arrows that can move
Picture a vector as an arrow. What matters is its length and its direction, not where it starts: sliding an arrow without turning or stretching it gives the same vector. The displacement "3 km east, 4 km north" is the same whether you start in Dhaka or in Lima.
- To add two vectors, place the tail of the second at the tip of the first; the sum goes from the first tail to the second tip ("tip to tail"). Doing it in the other order gives the other two sides of a parallelogram, with the same diagonal: .
- To scale a vector by a number , stretch it by the factor , and reverse it if .
Put the tail at the origin of a coordinate system, and the tip has coordinates: the vector "3 east, 4 north" becomes . Now the geometry becomes arithmetic: adding arrows is adding coordinates, and stretching arrows is multiplying coordinates.
Definitions
Definition— vector
A vector in the plane is an ordered pair of real numbers; a vector in space is a triple ; in general a vector in is a list of real numbers, its components. The vector from point to point is , computed component by component.
Definition— addition and scalar multiplication
For vectors in and a real number (a scalar):
The zero vector is , and . Two vectors are parallel if one is a scalar multiple of the other.
Definition— dot product and length
The dot product of and in is the number
The length (or norm) of is . A unit vector has length ; for , the vector is the unit vector in the direction of .
In the plane, is the Pythagorean theorem; in space, comes from using Pythagoras twice. The distance between points and is .
Definition— angle and perpendicularity
For non-zero vectors , the angle between them, with , is given by
The vectors are perpendicular (orthogonal), , if .
In and we will prove that this angle is the angle you would measure between the arrows. In higher dimensions there is no picture to measure, and the formula becomes the definition; the Cauchy–Schwarz inequality below guarantees that the right-hand side lies between and , so the definition makes sense.
Definition— lines and planes
The line through the point with direction is the set , in or . Writing out components gives parametric equations, such as , .
The plane in through with normal vector is the set of points with . With this is the familiar equation . A plane can also be written in vector form, , with and non-parallel vectors lying in it.
Worked examples
Example— Arithmetic, lengths and unit vectors
Let and . Then , , and . The unit vector in the direction of is .
Example— An angle in space
For the same and : , so and . No protractor could measure this in space — but the dot product does it in one line.
Example— Perpendicular or not?
, so these vectors are perpendicular. In general, is perpendicular to : turning a vector by swaps its components and changes one sign. On the other hand : those diagonals of a cube are not perpendicular.
Example— Projection and work
A child pulls a sledge along level snow with a force newtons (horizontal and vertical parts). The sledge moves along the displacement metres. Only the part of the force along the motion does work: the work is joules. The projection of onto is
and the rest, , is perpendicular to : it lifts the sledge a little but does no work along the ground.
Example— A line through two points, and where it meets a plane
The line through and has direction , so it is . Where does it meet the plane ? Substitute: , so and the point is . In the plane , the line through with direction has normal and equation , that is, .
Example— A non-example: lengths do not add
and have , but . Walking km east and then km north leaves you only km from home. Lengths add only when the vectors point the same way.
The dot product: theorems
Directly from the definition, by expanding components, the dot product is symmetric, , and distributes over addition and scalars: and . Also , with equality only for . Everything below follows from these rules alone.
Theorem— Theorem (geometric meaning of the dot product)
For non-zero vectors in or that make the angle (measured between the arrows drawn from a common tail),
Proof
Draw and from a common point , ending at and . The third side of triangle is the vector . By the law of cosines (see trigonometry),
On the other hand, by the rules above, . Comparing the two expressions gives . (If and are parallel, the "triangle" is flat, and is or ; the same computation works directly.)
∎
Theorem— Corollary
Non-zero vectors and are perpendicular exactly when . Moreover, if and only if — Pythagoras' theorem and its converse in vector form.
Proof
exactly when . For the second statement, expand: .
∎
Theorem— Cauchy–Schwarz inequality
For all vectors in : . Equality holds exactly when and are parallel.
Proof
In and this follows from the last theorem, since . But in we want to define angles using Cauchy–Schwarz, so we need a proof that does not use angles.
If both sides are . Otherwise, for every real number ,
The right-hand side is a quadratic in with positive leading coefficient that is never negative, so it has at most one real root and its discriminant is at most zero (see quadratics):
Taking square roots gives the inequality. Equality means the discriminant is zero, so the quadratic has a root , and then , i.e. . Conversely, if both sides equal .
∎
In the plane there is an even more direct proof, Lagrange's identity:
which you can check by expanding. The gap is a perfect square, and it vanishes exactly when , i.e. when and are parallel.
Theorem— Triangle inequality
For all vectors in : , with equality exactly when one vector is a non-negative multiple of the other.
Proof
Using Cauchy–Schwarz in the middle step,
Both and are non-negative, so . Equality holds exactly when : by the equality case of Cauchy–Schwarz the vectors are parallel, and forces them to point the same way (or one to be zero).
∎
Theorem— Projection
For , every vector splits as with parallel to and perpendicular to .
Proof
.
∎
Geometry proved with vectors
Vectors give short proofs of classical theorems. The trick is to name the points by their position vectors (from a fixed origin) and to translate each geometric statement into an equation.
Theorem— The diagonals of a parallelogram bisect each other
If is a parallelogram, the midpoints of the diagonals and coincide.
Proof
" is a parallelogram" means that the sides and are the same vector: . Rearranging, . The midpoint of is and the midpoint of is , and these are equal.
∎
Theorem— The medians of a triangle meet at the centroid
The three medians of a triangle (each joining a vertex to the midpoint of the opposite side) pass through the point , which divides each median in the ratio .
Proof
The midpoint of is . The point two thirds of the way from to is
This expression does not change if we permute , , , so the same point is two thirds of the way along each median.
∎
Theorem— The diagonals of a rhombus are perpendicular
If is a parallelogram with all sides equal, its diagonals are perpendicular.
Proof
Let and , so the diagonals are and . Then , because .
∎
Compare these with the congruent-triangle proofs in Euclidean geometry and proof: the vector proofs are shorter, but they hide the geometry inside the algebra. The rhombus argument, read backwards, is also a proof of Thales' theorem: if then .
Note
Lines in space can be skew. In the plane, two distinct lines either meet in one point or are parallel. In space there is a third possibility: lines such as and are not parallel (their directions are and ) and never meet (the first has , the second ). Such lines are called skew.
Vectors in Lean
We start in coordinates. Here is the dot product of two vectors in the plane, Lagrange's identity, and the Cauchy–Schwarz inequality with its equality case, exactly as in the lesson:
/-- The dot product of two vectors in the plane, given by coordinates:
`(u₁, u₂) · (v₁, v₂) = u₁ v₁ + u₂ v₂`. -/
def dot2 (u v : ℝ × ℝ) : ℝ := u.1 * v.1 + u.2 * v.2/-- **Lagrange's identity** in the plane:
`(u · u)(v · v) − (u · v)² = (u₁ v₂ − u₂ v₁)²`. Both sides are polynomials in the four
coordinates, and `ring` checks that they are equal. -/
theorem lagrange_identity (u v : ℝ × ℝ) :
dot2 u u * dot2 v v - dot2 u v ^ 2 = (u.1 * v.2 - u.2 * v.1) ^ 2 := by
unfold dot2
ring/-- **Cauchy–Schwarz in coordinates**: `(u · v)² ≤ (u · u)(v · v)`, that is,
`|u · v| ≤ |u| |v|`. By Lagrange's identity the difference is a square, and squares are never
negative. -/
theorem cauchy_schwarz_2d (u v : ℝ × ℝ) : dot2 u v ^ 2 ≤ dot2 u u * dot2 v v := by
have h := lagrange_identity u v
nlinarith [sq_nonneg (u.1 * v.2 - u.2 * v.1)]/-- **Equality in Cauchy–Schwarz** happens exactly when `u₁ v₂ = u₂ v₁`, i.e. when `u` and `v`
are parallel (one is a multiple of the other, or one of them is zero). Again from Lagrange's
identity: the gap is `(u₁ v₂ − u₂ v₁)²`, which is zero exactly when `u₁ v₂ − u₂ v₁ = 0`. -/
theorem cauchy_schwarz_2d_eq (u v : ℝ × ℝ) :
dot2 u v ^ 2 = dot2 u u * dot2 v v ↔ u.1 * v.2 = u.2 * v.1 := by
have h := lagrange_identity u v
constructor
· intro heq
have hsq : (u.1 * v.2 - u.2 * v.1) ^ 2 = 0 := by linarith
have := pow_eq_zero_iff (n := 2) (by norm_num) |>.1 hsq
linarith
· intro hpar
have hsq : (u.1 * v.2 - u.2 * v.1) ^ 2 = 0 := by rw [hpar, sub_self]; ring
linarithThe vector equation and the normal equation of a line in the plane describe the same set of points:
/-- **Two equations for the same line.** The line through `p` with direction `d ≠ 0` is
`{p + t d : t ∈ ℝ}` (the vector, or parametric, equation). With the normal vector
`n = (−d₂, d₁)`, perpendicular to `d`, the same line is `{x : n · (x − p) = 0}` (the normal, or
Cartesian, equation). For the hard direction, if `n · (x − p) = 0` we take
`t = d · (x − p) / (d · d)` and check `x = p + t d` coordinate by coordinate. -/
theorem line_vector_iff_normal (p d x : ℝ × ℝ) (hd : d ≠ 0) :
(∃ t : ℝ, x = p + t • d) ↔ dot2 (-d.2, d.1) (x - p) = 0 := by
unfold dot2
constructor
· rintro ⟨t, rfl⟩
simp only [add_sub_cancel_left, Prod.smul_fst, Prod.smul_snd, smul_eq_mul]
ring
· intro h
have hdd : d.1 ^ 2 + d.2 ^ 2 ≠ 0 := by
intro h0
apply hd
have h1 : d.1 = 0 := by nlinarith [sq_nonneg d.1, sq_nonneg d.2]
have h2 : d.2 = 0 := by nlinarith [sq_nonneg d.1, sq_nonneg d.2]
exact Prod.ext h1 h2
refine ⟨(d.1 * (x.1 - p.1) + d.2 * (x.2 - p.2)) / (d.1 ^ 2 + d.2 ^ 2), ?_⟩
simp only [Prod.fst_sub, Prod.snd_sub] at h
ext
· simp only [Prod.fst_add, Prod.smul_fst, smul_eq_mul]
field_simp
linear_combination (-d.2) * h
· simp only [Prod.snd_add, Prod.smul_snd, smul_eq_mul]
field_simp
linear_combination d.1 * hMathlib's general setting is a real inner product space: any collection of vectors with addition, scaling and a dot product obeying the rules at the start of the proofs section. It covers , and at once, and also spaces of functions. Mathlib writes ⟪u, v⟫ for and ‖u‖ for . Cauchy–Schwarz is in the library, and the triangle inequality is proved here from it:
/-- **The Cauchy–Schwarz inequality** in any real inner product space: `|u · v| ≤ |u| |v|`.
Applies Mathlib's `abs_real_inner_le_norm`. -/
theorem cauchy_schwarz (u v : V) : |⟪u, v⟫| ≤ ‖u‖ * ‖v‖ := abs_real_inner_le_norm u v/-- **The triangle inequality** `|u + v| ≤ |u| + |v|`, from Cauchy–Schwarz:
`|u + v|² = |u|² + 2 u · v + |v|² ≤ |u|² + 2 |u| |v| + |v|² = (|u| + |v|)²`, and both
`|u + v|` and `|u| + |v|` are non-negative. -/
theorem triangle_inequality (u v : V) : ‖u + v‖ ≤ ‖u‖ + ‖v‖ := by
have hsq : ‖u + v‖ ^ 2 ≤ (‖u‖ + ‖v‖) ^ 2 := by
rw [norm_add_sq_real]
nlinarith [real_inner_le_norm u v]
nlinarith [norm_nonneg (u + v), norm_nonneg u, norm_nonneg v]/-- The triangle inequality as stated in Mathlib, `norm_add_le`, which holds in every normed
space (not only inner product spaces). -/
theorem norm_add_le_library {W : Type*} [NormedAddCommGroup W] (u v : W) : ‖u + v‖ ≤ ‖u‖ + ‖v‖ :=
norm_add_le u v/-- **Pythagoras with vectors, and its converse**: `|u + v|² = |u|² + |v|²` exactly when
`u · v = 0`. Expanding gives `|u + v|² = |u|² + 2 u · v + |v|²` (Mathlib's
`norm_add_sq_real`), so the two sides differ by `2 u · v`. -/
theorem pythagoras_iff_perp (u v : V) : ‖u + v‖ ^ 2 = ‖u‖ ^ 2 + ‖v‖ ^ 2 ↔ ⟪u, v⟫ = 0 := by
rw [norm_add_sq_real]
constructor
· intro h; linarith
· intro h; rw [h]; ringIn Mathlib the angle between vectors is defined by the arccosine of , just as in our definition for :
/-- **The angle between two vectors**: `cos θ = (u · v) / (|u| |v|)`. In Mathlib this is how
the angle `InnerProductGeometry.angle u v` is *defined* (as an `arccos`), and Cauchy–Schwarz is
what guarantees the quotient lies between `−1` and `1`. Applies
`InnerProductGeometry.cos_angle`. -/
theorem cos_angle (u v : V) :
cos (InnerProductGeometry.angle u v) = ⟪u, v⟫ / (‖u‖ * ‖v‖) :=
InnerProductGeometry.cos_angle u v/-- **Perpendicular means dot product zero**: `u · v = 0` exactly when the angle between `u`
and `v` is `π/2` (90°). Applies `InnerProductGeometry.inner_eq_zero_iff_angle_eq_pi_div_two`.
(Mathlib's convention makes the angle with the zero vector `π/2`, matching `0 · v = 0`.) -/
theorem perp_iff_right_angle (u v : V) :
⟪u, v⟫ = 0 ↔ InnerProductGeometry.angle u v = π / 2 :=
InnerProductGeometry.inner_eq_zero_iff_angle_eq_pi_div_two u v/-- **Projection.** The projection of `u` onto a non-zero `v` is `((u · v)/(v · v)) v`, and what
is left over, `u − ((u · v)/(v · v)) v`, is perpendicular to `v`:
`(u − c v) · v = u · v − c (v · v) = 0` for `c = (u · v)/(v · v)`. -/
theorem projection_perp (u v : V) (hv : v ≠ 0) :
⟪u - (⟪u, v⟫ / ⟪v, v⟫) • v, v⟫ = 0 := by
have hvv : ⟪v, v⟫ ≠ 0 := inner_self_ne_zero.2 hv
rw [inner_sub_left, real_inner_smul_left, div_mul_cancel₀ _ hvv, sub_self]Finally, the two geometry theorems. Note how short the Lean proofs are: once the statement is in vector form, the geometry has become algebra. The tactic module checks identities between linear combinations of vectors:
/-- **The diagonals of a parallelogram bisect each other.** If `ABCD` is a parallelogram, so
that `B − A = C − D` (the sides `AB` and `DC` are the same vector), then the midpoint of the
diagonal `AC` equals the midpoint of the diagonal `BD`: `(A + C)/2 = (B + D)/2`. -/
theorem parallelogram_diagonals_bisect (a b c d : V) (h : b - a = c - d) :
(1 / 2 : ℝ) • (a + c) = (1 / 2 : ℝ) • (b + d) := by
have hsum : a + c = b + d := by
rw [sub_eq_sub_iff_add_eq_add] at h
rw [add_comm a c, ← h, add_comm]
rw [hsum]/-- **The medians of a triangle meet at the centroid.** The point two thirds of the way from
the vertex `A` to the midpoint `(B + C)/2` of the opposite side is `(A + B + C)/3`. This
expression is symmetric in `A`, `B`, `C`, so the same point lies on all three medians. -/
theorem centroid (a b c : V) :
a + (2 / 3 : ℝ) • ((1 / 2 : ℝ) • (b + c) - a) = (1 / 3 : ℝ) • (a + b + c) := by
moduleExact checks and random directions
"""Cauchy-Schwarz and the triangle inequality, checked exactly.
For every pair of integer vectors u, v in three dimensions with coordinates
from -2 to 2 we check, in exact integer arithmetic, Lagrange's identity
|u|^2 |v|^2 - (u.v)^2 = |u x v|^2, hence the Cauchy-Schwarz inequality
(u.v)^2 <= |u|^2 |v|^2, and find exactly which pairs give equality. We then
test the triangle inequality and its equality cases, and finally let SymPy
verify Lagrange's identity for symbolic coordinates.
"""
import itertools
import math
import sympy
def dot(u, v):
"""The dot product u . v."""
return sum(a * b for a, b in zip(u, v))
def cross(u, v):
"""The cross product u x v of two 3D vectors."""
return (u[1] * v[2] - u[2] * v[1],
u[2] * v[0] - u[0] * v[2],
u[0] * v[1] - u[1] * v[0])
def is_parallel(u, v):
"""True when u and v are parallel (including when one is zero)."""
return cross(u, v) == (0, 0, 0)
def same_direction(u, v):
"""True when one vector is a non-negative multiple of the other."""
return is_parallel(u, v) and dot(u, v) >= 0
def triangle_holds(u, v):
"""Exact test of |u + v| <= |u| + |v|, with no square roots.
|u+v| <= |u| + |v| iff |u+v|^2 <= |u|^2 + |v|^2 + 2|u||v|
iff u.v <= |u||v|, which (for u.v >= 0) is (u.v)^2 <= |u|^2 |v|^2.
Returns (holds, equality).
"""
uv, uu, vv = dot(u, v), dot(u, u), dot(v, v)
holds = uv <= 0 or uv * uv <= uu * vv
equality = uv >= 0 and uv * uv == uu * vv
return holds, equality
def main():
grid = list(itertools.product(range(-2, 3), repeat=3))
pairs = cs_fail = lagrange_fail = 0
cs_equal = parallel = tri_fail = tri_equal = same_dir = 0
for u in grid:
for v in grid:
pairs += 1
uv, uu, vv = dot(u, v), dot(u, u), dot(v, v)
lagrange_fail += uu * vv - uv * uv != dot(cross(u, v), cross(u, v))
cs_fail += uv * uv > uu * vv
cs_equal += uv * uv == uu * vv
parallel += is_parallel(u, v)
holds, equality = triangle_holds(u, v)
tri_fail += not holds
tri_equal += equality
same_dir += same_direction(u, v)
print(f"All pairs of vectors in {{-2,...,2}}^3: {pairs} pairs (exact integers)")
print(f" Lagrange identity |u|^2|v|^2 - (u.v)^2 = |u x v|^2 fails: "
f"{lagrange_fail}")
print(f" Cauchy-Schwarz (u.v)^2 <= |u|^2 |v|^2 fails: {cs_fail}")
print(f" equality (u.v)^2 = |u|^2|v|^2: {cs_equal} pairs; "
f"parallel pairs: {parallel}")
print(f" triangle inequality fails: {tri_fail}")
print(f" equality |u+v| = |u|+|v|: {tri_equal} pairs; "
f"same-direction pairs: {same_dir}")
u, v = (1, 2, 2), (2, -1, 2)
print(f"Example: u = {u}, v = {v}: u.v = {dot(u, v)}, |u| = 3, |v| = 3,")
angle = math.degrees(math.acos(dot(u, v) / 9))
print(f" angle = arccos(4/9) = {angle:.2f} degrees")
s = sympy.symbols("u1:4 v1:4")
us, vs = s[:3], s[3:]
gap = sympy.expand(dot(us, us) * dot(vs, vs) - dot(us, vs) ** 2
- dot(cross(us, vs), cross(us, vs)))
print(f"SymPy: |u|^2|v|^2 - (u.v)^2 - |u x v|^2 expands to {gap}")
print()
print("Epistemic status: the grid check is exact and exhaustive, but only")
print("for these 15,625 integer pairs. SymPy's expansion to 0 is a symbolic")
print("verification of Lagrange's identity for all real coordinates (as")
print("far as SymPy is trusted); the lesson's proof needs no computer.")
if __name__ == "__main__":
main()The equality cases are exactly the parallel pairs (for Cauchy–Schwarz) and the same-direction pairs (for the triangle inequality), just as the theorems say. The grid check is exact and exhaustive, but only for these pairs; SymPy's symbolic expansion verifies Lagrange's identity for all coordinates, and the proof explains it.
Now something surprising. What is the angle between two random directions?
"""In high dimensions, two random vectors are almost perpendicular.
We draw pairs of random vectors in R^n (each coordinate an independent
standard normal number, seeded) and measure the angle between them with the
dot product formula cos(theta) = u.v / (|u| |v|). In the plane the angle is
spread evenly between 0 and 180 degrees; as n grows it piles up near 90
degrees. Theory says cos(theta) has mean 0 and variance exactly 1/n, so its
standard deviation is 1/sqrt(n): we compare the sample with that prediction.
"""
import math
import random
import statistics
def random_vector(n, rng):
"""A vector of n independent standard normal coordinates."""
return [rng.gauss(0.0, 1.0) for _ in range(n)]
def cos_angle(u, v):
"""cos of the angle between non-zero vectors u and v."""
dot = sum(a * b for a, b in zip(u, v))
return dot / math.sqrt(sum(a * a for a in u) * sum(b * b for b in v))
def sample_cosines(n, pairs, rng):
"""cos(theta) for `pairs` independent random pairs in R^n."""
return [cos_angle(random_vector(n, rng), random_vector(n, rng))
for _ in range(pairs)]
def main():
rng = random.Random(2024)
print(" n mean angle share within 10 deg of 90 sd(cos) 1/sqrt(n)")
for n in (2, 3, 10, 100, 1000):
cosines = sample_cosines(n, 300, rng)
angles = [math.degrees(math.acos(c)) for c in cosines]
near = sum(abs(a - 90) <= 10 for a in angles) / len(angles)
sd = statistics.pstdev(cosines)
print(f"{n:4d} {statistics.mean(angles):7.2f} deg "
f"{near:24.0%} {sd:7.4f} {1 / math.sqrt(n):9.4f}")
print("In the plane a random angle is equally likely anywhere in [0, 180];")
print("in 1000 dimensions almost every pair is within a few degrees of 90.")
print()
print("Epistemic status: statistical evidence from 300 random pairs per")
print("dimension, so each sample statistic has its own random error (a few")
print("per cent for sd(cos)). The value 1/sqrt(n) is exact: cos(theta) is")
print("distributed like one coordinate of a random unit vector, whose")
print("squares average to 1/n because the n squares add up to 1.")
if __name__ == "__main__":
main()In the plane the angle can be anything. In dimensions, two random vectors are almost always within a few degrees of perpendicular! The spread of is about . This is statistical evidence from finite samples, matched against an exact formula for the variance. It is one face of the "concentration of measure" that makes high-dimensional geometry so different from our intuition — and so useful in statistics and machine learning.
Explore: adding and projecting
Change the components of and . The sum is the diagonal of the parallelogram; the copy of starting at the tip of shows "tip to tail". The short segment along is the projection of onto . Try to make the projection vanish: that happens exactly when .
Vector addition and projection
A point moves along the curve as t changes: x and y are both functions of t.
- u
- v
- u + v
- v, moved to the tip of u
- projection of u onto v
- (0.25, 0.125)
- (0.063, 0.25)
- (0.313, 0.375)
- (2.063, 1.25)
- (0.044, 0.176)
The complex plane is another picture of : the complex number is the vector , and adding complex numbers is adding vectors. Drag and and watch the parallelogram.
Addition is the parallelogram rule
Drag z and w. Adding puts arrows end to end; multiplying multiplies lengths and adds angles.
Drag the points, or focus one with Tab and use the arrow keys (hold Shift for small steps).
| Number | Modulus | Argument | |
|---|---|---|---|
| z | 2 + i | 2.236 | 26.6°0.464 rad |
| w | 0.5 + 2i | 2.062 | 76°1.326 rad |
| z + w | 2.5 + 3i | 3.905 | 50.2°0.876 rad |
z + w = (2 + 0.5) + (1 + 2)i = 2.5 + 3i
Add the real parts and the imaginary parts separately: z + w is the far corner of the parallelogram built on z and w.
Exercises
1. Vectors and coordinate geometry
Warm-upHumanFind the length of the vector .
2. Vectors and coordinate geometry
Warm-upHumanCompute .
3. Vectors and coordinate geometry
CoreHumanFor which number is perpendicular to ?
4. Vectors and coordinate geometry
CoreHumanFind the angle, in degrees, between and .
5. Vectors and coordinate geometry
CoreHumanLet be vectors in and a number. Which of these expressions are vectors? (Choose all that apply.)
6. Vectors and coordinate geometry
CoreHumanFor non-zero vectors and , when is ?
7. Vectors and coordinate geometry
CoreHumanAt which value of does the line meet the plane ?
8. Vectors and coordinate geometry
StretchHumanIn the vector proof that the diagonals of a parallelogram bisect each other, which equation expresses ' is a parallelogram' (with vertices in this order)?
9. Vectors and coordinate geometry
StretchFormalIn Mathlib, ⟪u, v⟫ is the dot product and ‖u‖ the length. Which statement is the Cauchy–Schwarz inequality?
10. Vectors and coordinate geometry
StretchComputationalWrite projection(u, v) that returns the projection of onto a non-zero vector , , as a list of Fractions (vectors are lists of integers of the same length, in any dimension). Raise ValueError if is the zero vector.
Common misconceptions
Misconception
"A vector has a fixed starting point." A vector records only a length and a direction. The arrow from to and the arrow from to are the same vector . (A point has a fixed location; the vector is the move from one point to another.)
Misconception
"The dot product of two vectors is a vector." It is a number (a scalar): . So expressions such as with a dot between a number and a vector make no sense; , a number times a vector, does. The product that gives a vector in is the cross product, a different operation.
Misconception
"." Only when and point in the same direction (or one is zero). In general : going via a detour is never shorter. For , : .
Misconception
"Perpendicular means the dot product is " (or "parallel means "). It is the other way round: perpendicular vectors have , and for parallel vectors , the largest possible value.
Misconception
"Two lines that never meet are parallel." True in the plane, false in space: skew lines never meet and are not parallel. Parallel means the directions are multiples of each other.
Many ways of seeing
Algebra— A vector is anything you can add and scale
The rules we used — , , , and so on — are the axioms of a vector space. Lists of numbers satisfy them, but so do polynomials, matrices, solutions of the equation , and many more. Linear algebra studies all of these at once, together with the maps between them that respect addition and scaling (see linear algebra). Our proofs of Cauchy–Schwarz and the triangle inequality used only the rules of the dot product, so they hold in every inner product space.
Analysis— Dot products of functions
On the space of continuous functions on , the formula obeys all the rules of a dot product. Cauchy–Schwarz then says
which is how Viktor Bunyakovsky (1859) and Hermann Schwarz (1880s) found it, after Augustin-Louis Cauchy's version for sums (1821). In this space, and are perpendicular for , and Fourier series are expansions in perpendicular directions — exactly like coordinates (see functional analysis).
Probability— Random directions in many dimensions
As the experiment showed, two random unit vectors in have with mean and variance exactly . Since is distributed like the first coordinate of a random point on the unit sphere, and with all coordinates equally distributed, each averages to . So in high dimensions almost all pairs of directions are nearly perpendicular. Statisticians meet this whenever they compare many measurements at once; correlation coefficients are cosines of angles between data vectors.
Physics— Forces, velocities and work
Newton's laws are vector equations: forces add as vectors (the "parallelogram of forces"), and holds component by component. The work done by a constant force along a displacement is , and the power delivered to a body moving with velocity is ; perpendicular forces, like the pull of a string on a whirling stone, do no work. The cross product measures turning effects (torque) and oriented areas. Differential forms generalise both products to any dimension (see differential forms and classical mechanics).
History and global context
- Coordinates. René Descartes (La Géométrie, 1637) and Pierre de Fermat connected geometry with algebra by describing points with numbers.
- Parallelograms of forces and velocities. The rule for combining motions appears in ancient Greek mechanics; Simon Stevin (1586) used a parallelogram (or triangle) of forces, and Isaac Newton stated the parallelogram rule for forces as the first corollary to his laws of motion in the Principia (1687).
- Algebras of directed quantities. Caspar Wessel (1799) and Jean-Robert Argand (1806) represented complex numbers as arrows in the plane. William Rowan Hamilton invented quaternions in 1843 for rotations in space, and Hermann Grassmann's Ausdehnungslehre (1844) developed vectors in any number of dimensions — far ahead of its time.
- Vector analysis. In the 1880s Josiah Willard Gibbs in the USA and Oliver Heaviside in Britain independently extracted the dot and cross products from quaternions, creating the notation physicists and engineers still use.
- Inequalities. Augustin-Louis Cauchy proved the inequality for sums in 1821; Viktor Bunyakovsky (1859) and Hermann Schwarz (1880s) proved it for integrals. In Russia and elsewhere it is often called the Cauchy–Bunyakovsky inequality.
- Abstraction. Giuseppe Peano gave axioms for vector spaces in 1888, and in the 20th century David Hilbert's work on infinite-dimensional spaces made vectors a language for analysis, quantum mechanics and data science.
Further reading
- Tom M. Apostol, Calculus, Volume 1 (1967), chapters 12–13 — vector algebra and its applications to analytic geometry.
- Gilbert Strang, Introduction to Linear Algebra (1993; later editions) — vectors, dot products and much more, with a geometric emphasis.
- Michael J. Crowe, A History of Vector Analysis (1967) — from Hamilton and Grassmann to Gibbs and Heaviside.