Re: Re: different eigenvectors

*To*: mathgroup at smc.vnet.net*Subject*: [mg83945] Re: [mg83910] Re: different eigenvectors*From*: "Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com>*Date*: Wed, 5 Dec 2007 07:10:41 -0500 (EST)*References*: <fj0rjv$per$1@smc.vnet.net> <200712040924.EAA17600@smc.vnet.net>

On Dec 4, 2007 3:42 PM, <jackgold at umich.edu> wrote: > Hi, > > Isn't the issue far more complicated when the eigenvalues are repeated? > To take an extreme example, any n linearly independent vectors are an > "eigenset" for the Identity Matrix. Maybe I missed the point of all > this :-) > > Quoting Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>: > > > vicky Al Aisa wrote: > > > >> I am using Eigenvectors function to calculate eigenvectors in > >> mathematica 5.2. > >> while comparing the results with the eigenvectors (of same matrix) > >> computed in another system, i found that both the results are bit different > >> with some values having opposite sign and coloumns rearranged. > > > > Note sure what the question, but something tells me that you are unclear > > about eigenvectors non-uniqueness. > > > > Second, for a given eigenvalue you can find infinitely many > > eigenvectors. Indeed, any non-zero scalar multiple of an eigenvector is > > also an eigenvector (for the corresponding eigenvalue of course). > > > > Second, for a given matrix, different CAS may produce the eigenvalues in > > different order, so the corresponding eigenvectors may be in different > > order from one system to another. > > > > Third, for a given matrix, different CAS may compute the eigenvectors in > > different ways. One may look for orthonormal (perpendicular and unitary) > > eigenvectors, while another system may satisfy with just orthogonal > > (perpendicular) eigenvectors. > > > > So, if you want to check the results from one CAS against the results > > from another CAS, first, you must check that the eigenvalues returned by > > both systems are the same (whatever their order) and that the > > corresponding eigenvectors returned by both system are scalar multiple. > > > > Here is an example with a 2 by 2 reflection matrix that illustrates the > > usage of the *Eigensystem* function, which returns the eigenvalues > > followed by the eigenvectors. > > > > In[1]:= m = {{0, 1}, {1, 0}} > > > > Out[1]= {{0, 1}, {1, 0}} > > > > In[2]:= Eigensystem@m > > > > Out[2]= {{-1, 1}, {{-1, 1}, {1, 1}}} > > > > In[3]:= Thread@% > > > > Out[3]= {{-1, {-1, 1}}, {1, {1, 1}}} > > > > In[4]:= (m.Last@# == First@#*Last@#) & /@ % > > > > Out[4]= {True, True} > > > > In[5]:= m.{1, -1} == (-1)*{1, -1} > > > > Out[5]= True > > > > In[6]:= m.(c*{1, -1}) == (-1)*(c*{1, -1}) > > > > Out[6]= True > > > > In[7]:= {-1, 1}.{1, 1} > > > > Out[7]= 0 > > > > In[8]:= Normalize /@ {{-1, 1}, {1, 1}} > > > > Out[8]= {{-(1/Sqrt[2]), 1/Sqrt[2]}, {1/Sqrt[2], 1/Sqrt[2]}} Oh, sure; I agree that many other things could have been told (though I am not sure about what issues you are talking about since from Mathematica's point of view there is no issue); but since the OP did neither ask --- explicitly --- any question nor give any example, it is somehow hard to find where to stop ideally! Speaking about Mathematica and repeated eigenvalues, the documentation center tells us that, "All the non-zero eigenvectors given are independent. If the number of eigenvectors is equal to the number of non-zero eigenvalues, then corresponding eigenvalues and eigenvectors are given in corresponding positions in their respective lists. " Moreover, "If there are more eigenvalues than independent eigenvectors, then each extra eigenvalue is paired with a vector of zeros." Therefore, as one can see below, the "method" I indicated in my previous reply, works well in such cases. The following matrix has two repeated eigenvalues but independent eigenvectors, while the next one has only two independent eigenvectors. m = {{2, 0, 0}, {0, 2, 0}, {0, 0, 1}}; {vals, vecs} = Eigensystem[m] m.Transpose@vecs == Transpose at vecs.DiagonalMatrix@vals Out[2]= {{2, 2, 1}, {{0, 1, 0}, {1, 0, 0}, {0, 0, 1}}} Out[3]= True m = {{2, 1, 0}, {0, 2, 0}, {0, 0, 1}}; {vals, vecs} = Eigensystem[m] m.Transpose@vecs == Transpose at vecs.DiagonalMatrix@vals Out[5]= {{2, 2, 1}, {{1, 0, 0}, {0, 0, 0}, {0, 0, 1}}} Out[6]= True Note that other systems may return the eigenvectors in a different fashion. For instance, on another system, although the eigenvalues are given in the same order than Mathematica, the eigenvectors are in a different order for the first matrix, and for the second matrix two non-zero linearly-dependent eigenvectors are returned for the repeated eigenvalues. >> m = [2 0 0; 0 2 0; 0 0 1] m = 2 0 0 0 2 0 0 0 1 >> [V, D] = eigs(m) V = 1 0 0 0 1 0 0 0 1 D = 2 0 0 0 2 0 0 0 1 >> m = [2 1 0; 0 2 0; 0 0 1] m = 2 1 0 0 2 0 0 0 1 >> [V, D] = eigs(m) V = -1.0000 1.0000 0 0.0000 0 0 0 0 1.0000 D = 2 0 0 0 2 0 0 0 1 Regards, -- Jean-Marc

**References**:**Re: different eigenvectors***From:*Jean-Marc Gulliet <jeanmarc.gulliet@gmail.com>