Mathematical Foundations

vector norm

/ VEK-tur NORM /

A vector norm boils a whole list of numbers down to a single number that measures its size — how 'big' or 'long' the vector is. The most familiar one is the L2 norm, plain straight-line length: square each entry, add them up, take the square root. It is just the Pythagorean theorem, scaled to as many dimensions as you like, and it answers 'as the crow flies, how far is this from zero?'

But straight-line distance is not the only sensible notion of size. The L1 norm instead adds up the absolute values of the entries — the 'taxicab' or 'city-block' distance, the route you would actually walk on a grid of streets, where you cannot cut diagonally through buildings. The two give different answers and, crucially, push models toward different behaviors when used to keep things small.

Norms are everywhere in machine learning because so much of it is about controlling size. To curb overfitting, regularization adds a penalty on the norm of a model's weights, nudging it to stay simple. The choice of norm matters in a striking way: an L1 penalty tends to drive many weights all the way to exactly zero, automatically discarding useless features (that is what makes Lasso regression do feature selection), while an L2 penalty merely shrinks weights gently toward zero without zeroing them out (Ridge regression). Norms also define the distances that nearest-neighbor methods and clustering rely on, and they measure the magnitude of a gradient — used, for instance, to clip it when it grows dangerously large.

Take the vector [3, 4]. Its L2 norm (straight-line) is √(3² + 4²) = √25 = 5 — the crow's-flight distance. Its L1 norm (city-block) is |3| + |4| = 7 — the longer walk you actually make turning along a grid of streets. Same vector, two different sizes, each useful for different purposes.

Same vector [3, 4]: L2 measures the diagonal crow's flight (5), L1 the city-block walk (7).

L1 versus L2 is not a cosmetic choice: an L1 penalty zeroes out weights (giving sparse, feature-selecting models like Lasso), while an L2 penalty only shrinks them (Ridge). Picking the right norm shapes what your model actually learns.

Also called
向量范数向量範數范数範數L1 normL2 normEuclidean normmagnitudelength