Vectors: Geometry & Algebra
Vectors have both magnitude and direction. They describe forces, velocities, displacements, and — in higher dimensions — data points in machine learning.
Key Concepts
Vector Notation
A vector in ℝⁿ is an n-tuple: v = (v₁, v₂, ..., vₙ). In 2D: v = (3, 4). Magnitude: ‖v‖ = √(v₁²+v₂²+...+vₙ²). Unit vector: v/‖v‖ has magnitude 1.
Vector Addition & Scalar Multiply
u + v: add component-wise. cv: multiply each component by c. Geometrically: tip-to-tail addition. Subtraction u − v = u + (−v).
Dot Product
u · v = u₁v₁ + u₂v₂ + ... = ‖u‖‖v‖cos(θ). Dot product = 0 means vectors are orthogonal (perpendicular). Used for projections, testing perpendicularity, angles.
Cross Product (3D)
u × v gives a vector perpendicular to both u and v. Magnitude = ‖u‖‖v‖sin(θ) = area of parallelogram. Right-hand rule determines direction. Only in 3D.
Live Python Practice
Interactive Lab
Check Your Understanding
The dot product u·v = 0 means:
The magnitude of vector (3, 4) is:
A unit vector has: