# What are vector norms used for?

I'm currently working with a computer science problem that requires me to build vectors that can return their own norms. Based on Wolfram Alpha's description, I think I have an idea of how this is accomplished for the simple $L^2$ norm ($\sqrt{a^2+b^2+c^2}$, and so on) required by the exercise, but I've no notion of what this is actually useful for or why I would want to find it, outside of it being required by the exercise.

Any insight is appreciated!

• What do you mean by a vector "that can return its own norm"? The language of computer science is very mysterious to me... – goblin May 31 '16 at 10:21
• @goblin a vector is an object in a programming language, which knows its properties, like coordinates and norm... – gt6989b May 31 '16 at 18:30
• Yeah, sorry @goblin, that was just meant to be background, it wasn't really pertinent to what I was actually asking. As gt6989b said, I was creating an object intended to hold vectors (using another 'array' object as a property of the vector object to hold individual vector 'x' values), which had the ability to access the vector it was storing, return it to various functions, and make various of computations on the vector, including conducting arithmetic with any vectors passed to it and computing and returning its own vector norm. I just didn't know what the norm was used for mathematically. – Brad May 31 '16 at 19:25
• @Brad, hmmm okay. So you hand the "vector" the query "I want to know your norm" and it speaks back to you: "my norm is 2.87" type-thing? Or have I completely misunderstood you? By the way the whole object-oriented thing isn't widely understood by mathematicians (unless they have a background in programming), so maybe include a bit more explanation any time you want to include OOP language/concepts in a math question. – goblin Jun 1 '16 at 4:03
• @goblin there's not quite that much interface built in, but that's the basic idea. In the actual code you could do something like var myVector = new Vector([1, 2, 3]); console.log(myVector.norm());. console.log() is a method (like a function) that prints an argument passed to it to the 'console' interface the programmer uses. So, the myVector.norm() method accesses the array inside of myVector, computes the norm, and hands it to console.log to be printed out, resulting in something to the effect of 3.7416573867739413855837487323165 being printed to the console. – Brad Jun 1 '16 at 6:29

in particular, Euclidean distance is defined by the 2-norm, $$\left\| \begin{pmatrix} x_1 \\ \vdots \\ x_k \end{pmatrix} \right\|_2 = \sqrt{\sum_{i=1}^k x_i^2}$$
There are others, of which the 1-norm $$\left\| \begin{pmatrix} x_1 \\ \vdots \\ x_k \end{pmatrix} \right\|_1 = \sum_{i=1}^k \left|x_i^2\right|$$ and the infinity norm $$\left\| \begin{pmatrix} x_1 \\ \vdots \\ x_k \end{pmatrix} \right\|_\infty = \max_{1 \le i \le k} \left\{|x_i|\right\}$$ are the most useful.