# How get eigenvectors without phase jump?

I'm using Eigenvectors to get the eigenvectors for some matrixes, but the eigenvectors seems to have some phase jump. Here is an example:

Say we have a 2 by 2 matrix {{2., Exp[I x]}, {Exp[-I x], 2.}} and x is a number. Now if we change x smoothly in some region, we would expect the eigenvector or eigenvalues changes smoothly. But in fact, we see that there are jumps.

eigenVects =
Table[Eigenvectors[{{2., Exp[I x]}, {Exp[-I x], 2.}}][[1]] /. {a_, b_} -> {a/Sqrt[a^2 + b^2], b/Sqrt[a^2 + b^2]}, {x, π/2 + π/10, 3 π/2 - π/10, π/20}]


We then take the first eigenvector and plot it's real and imaginary part

Row[{ListPlot[Re@Transpose[eigenVects], Joined -> True,
ImageSize -> 300, Mesh -> All],
ListPlot[Im@Transpose[eigenVects], Joined -> True, ImageSize -> 300,
Mesh -> All]}]


and we see the curves are not smooth but with some jumps in them. These jumps corresponding to a phase factor to the eigenvectors from the Eigenvectors function. Normally, an eigenvector times a phase factor would still be a eigenvector, but in my system, the uncontrollable phase factor from the Eigenvectors give me problems.

For comparison, we take the analytical solution of the eigenvectors for this 2 by 2 matrix

myEigenvectors[{{a_, b_}, {c_, d_}}] := Module[{C1, C2},
C1 = {-((-a + d + Sqrt[a^2 + 4 b c - 2 a d + d^2])/(2 c)), 1};
C2 = {-((-a + d - Sqrt[a^2 + 4 b c - 2 a d + d^2])/(2 c)), 1};
{C1/Norm[C1], C2/Norm[C2]}
]


and also plot the Re and Im part of the first eigenvector

eigenVects2 =
Table[myEigenvectors[{{2., Exp[I x]}, {Exp[-I x], 2.}}][[
1]] /. {a_, b_} -> {a/Sqrt[a^2 + b^2],
b/Sqrt[a^2 + b^2]}, {x, π/2 + π/10,
3 π/2 - π/10, π/20}];


we see the curves are smooth.

So why there are these phase jumps in the results from Eigenvectors, and how to get the eigenvectors without the jumps? (For large matrix analytical solution is not practical.)

-
What version are you on? I get completely different results for the plot in your first example - nice, smooth curves. –  rasher Jun 29 at 2:31
9.0 for Mac OS X x86 (64-bit) (January 24, 2013). What's your version? –  xslittlegrass Jun 29 at 2:34
9.0.1, Windows. Interesting... –  rasher Jun 29 at 2:34

The phase (and length) of the eigenvectors is completely undetermined unless you specify extra conditions in addition to the eigenvalue equation. Given that you don't have any additional conditions, it's not surprising that there is no well-defined way to plot the real and imaginary parts of each eigenvector component.

A simple condition that makes the answer unique is to require that the first component of each eigenvector be real. Also, we can add the requirement of normalization.

Then the procedure would be as follows:

eigenVects =
Table[Eigenvectors[{{2., Exp[I x]}, {Exp[-I x], 2.}}][[1]] /. {a_,
b_} -> {a/Sqrt[a^2 + b^2], b/Sqrt[a^2 + b^2]}, {x, Pi/
2 + Pi/10, 3 Pi/2 - Pi/10, Pi/20}];

eigenVects2 = MapIndexed[Normalize[#/#[[1]]] &, eigenVects];

Row[{ListPlot[Re@Transpose[eigenVects2], Joined -> True,
ImageSize -> 300, Mesh -> All],
ListPlot[Im@Transpose[eigenVects2], Joined -> True,
ImageSize -> 300, Mesh -> All]}]


The blue lines (for the first component) show that the real part is constant due to normalization, and the imaginary part is zero at all times. There are no longer any phase jumps because the phase has been fixed.

You can come up with an arbitrary number of alternative conditions that would result in different plots.

-