# creating a nested matrix from degenerate ground states

We try here simulate our main problem with a simpler model, because the problem to which we have encountered has a huge dimension. Please assume there exist a matrix by which we create ten other matrices as below procedure:

matrix0 = Table[-j*i + 10 (i + j), {i, 1, 20}, {j, 1, 20}];
Do[
matrix1[k] = k*matrix0
, {k, 1, 10}]


We wish to have the lowest eigenvalue of the matrix1s with some corresponding eigenvectors. Although here (for above matrix) the lowest eigenvalue is zero but it maybe is nonzero; and the number of corresponding eigenvectors is not always 18. We know how we can sort a matrix eigenvalues with corresponding eigenvectors by Eigensystem but since our matrices are big (for saving time) we just wish to have just some of eigenvectors according to the lowest eigenvalue and not all of them. In other word: the degenerate ground states

In fact we wish to have a nested matrix as below one:

How we can create same as the above nested matrix from ten matrix1[k]s?!

• This seems to work. minEigSys[mat_, n_] := With[{eigmax = Abs[Eigenvalues[mat, 1][[1]]]}, With[{esys = Eigensystem[mat - eigmax*IdentityMatrix[Length[mat]], n]}, {esys[[1]] + eigmax, esys[[2]]}]] May 21 '17 at 14:49

Background

We know we can use expressions like Eigenvalues[m,3] to get the highest 3 eigenvalues of a matrix and Eigenvalues[m,-2] to get the lowest 2 eigenvalues. But, the difficulty is MMA uses the magnitude / absolute value of the eigenvalues to rank them. If our lowest (ground state) eigenvalue is say, -1, and there is a many degenerate states with eigenvalues between -1 and 1 and there are many states with eigenvalues greater than 1, then our ground state will be in the "middle" of the list of eigenvalues when they are sorted by magnitude.

Our situation

We want to know the lowest eigenvalue, its multiplicity and its eigenvectors. We assume the eigenvalues are real and MMA can calculate these, but we do not have time for calculate all of the eigenvalues of a large matrix. We also assume the eigenvectors form a "complete orthonormal basis". We want to calculate as few eigenvalues and eigenvectors as possible.

Imagine we calculate the largest and smallest two eigenvalues, call them $\omega_2$ and $\omega_1$ using ω2 = First@Eigenvalues[m, 1] and ω1 = First@Eigenvalues[m, -1]. If $\omega_1$ and $\omega_2$ are both zero then all of the eigenvalues are zero. If $\omega_2$ is negative, it is the ground state eigenvalue and we only need to find its multiplicity and eigenvectors. But if $\omega_2$ is positive, then the ground state eigenvalue, $\omega_0$, could have any value such that $-|\omega_1|< \omega_0 < -|\omega_2|$. If $\omega_2$ is positive, $\omega_1$ could also be the ground state eigenvalue, but how can we be sure?

Here is a trick

We can shift all of the eigenvalues up or down by any amount we like. In particular, we can shift them all down by the amount $\omega_2$. We do this by calculating a new matrix m2 = m - ω2 * IdentityMatrix[Length[m]] If $\omega_2>0$ this shift guarantees the ground state eigenvalue of matrix $m$ can be calculated by ω0 = ω2 + First@Eigenvalues[m2, 1]. Notice that before we had used -1 to find the smallest (magnitude) eigenvalue. Now we are using +1 to find the most negative eigenvalue.

To understand why this works, we note that the eigenvectors of $m$ are also eigenvectors of the identity matrix.

Multiplicity / Degeneracy

Now that we have the ground state eigenvalue $\omega_0$, how do we find the eigenvectors for that state? We note that the eigenvector(s) corresponding to the ground state eigenvalue $\omega_0$ are a basis for the null space of the matrix $m - \omega_0 I$, where $I$ is the identity matrix. In MMA we can calculate the eigenvectors of the ground state by ev0 = NullSpace[m - ω0 * IdentityMatrix[Length[m]]. Thanks to @m-bubu for this approach.

Sample code

The following code sample illustrates how we can handle the case when $\omega_2 > 0$ and there is a degenerate ground state $\omega_0 < -|\omega_1|$. In the first section of code we want to create an example matrix that has a degenerate ground state with a negative eigenvalue. We start with a list of eigenvalues, $\omega$ in any order. The list can be any length and can have repeated values. Next, we pick some eigenvectors at random, orthogonalize them and use them to form a matrix $m$. This procedure guarantees $m$ has eigenvalues and eigenvectors with known properties.

ClearAll["Global*"]

ω = RandomSample[{-1/2, -1/2, 1/2, 3/2, 5/2}];
ndim = Length[ω];
ev = Orthogonalize@RandomInteger[{-2 ndim, 2 ndim}, {ndim, ndim}];

m = Sum[ω[[k]] KroneckerProduct[ev[[k]], ev[[k]]],
{k, 1, ndim}];
m // MatrixForm;


In the second section of code we calculate $\omega_1$ and $\omega_2$. The value of $\omega_1$ is not really used, but it may be of interest to show that $\omega_1$ is not necessarily the ground state eigenvalue.

ω1 = First@Eigenvalues[m, -1];
ω2 = First@Eigenvalues[m, 1];
{ω1, ω2}

(*  { 1/2 , 5/2 }  *)


In the third section we calculate the matrix $m_2$ and the ground state eigenvalue, $\omega_0$ of the matrix $m$.

m2 = m - ω2 IdentityMatrix[ndim];
ω0 = ω2 + First@Eigenvalues[m2, 1]

(*  -1/2  *)


In the final section we calculate the eigenvectors of the ground state as follows:

m3 = m - ω0 IdentityMatrix[ndim];
ev0 = NullSpace[m3];
MatrixForm /@ ev0


This method should efficiently find the ground state eigenvalue and eigenvector(s) for large matrices since it requires calculating only two eigenvalues and then only the eigenvector(s) for the ground state.

Final form

To put the results in the final desired form we would use {k, ω0, ev0}.

• Thank you so much for your explanation. I must deeply read what you have mentioned May 21 '17 at 16:20
• your explanations are very helpful and amazing. But there remains a bit problem. I will ask that. May 22 '17 at 5:22
• @Irreversible I will be glad to answer any follow-on questions, if I can. Please consider adding them to your original question to encourage others to respond as well. May 22 '17 at 6:16

Try this

Table[{k, N[Min[Eigenvalues[matrix1[k]]]],  N[First@NullSpace[
matrix1[k] -
Min[Eigenvalues[matrix1[k]]] IdentityMatrix[20]]]}, {k, 1, 10}]

• Using the NullSpace` is an excellent approach. I am changing my answer to incorporate this idea. May 21 '17 at 8:22