The Difference Between the Norm of a Vector and the Distance Between Two Vectors

Bottom line: It is possible to express the distance between two vectors as the norm of their difference.

Let

v1 = (2.0, 5.0, 3.0)
v2 = (1.0, 7.0, 0.0)

The difference of two vectors is just a vector made from the difference of their components:

v1 - v2 = (2-1, 5-7, 3-0)
        = (1.0, -2.0, 3.0)

The norm of a vector is the square root of the sum of the squared components:

|| v1 || = sqrt(2^2 + 5^2 + 3^2)
         = sqrt(4 + 25 + 9)
         = sqrt(38)
         = 6.16

|| v2 || = sqrt(1^2 + 7^2 + 0^2)
         = sqrt(1 + 49 + 1)
         = sqrt(50)
         = 7.07

The Euclidean distance between two vectors is the square root of the sum of the squared differences between components:

dist(v1, v2) = sqrt( (2-1)^2 + (5-7)^2 + (3-0)^2 )
             = sqrt( 1 + 4 + 9 )
             = sqrt(14)
             = 3.74

It is possible, and common, to express Eucidean distance between two vectors as the norm of their difference:

|| v1 - v2 || = || (2, 5, 3) - (1, 7, 0) ||
              = || (1, -2, 3) ||
              = sqrt( 1^2 + (-2)^2 + 3^2 )
              = sqrt( 1 + 4 + 9 )
              = sqrt(14)
              = 3.74

In other words

dist(v1, v2) = || v1 - v2 ||

The relationhip between the norm of a vector and the Euclidean distance between two vectors appears in several machine learning scenarios. I was talking to a colleague recently. He wants to create a roadmap for software developers who want to gain machine learning knowledge and skills. This leads to the question of exactly what, if any, math background is necessary.

Knowing the roughly 100 basic math techniques for ML like the one described here is useful, but is it necessary? On the one hand, norm vs. distance is not a difficult idea and anyone can learn it on the fly. But on the other hand, if you need to pick some math knowledge up while you’re in the middle of an ML topic that uses the knowledge, it makes learning ML much more difficult.



Three paintings by artist Stanislaw Krupp. Sort of a modern Art Nouveau style. I don’t think an artist can pick up new art techniques on the fly while he’s in the middle of creating a painting, but I’m not an artist so I could be wrong.

This entry was posted in Machine Learning. Bookmark the permalink.