chol() Error with Real, Symmetric, Positive Definite, 3-by-3 Matrix

5 views (last 30 days)
Hi all,
I am trying to use the chol() function to find the upper/lower triangular Cholesky factor of the following 3-by-3 matrix:
X = [1.000000000000000, 0.316227766016838, 1.732050807568878;
0.316227766016838, 2.000000000000000, 1.643167672515499;
1.732050807568878, 1.643167672515499, 3.000000000000002];
The matrix is symmetric:
X == X'
ans =
3×3 logical array
1 1 1
1 1 1
1 1 1
Using svd() yields that the matrix has 3 real, strictly positive eigenvalues and is therefore positive definite and full rank:
ans =
The rank function confirms that X is full rank:
ans =
However, when trying to use the chol() function to obtain the upper/lower Cholesky factor of X it fails:
Error using chol
Matrix must be positive definite.
Any help with this problem would be much appreciated.
Thanks in advance!

Accepted Answer

Gillian Rosen
Gillian Rosen on 13 Mar 2017
Hi Matthias, 
I understand that you are trying to use the 'chol' function to find the upper/lower triangular Cholesky factor of a certain 3x3 matrix. You are getting an error that the matrix 'must be positive definite', even though it looks like the matrix is already positive definite. 
Unfortunately, it seems that the matrix X is not actually positive definite. To explain, the 'svd' function returns the singular values of the input matrix, not the eigenvalues. These two are not the same, and in particular, the singular values will always be nonnegative; therefore, they will not help in determining whether the eigenvalues are nonnegative. To obtain the eigenvalues, you can use the 'eig' function, as follows: 
>> eig(X)
ans =
Note that when you use the 'eig' function to obtain the eigenvalues, one of the values is -0.1885; therefore, the eigenvalues are not strictly positive, and the matrix is not positive definite.  
For more information, see the documentation on singular values and eigenvalues: 

More Answers (0)


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!