Thread Subject: Help Basic Functions: How do I check if a matrix equations has an answer?

Subject: Help Basic Functions: How do I check if a matrix equations has an answer?

From: Swade Jackson

Date: 8 Dec, 2009 17:54:04

Message: 1 of 3

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

Subject: Help Basic Functions: How do I check if a matrix equations has an answer?

From: King

Date: 8 Dec, 2009 19:05:18

Message: 2 of 3

"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.

Subject: Help Basic Functions: How do I check if a matrix equations has an answer?

From: John D'Errico

Date: 8 Dec, 2009 20:19:18

Message: 3 of 3

"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

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com