# Factoring a diagonal matrix of real numbers

Given a diagonal matrix $X$, what is the best way to factor it using two vectors as $X=u \cdot v^T$? How do we find such vectors $u$ and $v$ for a diagonal matrix $X$?

-
The only diagonal matrices that can be factored as the (outer) product of two vectors are those that have at most one nonzero element. In that case, you can use $(0,\ldots,0,1,0,\ldots,0)$ and $(0,\ldots,0,c,0,\ldots,0)$. – Henning Makholm Jan 25 '12 at 1:22
@PZZ, This approach would not lead to the off-diagonal elements being zero, as I define X as a diagonal matrix. – user23600 Jan 25 '12 at 4:06
@pvep: Do you say you define a diagonal matrix to be one of the form $u \cdot v^T$? Please don't, every calls a diagonal matrix one with nonzero entries only on the diagonal. Matrices of the form $u \cdot v^T$ are called rank-$1$ matrices. – Marc van Leeuwen Jan 25 '12 at 8:45

If a diagonal matrix $D=\operatorname{diag}(\lambda_1,\ldots,\lambda_n)$ can we written as $u\cdot v^T$, with $u=(u_1,\ldots,u_n)^T$ and $v=(v_1,\ldots,v_n)^T$, and if $\lambda_i\neq 0$ and $\lambda_k\neq 0$ for two distinct $i,k\in\{1,\ldots,n\}$, then $u_iv_i\neq 0$ and $u_kv_k\neq 0$. So $u_i,v_i,u_k,v_k$ are different from $0$, and so is for example $u_iv_k$. In particular $u\cdot v^T$ is not diagonal.