Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!p16g2000vbo.googlegroups.com!not-for-mail
From: Greg Heath <heath@alumni.brown.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Matrix inversion problem - What's going on?
Date: Tue, 12 Apr 2011 21:55:06 -0700 (PDT)
Organization: http://groups.google.com
Lines: 85
Message-ID: <98482f41-24bd-43e8-8ed0-fccb2f2d9a76@p16g2000vbo.googlegroups.com>
References: <82709a89-8b9f-41ca-90b4-c9738d23a8c2@d11g2000yqo.googlegroups.com>
 <1ce4d6d3-488e-4d04-a153-a7137ff652b3@l39g2000yqh.googlegroups.com>
 <io1c41$khn$1@fred.mathworks.com> <04746ccf-3cb3-4858-ac33-1303fff4b32a@w21g2000yqm.googlegroups.com>
NNTP-Posting-Host: 69.242.101.137
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1302670506 23633 127.0.0.1 (13 Apr 2011 04:55:06 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 13 Apr 2011 04:55:06 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: p16g2000vbo.googlegroups.com; posting-host=69.242.101.137; posting-account=mUealwkAAACvQrLWvunjg50tRAnsNtJR
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:721575

On Apr 12, 1:47 pm, "printer newbie!" <newsbo...@gmail.com> wrote:
> On 12 Apr., 13:13, "John D'Errico" <woodch...@rochester.rr.com> wrote:
> > "printer newbie!" <newsbo...@gmail.com> wrote in message <1ce4d6d3-488e-4d04-a153-a7137ff65...@l39g2000yqh.googlegroups.com>...
> > > So it was just a coincidence that it worked out for the first matrix,
> > > but not the second...
>
> > > What property (of the matrix A) is it then, that makes it work out
> > > great for the first A-matrix, when they're both the same physical size
> > > (3x2)? Are any lines in the first matrix linear combinations of
> > > another line?
>
> > In the second case, b (the right hand side) was an
> > exact linear combination of the columns of your first
> > matrix A. So you might notice that A1(:,2)/2 would
> > yield [1;2;3]. This just happens to be identically b.
>
> > A way to identify that this happens is when
>
> >    rank(A) == rank([A,b])
>
> > Try it.
>
> > A1=[1 2; 3 4;5 6];
> > A2=[1 2; 3 4;5 5];
> > b=[1;2;3];
>
> > rank(A1) == rank([A1,b])
> > ans =
> >      1
>
> > rank(A2) == rank([A2,b])
> > ans =
> >      0
>
> > Therefore the first problem x = A1\b will have an exact
> > solution, while the second problem does not. Well,
> > exact to within the floating point precision of MATLAB.
>
> Great, thanks!
>
> So it had nothing to do with SVD

Incorrect. It is intimately related.

1. rank(A,tol) is the number of singular values greater than tol
2. The use of rank(A) uses the default

    tol = max(size(A)) * max(svd(A)) * eps

3. cond(A) is the ratio max(svd(A) / min(svd(A))


>- btw: I'm not that good at singular
> value decomposition.
>
> Maybe a clever and friendly guy can help explaining if I can use SVD
> to determine the quality of my matrices and whether they're
> illconditioned or not

You can either use the above relations or skip the middleman
and just use rank and cond.

See

help rank
doc rank

help norm
doc norm

help cond
doc cond

help svd
doc svd

as well as the corresponding wikipedia explanations.

Reply if you have additional questions.

Hope this helps.

Greg