# How to get integer/rational and real eigenvectors to be the same? [duplicate]

forgive me if I missed this already being answered or too easy.

Given a matrix:

q = {{1, 3, 5}, {7, 11, 13}, {1/3, 1/7, 1/13}};


Eigenvectors are different here:

In[2]:= a = N[Eigenvectors[q]]
Out[2]= {{14.5556, 56.6858, 1.}, {-4.27006, 1.39041,
1.}, {1.21677, -1.99197, 1.}}

In[3]:= b = Eigenvectors[N[q]]
Out[3]= {{-0.248673, -0.968437, -0.0170843}, {-0.928128, 0.302215,
0.217357}, {0.479159, -0.784431, 0.393796}}


which stems from rescaling:

In[4]:= a/b
Out[4]= {{-58.5333, -58.5333, -58.5333}, {4.60072, 4.60072,
4.60072}, {2.53939, 2.53939, 2.53939}}


Is there a way to get integer and real Eigenvectors with the same normalization?

It gets worse when you specify precision - note sign of 1st number flipped:

In[5]:= Eigenvectors[N[q, 35]]
Out[5]= {{0.24867278577372080511107762064780376,
0.96843687076373040287857556386982863,
0.017084289885473648334068065187262866}, \
{0.92812805901514313266605716176779448, \
-0.30221529031514813832796615484882196, \
-0.21735736557226146645737557543702705}, \
{0.47915906863206255992495113357375046, \
-0.78443055424576297260210726738246408,
0.39379600367873145263340569760309626}}


It is important when you want to track precision importance in calculating Eigenvectors of large matrices. They jump sporadically as precision increases.

Edit to address the comment:

There is a sporadic jump of the sign as I showed above with precision increase. Also Normalize will have it sometimes:

In[16]:= a = Normalize /@ N[Eigenvectors[q]]
Out[16]= {{0.248673, 0.968437, 0.0170843}, {-0.928128, 0.302215,
0.217357}, {0.479159, -0.784431, 0.393796}}

In[15]:= b = Eigenvectors[N[q]]
Out[15]= {{-0.248673, -0.968437, -0.0170843}, {-0.928128, 0.302215,
0.217357}, {0.479159, -0.784431, 0.393796}}


as can be seen from 1st number (note 2nd eigenvector has no sign jump). So how to guarantee same values in say such interface?

Manipulate[Eigenvectors[N[q, precision]], {precision, {33, 35}}]

• @m_goldberg I addressed your comment. There is more to this question then was asked earlier.
– iLie
Commented Apr 18, 2014 at 7:24
• the sign change is not explicitly mentioned in the link, but it is essentially the same issue. You can "fix" by choosing a convention that suits you such as multiplying by the Sign of the largest magnitude component. Look at the answer here math.stackexchange.com/questions/235396/eigenvalues-are-unique Commented Apr 18, 2014 at 12:26
• @george2079 you mean fix manually or some extra script sign flip detection? I increase precision and suddenly sign flips - and I should go and invent the way to suppress it?
– iLie
Commented Apr 18, 2014 at 15:11
• something like (# Sign[ Total@ # ] )&/@ eigenvectors should do. Commented Apr 18, 2014 at 17:05