# Writing a matrix as sum of outer products

Outer product is defined as $\langle a,b \rangle = a b^T$ where $a, b \in \mathbb{R}^{n\times1}$. We have an $n \times n$ matrix $A$ whose entries are given by $a_{j,j+1}=1$ and all other elements are 0. For example, $$A = \left[\begin{matrix} 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 \end{matrix} \right]$$

How do I write such a matrix as sum of outer-products only (no quadratic forms, etc.) ? I think it involves the canonical vectors $e_j = [0,\ldots,0,1,0, \ldots, 0]$ but can't see how. Any hints ?

-

$\langle e_i, e_j \rangle$ is a matrix with a $1$ in position $(i,j)$ and zeros elsewhere. So you can just add up three such terms, with $i$'s and $j$'s corresponding to the positions where you have $1$ in your matrix $A$.