-1

I have a 6000*6000 symmetric matrix and all entries are positive. I use eig function of matlab to decompose its eigenvalues&eigenvectors. But there are negative eigenvalues in results. Where do you think is the problem?

Thanks. Sevil.

rayryeng
  • 102,964
  • 22
  • 184
  • 193
Sevil95
  • 31
  • 1
  • 2
    For future reference, when one is using MATLAB and gets to the point to ask "Is MATLAB doing the math wrong?" The answer is **always**: "No, you are doing something wrong". – Ander Biguri Jan 10 '17 at 12:03

1 Answers1

5

There is no problem. Just because a matrix is symmetric and has all positive values doesn't guarantee positive eigenvalues. For example, try the following symmetric matrix with all positive values [3 4; 4 3]. Performing eig([3 4; 4 3]) produces the eigenvalues of -1 and 7 and so one of the two eigenvalues is negative.

Take note that a matrix with all positive values and is symmetric is different from a matrix that is positive definite. Matrices that are positive definite have all positive eigenvalues which I believe is where you are confused. All in all, symmetric matrices that have all positive values are not necessarily positive definite matrices as you can clearly see in the example I gave above.

rayryeng
  • 102,964
  • 22
  • 184
  • 193
  • The matrix I'm working on is laplacian of adjacency matrix of a graph. It shouldn't have negative eigenvalue. – Sevil95 Jan 10 '17 at 07:33
  • 1
    @Sevil95 Then your adjacency matrix is wrongly formed. There's no way I or anyone else can diagnose your problem if you don't show any code. Right now, your question is poorly formed as you haven't showed us what you tried for us to reproduce your problem. Please learn [ask] a proper question and please take the time to go on a [tour]. – rayryeng Jan 10 '17 at 07:35
  • @Sevil95 Also read the definition of the Laplacian of an Adjacency Matrix: https://en.wikipedia.org/wiki/Laplacian_matrix#Definition. You can clearly see that there are negative values. As I said, your formulation is incorrect so there's nothing more to be said. – rayryeng Jan 10 '17 at 15:46