2
$\begingroup$

How to identify which eigenvalue corresponds to which diagonal entry of the matrix. Here is an example:

Input: {{b, 0, 0, 0}, {0, a, 0, 0}, {0, 0, d, e}, {0, 0, e, c}}

Eigenvalues[%]

Output: {a, b, 1/2 (c + d - Sqrt[c^2 - 2 c d + d^2 + 4 e^2]), 
 1/2 (c + d + Sqrt[c^2 - 2 c d + d^2 + 4 e^2])}

From the above, the order has seemingly changed.

$\endgroup$
2
  • $\begingroup$ In general there is no such association. What exactly are you trying to do? Are there restrictions on the types of matrices you have in mind? $\endgroup$ Commented Jun 26 at 1:50
  • 2
    $\begingroup$ From the documentation of Eigensystem, "all the nonzero eigenvectors given are independent. If the number of eigenvectors is equal to the number of nonzero eigenvalues, then corresponding eigenvalues and eigenvectors are given in corresponding positions in their respective lists. The eigenvalues correspond to rows in the eigenvector matrix." $\endgroup$
    – bbgodfrey
    Commented Jun 26 at 16:53

2 Answers 2

4
$\begingroup$

Use Eigensystem.

Eigensystem[{{b, 0, 0, 0}, {0, a, 0, 0}, {0, 0, d, e}, {0, 0, e, c}}]
(*
{{a, b, 
  1/2 (c + d - Sqrt[c^2 - 2 c d + d^2 + 4 e^2]), 
  1/2 (c + d + Sqrt[c^2 - 2 c d + d^2 + 4 e^2])}, 
{{0, 1, 0, 0}, {1, 0, 0, 0}, 
 {0, 0, -((c - d + Sqrt[c^2 - 2 c d + d^2 + 4 e^2])/(2 e)), 1}, 
 {0, 0, -((c - d - Sqrt[c^2 - 2 c d + d^2 + 4 e^2])/(2 e)), 1}}}
*)
$\endgroup$
2
  • $\begingroup$ How to distinguish between the 3rd and 4th? $\endgroup$
    – SciJewel
    Commented Jun 25 at 21:57
  • $\begingroup$ What do you mean? They are not the diagonal entries. $\endgroup$
    – Domen
    Commented Jun 26 at 4:11
1
$\begingroup$

You may need to consolidate Mathematica code that computes the eigenvalues of the matrix and directly outputs them:

(* Define the matrix *)
matrix = {{b, 0, 0, 0}, {0, a, 0, 0}, {0, 0, d, e}, {0, 0, e, c}};

(* Compute and display the eigenvalues *)
Eigenvalues[matrix]

When you run this single block of code in Mathematica, it will compute and display the eigenvalues of the matrix. The output will be:

{a, b, 1/2 (c + d - Sqrt[c^2 - 2 c d + d^2 + 4 e^2]), 
 1/2 (c + d + Sqrt[c^2 - 2 c d + d^2 + 4 e^2])}

Edit: Here is the corrected and improved code based on the OP's requirements:

(* Define the matrix *)
A = {{b, 0, 0, 0}, {0, a, 0, 0}, {0, 0, d, e}, {0, 0, e, c}};

(* Compute eigenvalues and eigenvectors of the original matrix *)
{eigenvalues, eigenvectors} = Eigensystem[A];

(* Output eigenvalues and corresponding eigenvectors *)
{eigenvalues, eigenvectors}

enter image description here

$\endgroup$
2
  • $\begingroup$ whats the point? I already know this. Please read the question carefully. $\endgroup$
    – SciJewel
    Commented Jun 25 at 21:54
  • $\begingroup$ @SciJewel I have reviewed your question again and improved the code to directly address your specific requirements. The issue of matching eigenvalues to their corresponding diagonal entries has been resolved $\endgroup$ Commented Jun 25 at 23:16

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