# How to normalize a list of eigenvectors?

Here is a simple eigenvector problem solution

m = {{2, Sqrt}, {Sqrt, 4}};
v = Eigenvectors[m]


However, the list of vectors v is not normalized. The command

Normalize[v]


returns an error. It seems Normalize doesn't want a list of vectors. The following works just fine:

u = Table[Normalize[v[[i]]], {i, 2}];


...but it seems clunky to me. I found an alternate way to use Normalize with a second argument, namely

Normalize[v, Norm]


but the list of vectors returned is not the same as u.

Is there something better than using Table to normalize the list of eigenvectors?

• try Normalize /@ v? – kglr Mar 4 '17 at 14:30

## 2 Answers

Here's a range of incremental improvements:

Table[Normalize[v[[i]]], {i, 2}]

Table[Normalize[v[[i]]], {i, Length[v]}] (* like a for loop in other languages *)

Table[Normalize[ev], {ev, v}] (* like a for each loop in other languages *)

Map[Normalize, v]

Normalize /@ v (* shorthand for Map *)


Look up Map and all the syntaxes of Table and read this:

Note that Eigenvectors will return normalized eigenvectors if its input are floating point numbers, but not if the input is exact. Eigenvactors@N[m] gives a normalized approximate result because N[m] is floating point. Eigenvalues[m] doesn't because m is exact.

Normalize[v, Norm] does not do what you think it is doing. Normalize[vector, function] simply computes vector / function[vector]. In your case it uses Norm[v], which is a matrix norm, not a vector norm.

• What is ev? eigenvalues? – Alex Mar 8 '20 at 22:40
• @Alex It is the name of the iterator used in Table. It is not a global variable. – Szabolcs Mar 9 '20 at 8:17

Normalize is not a Listable function, which means that you cannot expect it to act on a list of arguments in the same way that it acts on an argument. That is why you have to Map its action into the list of vectors.

So as @kglr writes in the comments, Map[Normalize,v], or equivalently Normalize/@v, will do the job:

Normalize /@ {{1, 1}, {1, -1}}

(* {{1/Sqrt, 1/Sqrt}, {1/Sqrt, -(1/Sqrt)}} *)

• Thank you both very much. This is just what I needed. – Jim Napolitano Mar 4 '17 at 16:39
• Another way to think about your problem (and the answers) is that you were trying to normalize a matrix. Instead you want to normalize each row (vector) in the matrix. Thus you have to map Normalize to each of the rows. – David G. Stork Mar 4 '17 at 19:17