Vector Norms and Distance Metrics
What you'll learn: How to measure the size of a vector and the distance between vectors using different mathematical norms.
What Is a Norm?
A norm is a function that assigns a non-negative length or magnitude to a vector. Think of it like measuring how "big" a vector is, similar to how you'd measure the length of an arrow from its starting point to its tip.
The Three Essential Norms
L1 Norm (Manhattan Distance)
The L1 norm is the sum of the absolute values of all components in a vector.
Analogy: Imagine walking in a city with a grid layout. To get from point A to point B, you walk along streets (only horizontal and vertical moves). The total blocks you walk is the L1 distance.
For vector v = [3, -4], the L1 norm = |3| + |-4| = 3 + 4 = 7
L2 Norm (Euclidean Distance)
The L2 norm is the square root of the sum of squared components—the "straight-line" distance.
Analogy: This is the distance "as the crow flies." It's the shortest path directly between two points.
For vector v = [3, -4], the L2 norm = √(3² + (-4)²) = √(9 + 16) = √25 = 5
Infinity Norm (Maximum Norm)
The infinity norm is simply the largest absolute value among all components.
For vector v = [3, -4], the infinity norm = max(|3|, |-4|) = 4
Why Norms Matter
Norms let you measure distances between vectors by computing the norm of their difference. If you have vectors a and b, the distance is the norm of (a - b). This is fundamental for algorithms that need to know "how close" data points are to each other.
Key Takeaway: Norms quantify vector magnitude using different rules—L1 sums absolute values, L2 measures straight-line distance, and infinity takes the maximum component—and all three enable distance calculations critical for machine learning.