I need to solve an eigenvalue problem where some of the eigenvalues are 0. Due to the fact that I just need the eigenvectors associated to the 0-eigenvalues in some cases I'd just like to calculate the Nullspace Basis of the matrix itself instead of the whole eigenvalue problem.
My problem however is that this approach is just working for smaller matrices. If the matrices are getting bigger the basis calculated via NullSpace[]
differes from the "original" eigenvectors.
Here the result from solving the eigenvalue problem:
SeedRandom[123];
TestMat = {{1, 2, 3, 4}, {2, 4, 6, 8}, {3, 6, 9, 12}, {1, 0, 0, 1}};
Eigenvectors[TestMat] // N
{{13.3007, 26.6015, 39.9022, 1.}, {-0.300735, -0.601471, -0.902206, 1.}, {-2., -3., 0., 2.}, {0., -3., 2., 0.}}
Here the approach with NullSpace[]
:
NullSpace[TestMat]
{{-2, -3, 0, 2}, {0, -3, 2, 0}}
If I try the same approach with a bigger matrix the procedure fails to compute the eigenvectors from the eigenvalue problem associated with the eigenvalue 0.
TestMat2 =
Join[#*Range[100] & /@ Range[10],
ResourceFunction["RandomMatrix"][
Real, {0, 100}, {90, 100}]];
EV = Eigenvectors[TestMat2];
EV0Sep = NullSpace[TestMat2];
Norm[Abs@EV0Sep[[#]] - Abs@EV[[91 + #]]]/Norm[EV[[91 + #]]] & /@
Range[Length@EV0Sep]
{0.909716, 0.903307, 0.807493, 0.764305, 0.665924, 0.634019, 0.776413, 0.815826, 0.634899}
TestMat2
is just a random matrix with nine linear dependant columns so I end up getting nine 0-eigenvalues. As you can see in the last calculation there is a significant difference between the eigenvectors calculated with Eigenvectors[TestMat2]
and NullSpace[TestMat2]
.
Did I make a mistake or is there a possibility to calculate the NullSpace manually? (LinearSolve[TestMat2,ConstantArray[0,Length@TestMat2]]
does not work unfortunatly)