17
$\begingroup$

Here is a vector

$$\begin{pmatrix}i\\7i\\-2\end{pmatrix}$$

Here is a matrix

$$\begin{pmatrix}2& i&0\\-i&1&1\\0 &1&0\end{pmatrix}$$

Is there a simple way to determine whether the vector is an eigenvector of this matrix?

Here is some code for your convenience.

h = {{2, I, 0 },
     {-I, 1, 1},
     {0, 1, 0}};

y = {I, 7 I, -2};
$\endgroup$
  • 2
    $\begingroup$ Could also do h.y/y. Dividing by y divides element-wise, and so if it's an eigenvector, each element of the resulting vector should be the same (which is the eigenvalue). $\endgroup$ – march Nov 27 '17 at 19:24
  • 1
    $\begingroup$ @march: Division by zero (not in this case, but in general)...? $\endgroup$ – Henrik Schumacher Nov 27 '17 at 19:32
  • $\begingroup$ @HenrikSchumacher. Sure, it's not completely general, which is partly why I didn't write it as an answer. $\endgroup$ – march Nov 27 '17 at 19:33
  • $\begingroup$ @march It's still a good idea. $\endgroup$ – Henrik Schumacher Nov 27 '17 at 19:35
  • 7
    $\begingroup$ Solve the eigenvalue/vector equation: Solve[h.y == lambda*y, lambda]. It is an eigenvector iff solution set is nonempty. $\endgroup$ – Daniel Lichtblau Nov 27 '17 at 20:33
27
$\begingroup$

You could use MatrixRank. Here is a function that does this:

eigenvectorQ[matrix_, vector_] := MatrixRank[{matrix . vector, vector}] == 1

For your example:

eigenvectorQ[h, y]

False

$\endgroup$
  • $\begingroup$ Slick... (and an upvote) $\endgroup$ – Daniel Lichtblau Nov 28 '17 at 16:31
  • $\begingroup$ That is the right way $\endgroup$ – yarchik Nov 29 '17 at 7:26
2
$\begingroup$
MemberQ[myeigens = Normalize/@Eigenvectors[h], Normalize[y]]|| MemberQ[myeigens, -Normalize[y]]

(* False *)

$\endgroup$
  • 1
    $\begingroup$ And what if you have eigenvalues with multiplicities? $\endgroup$ – Henrik Schumacher Nov 27 '17 at 19:30
  • $\begingroup$ Won't you find the match in that case? $\endgroup$ – David G. Stork Nov 27 '17 at 19:45
  • $\begingroup$ Not necessarily. The eigenspace to an eigenvalue with higher multiplicity may have dimension greater than 1 and Eigenvectors just picks a basis. So, it will likely happen that neither Normalize[y] nor -Normalize[y] coincides with one of the basis vectors. $\endgroup$ – Henrik Schumacher Nov 27 '17 at 19:50
  • 1
    $\begingroup$ Here, a counter example: MemberQ[Eigenvectors[DiagonalMatrix[{1, 1}]], Normalize[{1, -1}] || -Normalize[{1, -1}]] $\endgroup$ – Henrik Schumacher Nov 27 '17 at 19:53
  • $\begingroup$ @HenrikSchumacher: But the eigenvectors of DiagonalMatrix[{1,1}] are {1,0} and {0,1}, so of course your code will yield False. $\endgroup$ – David G. Stork Nov 27 '17 at 22:22
4
$\begingroup$

Yes! We just check whether $h.y = (u + I v) y$ holds for some real $u, v \in \mathbb{R}$.

h = {{2, I, 0}, {-I, 1, 1}, {0, 1, 0}};
y = {I, 7 I, -2};
expr = Norm[h.y - (u + I v) y, 2]^2 // ComplexExpand;
Minimize[expr, {u, v}]

{623/6, {u -> 17/18, v -> 0}}

Answer: Nope, it's not.

$\endgroup$
7
$\begingroup$

For problems with exact coordinates, one could code up the definition of eigenvector. The function eigV finds the eigenvalue for a given vector in the form L == value or returns False if there is none; the function eigQ returns True if there exists an eigenvalue for

ClearAll[eigQ, eigV];
eigV[m_, v_] := Reduce@Thread[(m - SparseArray[{i_, i_} :> L, Dimensions[m]]).v == 0];
eigV[m_][v_] := eigV[m, v]; (* operator form *)
eigQ[m_, v_] := Resolve@Exists[L, eigV[m, v]];
eigQ[m_][v_] := eigQ[m, v]; (* operator form *)

Examples:

eigQ[h] /@ {y, {-I (-2 + Sqrt[3]), 1 - Sqrt[3], 1}}
(*  {False, True}  *)

eigV[h] /@ {y, {-I (-2 + Sqrt[3]), 1 - Sqrt[3], 1}}
(*  {False, L == 1 - Sqrt[3]}  *)

Or simply

eigQ[h, y]
(*  False  *)

For approximate problems, one would have to account for rounding error.

$\endgroup$
  • $\begingroup$ Note: It's simpler to use Daniel Lichtblau's form for the equation: eigV[m_, v_] := Reduce[m.v == L*v] (brain spasm sent me on the roundabout way, I guess). $\endgroup$ – Michael E2 Nov 27 '17 at 22:20
  • 1
    $\begingroup$ Why not just Resolve@Exists[α, #1.#2 == α #2] & @@ {h, y}? $\endgroup$ – aardvark2012 Nov 28 '17 at 3:21
  • $\begingroup$ @aardvark2012 Fair enough. I had something like that at one point. But I was enamored with eigV; for some reason, it appealed to me. Maybe the eigenvalue as a certificate of proof, I suppose. $\endgroup$ – Michael E2 Nov 28 '17 at 3:46
3
$\begingroup$

Either

Reduce[h . y == x * y, x]

or

Reduce[(h - IdentityMatrix[Length[h]] x) . y == 0, x]

depending on whether you would rather type $y$ once or twice.

$\endgroup$
1
$\begingroup$

How about this:

eigenVectorQ[mat_, vec_] := Abs[Dot[#1\[Conjugate], #2]] == Norm[#1] Norm[#2] &[mat.vec, vec]

Then eigenVectorQ[h, y] returns False.

$\endgroup$
4
$\begingroup$

You already have several good answers. An alternative is to use a Rayleigh quotient,

r = First[y.h.ConjugateTranspose[{y}]/Norm[y]];

The vector y is an eigenvector of h if and only if the matrix $$ h-r1_{3\times3} $$ is singular:

MatrixRank[h - IdentityMatrix[Length[y]] R]<Length[y]
(*False*)

or

Det[h - IdentityMatrix[Length[y]] R] == 0
(*False*)

If you are using floating point numbers, you should change this condition into

MatrixRank[h - IdentityMatrix[Length[y]] R,Tolerance->epsilon]<Length[y]

or

Abs[Det[h - IdentityMatrix[Length[y]] R]] < epsilon

where epsilon is some small number.

As a matter of fact, the MatrixRank method is slightly faster than the Det one. It seems to me that it is also faster than the methods suggested by other users, but confirming this would require a more thorough analysis.

$\endgroup$
  • 2
    $\begingroup$ For full masochistic effect you should have him calculate the determinant by cofactor expansion. ;) $\endgroup$ – Mehrdad Nov 29 '17 at 5:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.