# Eigenvector for specific eigenvalue [closed]

I can't find guidance in the documentation center for how to retrieve the eigenvector(s) of a matrix associated to a specific eigenvalue. My first question is what the command is to do that. I would next like to apply that function to a list (I want all the eigenvectors associated to 0 in a list of matrices). Any help is appreciated.

## closed as off-topic by Daniel Lichtblau, Henrik Schumacher, N.J.Evans, eyorble, MarcoBJun 23 '18 at 4:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Daniel Lichtblau, Henrik Schumacher, N.J.Evans, eyorble, MarcoB
If this question can be reworded to fit the rules in the help center, please edit the question.

• What about NullSpace /@ matrices? – Henrik Schumacher Jun 21 '18 at 22:14
• NullSpace? For other eigenvalues, Eigensystem gives a matching pair of eigenvalues and -vectors, so you can find the index of the eigenvalue you want and extract the corresponding eigenvector. – Marius Ladegård Meyer Jun 21 '18 at 22:15
• Thank you, NullSpace is perfect here since I'm looking for 0 and works. What if I wanted it for something else, say 1? How would I apply that to a list in a quick way? With the map function? – massy255 Jun 21 '18 at 22:17
• Or Extract[#[], Position[#[], 1.]] &@*Eigensystem /@ matrices. – Henrik Schumacher Jun 21 '18 at 22:20
• @JungHwanMin at that point why not just use Eigensystem and then Pick[#[], #==testVal&/@#[]] – b3m2a1 Jun 21 '18 at 22:20

## 1 Answer

Converting comment into answer:

You could define a function like this:

eigenAssoc[matrix_] := Apply[Last, GroupBy[Thread[Eigensystem[matrix]], First], {2}]


For example:

In:= assoc = eigenAssoc[{{2, 0, 0}, {0, 1, 0}, {0, 0, 2}}]

Out= <|2 -> {{0, 0, 1}, {1, 0, 0}}, 1 -> {{0, 1, 0}}|>


Then you can use the resulting association to find the eigenvectors associated with an eigenvalue:

In:= assoc

Out= {{0, 1, 0}}


If you expect to search some non-eigenvalue, then you may want to use Lookup:

In:= Lookup[assoc, 3, {}]

Out= {}

• How do I apply assoc to a list? Say I have Blocks = {{{1, 0}, {0, 5}}, {{-1, 3}, {0, 3}}, {{2, 2}, {0, 1}}}. eigenAssoc/@Blocks works fine, but not assoc/@Blocks – massy255 Jun 24 '18 at 6:03
• @massy255 You could define a pure-function, like eigenAssoc[#]& /@ Blocks. – JungHwan Min Jun 24 '18 at 6:17
• Thanks! How would I modify it so that it gives me an empty set when there is no desired eigenvector for one of the blocks? For example on the above it gives me {{{1, 0}}, Missing["KeyAbsent", 1], {{-2, 1}}}. (I would like to eventually union this set at the end of the day to get the whole eigenspace. – massy255 Jun 24 '18 at 6:43
• @massy255 Like in my third example, you would need to use LookUp. For example LookUp[eigenAssoc[#], 1, {}]& /@ Blocks (by the way, I highly recommend that you use lowercase or lowerCamelCase for variable names because all Mathematica built-ins are in UpperCamelCase; you would prevent any issues with variable naming). – JungHwan Min Jun 25 '18 at 1:03