Connect via MCP →

Enter Calculation

Enter each real number on its own line. Negatives and decimals are allowed. Blank lines are ignored.

Formula

Advertisement

Results

L2 norm (Euclidean)
13
for 3 component(s)
L1 norm (Manhattan / sum of absolute values) 19
L2 norm (Euclidean) 13
L-infinity norm (maximum absolute value) 12

What is a vector norm?

A vector norm measures the "length" or magnitude of a vector. This calculator computes the three most common norms of a real vector: the L1 norm (also called the Manhattan or taxicab norm), the L2 norm (the familiar Euclidean length), and the L-infinity norm (the largest absolute component). These appear constantly in machine learning, optimization, statistics, signal processing and physics.

A 2D vector arrow from the origin to a point, with its horizontal and vertical components shown
A vector and its components in 2D space.

How to use it

Type each component of your vector on its own line in the input box, for example a vector with three entries 3, -4 and 12. Negative numbers and decimals are fully supported, and any blank lines are ignored. Press calculate and all three norms are returned at once, along with the number of components detected.

The formulas explained

For a vector x with components \(x_1\), \(x_2\), ..., \(x_n\):

  • L1 = sum of \(|x_i|\) — add up the absolute values.
  • L2 = square root of the sum of \(x_i^{2}\) — the straight-line distance from the origin.
  • L-infinity = max of \(|x_i|\) — the single biggest magnitude.

The three norms are defined as:

$$\begin{gathered} \|\vec{v}\|_1 = \sum_{i=1}^{n} |x_i| \qquad \|\vec{v}\|_2 = \sqrt{\sum_{i=1}^{n} x_i^{2}} \qquad \|\vec{v}\|_\infty = \max_i |x_i| \\[1.5em] \text{where}\quad x_i = \text{Vector components} \end{gathered}$$

A useful sanity check: for any vector the inequalities \(\|\vec{v}\|_\infty \le \|\vec{v}\|_2 \le \|\vec{v}\|_1\) always hold.

Advertisement
Comparison of L1, L2 and L-infinity distances between the origin and a point
L1 (Manhattan) follows the grid path, L2 (Euclidean) is the straight line, L-infinity is the largest single component.

Worked example

Take the vector [3, -4, 12]. The L1 norm is

$$|3| + |{-4}| + |12| = 3 + 4 + 12 = 19$$

The L2 norm is

$$\sqrt{3^2 + (-4)^2 + 12^2} = \sqrt{9 + 16 + 144} = \sqrt{169} = 13$$

The L-infinity norm is \(\max(3, 4, 12) = 12\).

FAQ

What happens with an empty input? If no components are entered, all three norms are reported as 0.

Does the sign of a component matter? All three norms use absolute values or squares, so a component and its negative contribute identically.

Why are some results not whole numbers? The L2 norm involves a square root, so unless the sum of squares is a perfect square the result is irrational and is shown rounded to about ten significant digits.

Last updated: