Last updated on May 15th, 2017
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 == 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, .
The L2 norm is sometimes represented like this,
Or sometimes this,
Other times the L2 norm is represented like this,
Or even this,
To help distinguish from the absolute value sign, we will use the symbol.
Now that we have the names and terminology out of the way, let’s look at the typical equations.
where is the number of elements in (in this case ).
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, .
We compute the
L2 norm of the vector as,
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.