How can i split a matrix into product of two matrices in matlab?
13 views (last 30 days)
Show older comments
Betha Shirisha
on 15 Feb 2015
Commented: John D'Errico
on 15 Feb 2015
I am having a matrix A which is formed by multplying matrix X with it's conjugate transpose (A=X*X'),how can i find matrix X from A?
0 Comments
Accepted Answer
emehmetcik
on 15 Feb 2015
@John D'Errico
You are right about your comment on singularity of a matrix and positive definiteness.
I assumed that since it was a covariance matrix, it should be positive semi definite. Since the error message is `Matrix must be positive definite`, I concluded that the determinant of the matrix A should be equal to zero and therefore it is not positive definite (it is positive semi definite). So the conclusion must have been that the matrix A is singular, rather than it is not positive definite (although it is still a correct proposition).
What I should have said was:
If the A matrix is not positive definite, ...
"it means that the matrix A is singular, (because it is a covariance matrix, therefore it is positive semi definite)"
... which means that the solution you are looking for is not unique. That is to say, there are many X matrices satisfying A = X*X'.
Hence I was talking about this specific problem, rather than trying to point out a general fact. Sorry for the confusion that I created.
...
But I think the error here is not caused by a complex diagonal element, as you mentioned above, since A = X * X' and as I said many times already it is a covariance matrix. And the error message returned by chol can also be generated by real diagonal inputs as well, by using a singular matrix;
chol([1, 2; 3, 4])
Error using chol
Matrix must be positive definite.
Therefore, my suggestion to use svd will not fail for this problem, because we are dealing with a singular "A" matrix, which is a covariance matrix (A = X*X'), therefore it is Hermitian and is diagonalizable.
But in general, I agree that not every matrix can be decomposed into the form described above (A = X*X'), as your example of a matrix with complex diagonal entry suggests.
4 Comments
John D'Errico
on 15 Feb 2015
I will only repeat the statement that the error:
[R] = chol(WW)
Error using chol Matrix must be positive definite with real diagonal.
is generated ONLY when a complex diagonal element is present, and under apparently no other conditions that I can find. (Since chol is built-in, we cannot see the code.) If the matrix is merely singular, even if the off-diagonal elements are complex, you will see a different error.
Whether the matrix MAY be numerically singular in addition to that fact, I cannot know myself, since I have not seen the matrix. The last comment by Betha indicates the 4x4 matrix probably has numerical rank 2 since it has two tiny singular values.
And, no, there is no unique solution when you have a singular problem.
More Answers (1)
John D'Errico
on 15 Feb 2015
help chol
5 Comments
John D'Errico
on 15 Feb 2015
Edited: John D'Errico
on 15 Feb 2015
@emehmetcik - NO. Your statement is simply not correct. You are possibly confusing the idea of positive definite with singularity for a matrix.
A singular matrix will have infinitely many solutions.
A positive definite matrix M has the property that for any possible vector x, the product (x'*M*x) will be a positive number.
This is sometimes confused by people, because if M is a singular matrix, then there exists some vector x such that M*x will yield the zero vector.
The error message returned by chol is a reflection of the requirement for chol, that it requires a matrix with real diagonal.
Your suggestion to use SVD will fail. Why? Because that error message is returned when the matrix has a complex diagonal element.
As you can see, the error message that is generated indicates a complex diagonal element was supplied.
chol(diag([1 0]))
Error using chol
Matrix must be positive definite.
chol(diag([i 0]))
Error using chol
Matrix must be positive definite with real diagonal.
Only when a diagonal element was not real did chol produce that message.
So the question is, can you find a factorization using the scheme you propose using SVD (or any scheme) for a matrix with diagonal elements that are not real? The simple answer is no, and in fact, that is easily proven.
Consider what the diagonal elements of a matrix as a product X*X' are formed from. The diagonal element (so the (k,k) element) of the matrix:
M = X*X'
will be
X(k,:)*X(k,:)'
So the dot product of a vector with itself, conjugate transposed. Consider that this result will NEVER be a complex number.
Therefore SVD will NEVER yield a solution to a problem that has no solution possible.
In addition, your suggestion to use cholcov will also fail, as it must.
cholcov([i 0 ;0 1])
ans =
[]
John D'Errico
on 15 Feb 2015
@Betha - The answer to you is that IF this error has been returned, it is because no solution exists, or can exist. As I point out above, a matrix with complex diagonal elements cannot be factorized in the form
M = X*X'
See Also
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!