# Verifying: How to express a given matrix as the outer product of two vectors? [closed]

The question posed here and here is:

Is it possible to decompose a matrix $$M_{m\times n}$$ as the product of two vectors, i.e.

$$M_{m\times n} = \vec{y}_{m\times 1}\times\vec{x}_{1\times n}+const.$$

The suggestion is to use SingularValueDecomposition to arrive at $$\vec{y}$$ and $$\vec{y}$$.

I used the Wikipedia SVD example as data, but I don't recover M as suggested.

Wikipedia example:

M = {{1, 0, 0, 0, 2}, {0, 0, 3, 0, 0}, {0, 0, 0, 0, 0}, {0, 2, 0, 0, 0}}
U = {{0, 0, 1, 0}, {0, 1, 0, 0}, {0, 0, 0, -1}, {1, 0, 0, 0}}
Σ = {{2, 0, 0, 0, 0}, {0, 3, 0, 0, 0},
{0, 0, Sqrt[5], 0, 0}, {0, 0, 0, 0, 0}}
V = {{0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}, {Sqrt[2/10], 0, 0, 0, Sqrt[8/10]},
{0, 0, 0, 1, 0}, {-Sqrt[8/10], 0, 0, 0, Sqrt[2/10]}}

s = Σ[[1, 1]]
u = U[[All, 1]]
u = s*u
v = V[[All, 1]]
Outer[Times, u, v]


Mathematica SVD of Wikipedia example:

{U, Σ, V} = SingularValueDecomposition[M]
s = Σ[[1, 1]]
u = U[[All, 1]]
u = s*u
v = V[[All, 1]]
Outer[Times, u, v]


In both cases only one element of M is recovered.

$$\qquad \begin{array}{ccccc} 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 3 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ \end{array}$$

Questions:

1. Does this MMA result mean the accepted answer is incorrect?

2. Is it possible, in MMA, to decompose a matrix into the outer product of two vectors?

• "you cannot do what the original questions asked: Decompose a matrix into the outer product of two vectors?" Of course not! Otherwise all matrices would have rank one (and there were no invertible matrices). What you can hope for is that you can approximate a given matrix by an outer product. And this is only possible if the greatest singular value is much greater than the second largest one (and thus greater then each other singular value) – Henrik Schumacher Nov 30 '19 at 23:59

Question:

1. Does this MMA result mean the accepted answer is incorrect?

1. Yes, if the question is "How to decompose a matrix into the outer product of two vectors". No, if the question is "find two vectors u and v, that minimize some difference from $$M$$". However, you can use the approach suggested to recover several pairs of vectors, whose outer products each give a matrix. Add those matrices together, and you recover $$M$$.

Example (from the question):

So, you cannot arrive at a single pair of vectors u and v whose outer product will return $$M$$. Rather there are pairs of vector, u_i and v_i, whose outer products, when summed is, $$M$$.

m = 0;
For[ix = 1, ix < 4, ix++,
s = Σ[[ix, ix]];
u = s*U[[All, ix]];
v = V[[All, ix]];
k = Outer[Times, u, v];
Print[k];
m = m + k;
]
Print[m];


Question 2 is open:

Is it possible, in MMA, to decompose a matrix into the outer product of two vectors?

• Which accepted answer is incorrect? The one on MO asks about the norm minimization. Everything is fine there. – yarchik Dec 3 '19 at 9:02