Magnitude of a Vector
Calculus & Advanced MathThe 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}
Definition
The magnitude of a vector is simply its length. It is always a non-negative number. You find it using the Pythagorean theorem on the components.
Example
$v = (3, 4)$: magnitude $= \sqrt{3^2 + 4^2} = \sqrt{9 + 16} = \sqrt{25} = 5$. A vector pointing $3$ units right and $4$ units up has length $5$.
Key Insight
Magnitude strips away direction and leaves only size. A unit vector has magnitude $1$ and is found by dividing a vector by its own magnitude: $v/|v|$.
Definition
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}$. This is the Euclidean norm. Properties: $|v| \ge 0$, $|v| = 0$ iff $v = 0$, $|cv| = |c| \cdot |v|$, $|u + v| \le |u| + |v|$ (triangle inequality).
Example
$v = (1, 2, 2)$: $|v| = \sqrt{1 + 4 + 4} = \sqrt{9} = 3$. Unit vector: $v/|v| = (1/3, 2/3, 2/3)$. Verify: $(1/3)^2 + (2/3)^2 + (2/3)^2 = 1/9 + 4/9 + 4/9 = 1$.
Key Insight
The dot product gives a shortcut: $|v|^2 = v \cdot v$. This means magnitude and inner product are fundamentally linked, and the definition of magnitude is what makes the dot product formula $u \cdot v = |u||v|\cos(\theta)$ work.
Definition
The Euclidean norm $\|\cdot\|$ is the standard norm on $\mathbb{R}^n$, derived from the inner product: $\|v\| = \sqrt{\langle v,v \rangle}$. Norms on a vector space must satisfy positive-definiteness, absolute homogeneity, and the triangle inequality. Other norms include the $L^1$ norm (sum of $|v_i|$) and $L^\infty$ norm (max $|v_i|$). All norms on a finite-dimensional space are equivalent.
Example
$L^2$ norm: $\|(3,4)\| = 5$. $L^1$ norm: $3+4 = 7$. $L^\infty$ norm: $\max(3,4) = 4$. In machine learning, $L^1$ and $L^2$ regularization penalize model weights using these norms.
Key Insight
The choice of norm determines geometry: the $L^1$ unit ball is a diamond, $L^2$ is a circle, $L^\infty$ is a square. In optimization, $L^1$ regularization (Lasso) promotes sparsity because the $L^1$ ball has corners aligned with the coordinate axes.