What does the L2 or Euclidean norm mean?

Here’s a quick tutorial on the L2 or Euclidean norm.

First of all, the terminology is not clear. So let’s start with that.

Many equivalent names

All these names mean the same thing:
Euclidean norm == Euclidean length == L2 norm == L2 distance == l^2 norm

Although they are often used interchangable, we will use the phrase “L2 norm” here.

Many equivalent symbols

Now also note that the symbol for the L2 norm is not always the same.

Let’s say we have a vector, \vec{a} = [3,1,4,3,1].

The L2 norm is sometimes represented like this, ||\vec{a}||

Or sometimes this, ||\vec{a}||_2

Other times the L2 norm is represented like this, |\vec{a}|

Or even this, |\vec{a}|_2

To help distinguish from the absolute value sign, we will use the ||\vec{a}|| symbol.

Equation

Now that we have the names and terminology out of the way, let’s look at the typical equations.
||\vec{a}|| = \sqrt{\sum_i^n (a_i)^2} = \sqrt{(a_1)^2 + (a_2)^2 + \dots + (a_n)^2}
where n is the number of elements in \vec{a} (in this case n=5).

In words, the L2 norm is defined as, 1) square all the elements in the vector together; 2) sum these squared values; and, 3) take the square root of this sum.

A quick example

Let’s use our simple example from earlier, \vec{a} = [3,1,4,3,1].

We compute the L2 norm of the vector \vec{a} as,
||\vec{a}|| = \sqrt{(3^2 + 1^2 + 4^2 + 3^2 + 1^2)} = \sqrt{9 + 1 + 16 + 9 + 1} = \sqrt{36} = 6

And there you go!

So in summary, 1) the terminology is a bit confusing since as there are equivalent names, and 2) the symbols are overloaded. Finally, 3) we did a small example computing the L2 norm of a vector by hand.

If you are hungry for a code example, I wrote a small MATLAB example (computing L2 distance) here.