|
"King" <majumdak@gvsu.edu> wrote in message <hfm81e$nag$1@fred.mathworks.com>...
> "Swade Jackson" <swadejaxsun@yahoo.com> wrote in message <hfm3rs$pdd$1@fred.mathworks.com>...
> > The subject describes it all. I have three equations, three unknowns, and I know how to setup the matrices, but how do I check if there is a solution. I don't want to solve it I just want to prove that a solution exists.
> >
> > Thanks
>
> Check if the three equations are linearly independent. Calculate the determinant of the matrix - if it is zero then the equations are linearly dependent. If it not zero you should be able to find a unique solution.
NO, NO, NO. DON'T compute the determinant to see if
a matrix is singular!!!!!! This is always a poor choice to
determine singularity. And even then it is not sufficient.
For example, how would it work on the following problem?
A = ones(2);
b = [2;2];
Does a solution exist for A*x = b? YES! A valid solution
exists despite the singularity of A. det(A) is zero of course.
Yet the answer is just x = [1;1]. We can find it using pinv.
pinv(A)*b
ans =
1
1
The question posed is how to know if a solution exists?
The way that works for any problem is to use rank.
rank([A,b]) == rank(A)
ans =
1
If the result is true, then a solution exists. Try it for
a problem that has no solution.
c = [1;2];
rank([A,c]) == rank(A)
ans =
0
John
|