# Get positive eigenvalues of density matrix

6 views (last 30 days)
RM on 13 Mar 2017
Commented: RM on 15 Mar 2017
I would like to compute the eigenvector of the normalised Laplacian of a graph, which I think has properties of density matrix, that is trace = 1 and eigenvalues between 0 and 1. However when I compute the eigenvalues some are negative. Is there a problem with my code?
My initial adjacency matrix is:
A1 =
0 1 1 1 0 0 0 0
1 0 1 1 0 0 0 0
1 1 0 1 0 0 0 0
1 1 1 0 0 0 0 0
0 0 0 0 0 1 1 1
0 0 0 0 1 0 1 1
0 0 0 0 1 1 0 1
0 0 0 0 1 1 1 0
My code then is:
[n,n] = size(A1);
D = zeros(n,1);
D(:,1) = sum(A1);
Norm1 = sum(D(:, 1));
L1 = (D(:, 1) - A1)/Norm1;
[V,D] = eig(L1)
The resulting eigenvalues are:
-0.1250
0.0417
0.0417
0.0417
0.0417
0.0417
0.0417
0.8750
The first one is negative, but since L1 is a density matrix I think there is a problem with my code.
##### 6 CommentsShowHide 5 older comments
RM on 15 Mar 2017
Perfect! Thank you very much. This solves my problem.

Sign in to comment.

### Answers (1)

John D'Errico on 13 Mar 2017
Edited: John D'Errico on 13 Mar 2017
You cannot compute eigenvalues for a matrix subject to a constraint. I'm sorry, but that simply does not make mathematical sense.
In fact, even if I replace the elements of your matrix with 1/12, the eigenvalues still have one negative eigenvalue.
So lets see if it is just a precision thing? I've turned your matrix into a symbolic one, assuming that you really intended 1/12 when you show 0.0833.
Ms =
[ 1/8, 1/12, 1/12, 1/12, 1/8, 1/8, 1/8, 1/8]
[ 1/12, 1/8, 1/12, 1/12, 1/8, 1/8, 1/8, 1/8]
[ 1/12, 1/12, 1/8, 1/12, 1/8, 1/8, 1/8, 1/8]
[ 1/12, 1/12, 1/12, 1/8, 1/8, 1/8, 1/8, 1/8]
[ 1/8, 1/8, 1/8, 1/8, 1/8, 1/12, 1/12, 1/12]
[ 1/8, 1/8, 1/8, 1/8, 1/12, 1/8, 1/12, 1/12]
[ 1/8, 1/8, 1/8, 1/8, 1/12, 1/12, 1/8, 1/12]
[ 1/8, 1/8, 1/8, 1/8, 1/12, 1/12, 1/12, 1/8]
eig(Ms)
ans =
-1/8
1/24
1/24
1/24
1/24
1/24
1/24
7/8
Lets see if this makes sense. I'll compute the eigenvector for that eigenvalue.
[V,D] = eig(M);
V(:,1)
ans =
0.35355
0.35355
0.35355
0.35355
-0.35355
-0.35355
-0.35355
-0.35355
M*V(:,1)
ans =
-0.044194
-0.044194
-0.044194
-0.044194
0.044194
0.044194
0.044194
0.044194
So, in fact, that negative eigenvalue makes complete sense. If I multiply your matrix by the vector V(:,1), then I get -1/8*V(:,1) back. That is what an eigenvalue/eigenvector pair means.
I would suggest you are in error when you claim that ALL of the eigenvalues of this matrix must be positive.
##### 2 CommentsShowHide 1 older comment
John D'Errico on 14 Mar 2017
That could be. This matrix clearly has a negative eigenvalue.

Sign in to comment.

### Categories

Find more on Linear Algebra in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!