```Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Matrix decomposition in vectors
Date: Mon, 26 Jan 2009 17:51:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 17
Message-ID: <glkt65\$97f\$1@fred.mathworks.com>
References: <glkkq2\$8i2\$1@fred.mathworks.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1232992261 9455 172.30.248.38 (26 Jan 2009 17:51:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 26 Jan 2009 17:51:01 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:514011

"Umair Mansoor" <umairbinmansoor@hotmail.com> wrote in message <glkkq2\$8i2\$1@fred.mathworks.com>...
> Can someone tell me how can I decompose a matrix in vectors, like, a 2x2 matrix in to the product of a 2x1 and 1x2 vectors?

To decompose any matrix in the way you propose, use the singular value decomposition function, 'svd'.  If there is only one non-zero singular value, then that gives you a solution.  If there are more than one, no solution is possible.

If the matrix is A, do

[U,S,V] = svd(A);

Suppose the only non-zero value in S is S(1,1).  Then you have

A = U*S*V' = (U(:,1)*S(1,1)) * (V(:,1)')

which gives you a solution and shows you that the choice is only arbitrary up to a multiplicative constant.  Otherwise no solution is possible.

Roger Stafford

```