Magnitude of a Vector

Calculus & Advanced Math

The magnitude of a vector is its length, calculated as the square root of the sum of the squares of its components.

Formula

|v| = \sqrt{v_1^2 + v_2^2 + \ldots + v_n^2}
Visualization

Definition

The magnitude of a vector is simply its length, always a non-negative number, found using the Pythagorean theorem on the components. For $v = (v_1, v_2, \ldots, v_n)$ in $\mathbb{R}^n$: $|v| = \sqrt{v_1^2 + v_2^2 + \ldots + v_n^2}$, the Euclidean norm, satisfying $|v| \ge 0$ (with equality iff $v=0$), $|cv| = |c| \cdot |v|$, and the triangle inequality $|u + v| \le |u| + |v|$. More generally, the Euclidean norm is derived from the inner product, $\|v\| = \sqrt{\langle v,v \rangle}$; norms must satisfy positive-definiteness, absolute homogeneity, and the triangle inequality, and other norms include the $L^1$ norm (sum of $|v_i|$) and $L^\infty$ norm (max $|v_i|$), all equivalent on a finite-dimensional space.

Example

For $v = (3, 4)$: magnitude $= \sqrt{3^2 + 4^2} = \sqrt{25} = 5$, a vector pointing $3$ units right and $4$ units up has length $5$. A unit vector has magnitude $1$, found by dividing a vector by its own magnitude; for $v = (1, 2, 2)$: $|v| = 3$, and the unit vector $v/|v| = (1/3, 2/3, 2/3)$ checks out since $(1/3)^2 + (2/3)^2 + (2/3)^2 = 1$. Different norms give different values for the same vector: $\|(3,4)\|_{L^2} = 5$, $\|(3,4)\|_{L^1} = 7$, $\|(3,4)\|_{L^\infty} = 4$, and in machine learning, $L^1$ and $L^2$ regularization penalize model weights using exactly these norms.

Key Insight

Magnitude strips away direction and leaves only size, and the dot product gives a shortcut, $|v|^2 = v \cdot v$, linking magnitude and inner product, which is what makes the formula $u \cdot v = |u||v|\cos(\theta)$ work. The choice of norm determines geometry: the $L^1$ unit ball is a diamond, $L^2$ is a circle, $L^\infty$ is a square, and in optimization, $L^1$ regularization (Lasso) promotes sparsity because the $L^1$ ball has corners aligned with the coordinate axes.