# Degenerate matrix diagonalization

When you diagonalize a matrix, and two eigenvalues are degenerate, is there a way to ask Mathematica for specific eigenvectors? Thanks

• Isn't everything you need already present in Eigensystem[m] ? Even Eigensystem[{{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}] which has eigenvalues {3,0,0} will have three eigenvectors Commented Sep 16, 2020 at 15:52
• ^ i.e do something like With[{vals, vecs} = Eigensystem[m], Pick[vecs, Unitize[vals] /. {1 -> True, 0 -> False}]] Commented Sep 16, 2020 at 15:58

Eigenvectors for a degenerate eigenvalue are not uniquely defined. However, from the help: "Eigenvectors corresponding to degenerate eigenvalues are chosen to be linearly independent". But note, they need not be orthogonal and even less, orthonormal. But you may linearly combine them to your taste and they stay eigenvectors. You may also normalize them. Here is an example:

m = (rt = RotationMatrix[{{1, 0, 0}, {1, 1, 1}}]).DiagonalMatrix[{1,
2, 2}].Transpose[rt];
es = Eigensystem[m];
Print["Eigenvalues=", es[[1]]];
Print["Eigenvectors=", es[[2]]];


we create a matrix with a twice degenerate eigenvalue of 2 and a further eigenvalue of 1. If we calculate all possible scalar products between the eigenvectors, you can see that the degenerate eigenvectors have norm 2 and are not orthogonal. But both are orthogonal to the third eigenvector, which has norm 3.

Print["Scalar products=",Outer[Dot, es[[2]], es[[2]], 1] // MatrixForm]


You can convince yourself that these are eigenvectors by:

Print["Eigenvectors in columns:", Transpose[es[[2]]] // MatrixForm]
Print["m.Eigenvectors in columns:",
m. Transpose[es[[2]]] // N // Chop  // MatrixForm]


You can get orthonormal degenerate vectors by "Orthogonalize" the first 2 vectors. If we then calculate all possible scalar product, you see, that the degenerate vectors are now orthogonal and normalized:

Print["Orthonormal deg. Eigenvectors",onvecs = Orthogonalize[es[[2,1;;2]]] ]
Print["Scalar prod. between orth. deg. orthonorm. eigenvectors=",Outer[Dot, onvecs, onvecs, 1] // MatrixForm ]


Of course they are still eigenvectors to the degenerate eigenvalue of 2 as you can see by:

Print["Orth. eigenvec. in columns:", Transpose[onvecs] // N // MatrixForm]
Print["m.eigenvec. in columns:",
m.Transpose[onvecs] // N // Chop // MatrixForm]