[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How does Octave choose a phase when calculating eigenvectors?

From: James Sherman Jr.
Subject: Re: How does Octave choose a phase when calculating eigenvectors?
Date: Fri, 13 Mar 2020 15:54:39 -0400

On Fri, Mar 13, 2020 at 2:13 PM Brett Green <address@hidden> wrote:

On Fri, Mar 13, 2020 at 1:27 PM Sergei Steshenko via Help-octave <address@hidden> wrote:

On 13/03/2020 19:12, James Sherman Jr. wrote:
On Fri, Mar 13, 2020 at 1:00 PM Brett Green <address@hidden> wrote:
Eigenvectors are defined up to a constant. Octave chooses the magnitude of this constant such that the eigenvectors will be normalized. However, this still leaves an arbitrary phase.

How does Octave choose this phase? It is not specified in the documentation.

- Brett Green

Hi Brett,

I'm not sure what you mean by "phase".  I'm somewhat familiar with the mathematics of eigenvectors/values, but do not have any experience with the term phase, in this this context.  Could you give an example of what you mean by phase?  Even your claim that eigenvectors are defined "up to a constant" is not entirely accurate.  Vectors (x) are either eigenvectors of a matrix (A) or not if they satisfy the equation
A*x = lambda*x
for some scalar lambda, called the eigenvalue for x.  Its true that scalar multiples of x are also eigenvectors of A (with the same lambda), but that has to do with the fact that linear combinations of eigenvectors with the same eigenvalue are also eigenvectors, not anything about being "defined".

James Sherman Jr.


The OP probably means polarity. I.e. if

A*x = lambda*x

is satisfied, then

A*(-x) = lambda*(-x)

is satisfied too.


Yes, though more generally, one could use a new eigenvector of exp(i*theta) for any theta. Polarity is only the cases theta=0 and theta=2pi.

Similar to what Sergei said, if
A*x = lambda*x
A*(b*x) = b*(A*x) = b*lambda*x = lambda*(b*x)
Expressing the complex number b as b=r*exp(i*theta), r is the magnitude and theta is the phase.
Perhaps my choice of words was incomplete. Yes, linear combinations of eigenvectors sharing the same eigenvalue are also eigenvectors. What I meant is that an eigenvector multiplied by an arbitrary constant is still an eigenvector of the same matrix with the same eigenvalue, so there is freedom in diagonalizing the matrix. Putting aside the case of multiple eigenvalues, each eigenvector is unique up to two real constants, the magnitude and phase of the eigenvector. Octave uses normalization (scaling x by a real constant so that |x|=1) as one constraint, which leaves a choice of phase (multiplication by a unit-magnitude complex number). What I want to know is how Octave chooses the arbitrary phase.

Oh, ok, I haven't done much with eigenvalues of complex matrices, but that makes sense.  I don't have any particular behind the scenes knowledge of the QZ algorithm, or what the LAPACK function that (I assume) octave uses to perform the heavy lifting of this, but just making a couple small random complex matrices, it seems that it rotates the complex eigenvectors so that the entry with the largest magnitude is real.  So, just to check on a larger data set, I ran the following code, which seems to indicate this is the case, i.e. in all 100 trials, the largest magnitude element in each eigenvector was real.

Hope this helps.

for ii = 1:100,
  A = rand(3,3)+j*rand(3,3);
  [v, lambda] = eig(A);
  [a, indices] = max(abs(v));
  for jj = 1:3
    if isreal(v(indices(jj), jj)) != 1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]