Mathwords logoMathwords

L2 Norm — Definition, Formula & Examples

The L2 norm is the straight-line length of a vector, calculated as the square root of the sum of the squares of its components. It is the most commonly used way to measure the size of a vector and is also called the Euclidean norm.

For a vector x=(x1,x2,,xn)Rn\mathbf{x} = (x_1, x_2, \ldots, x_n) \in \mathbb{R}^n, the L2 norm is defined as x2=(i=1nxi2)1/2\|\mathbf{x}\|_2 = \left(\sum_{i=1}^{n} x_i^2\right)^{1/2}. It is a special case of the LpL^p norm with p=2p = 2 and satisfies the axioms of a norm: non-negativity, positive definiteness, absolute homogeneity, and the triangle inequality.

Key Formula

x2=x12+x22++xn2\|\mathbf{x}\|_2 = \sqrt{x_1^2 + x_2^2 + \cdots + x_n^2}
Where:
  • x\mathbf{x} = A vector in \mathbb{R}^n with components x_1, x_2, \ldots, x_n
  • x2\|\mathbf{x}\|_2 = The L2 norm (Euclidean norm) of the vector
  • nn = The number of components (dimension of the vector)

How It Works

To compute the L2 norm, square each component of the vector, add all the squares together, then take the square root of that sum. The result is always a non-negative scalar. In two or three dimensions, the L2 norm gives the geometric distance from the origin to the point represented by the vector — this is exactly the Pythagorean theorem generalized to nn dimensions. The L2 norm is central to measuring error, defining unit vectors, and computing distances between points in space.

Worked Example

Problem: Find the L2 norm of the vector v=(3,4,12)\mathbf{v} = (3, -4, 12).
Step 1: Square each component of the vector.
32=9,(4)2=16,122=1443^2 = 9, \quad (-4)^2 = 16, \quad 12^2 = 144
Step 2: Add the squared values together.
9+16+144=1699 + 16 + 144 = 169
Step 3: Take the square root of the sum.
v2=169=13\|\mathbf{v}\|_2 = \sqrt{169} = 13
Answer: The L2 norm of (3,4,12)(3, -4, 12) is 1313.

Another Example

Problem: Given u=(1,2,2,4)\mathbf{u} = (1, 2, 2, 4), compute u2\|\mathbf{u}\|_2.
Step 1: Square each component.
12=1,22=4,22=4,42=161^2 = 1, \quad 2^2 = 4, \quad 2^2 = 4, \quad 4^2 = 16
Step 2: Sum the squares.
1+4+4+16=251 + 4 + 4 + 16 = 25
Step 3: Take the square root.
u2=25=5\|\mathbf{u}\|_2 = \sqrt{25} = 5
Answer: The L2 norm of (1,2,2,4)(1, 2, 2, 4) is 55.

Why It Matters

The L2 norm appears throughout linear algebra, optimization, and data science. In machine learning, L2 regularization (ridge regression) penalizes model weights by their L2 norm to prevent overfitting. Courses in numerical analysis and signal processing rely on the L2 norm to quantify approximation error and energy of signals.

Common Mistakes

Mistake: Forgetting to take the square root after summing the squares.
Correction: The sum of squares gives x22\|\mathbf{x}\|_2^2, not x2\|\mathbf{x}\|_2. Always finish by taking the square root to get the actual norm.
Mistake: Confusing the L2 norm with the L1 norm by summing absolute values instead of squaring.
Correction: For the L2 norm, you must square each component before summing. Summing absolute values gives the L1 norm, which is a different measure.

Related Terms